Module: appdb
Branch: master
Commit: a6a62a22994e644788f5a87030f8d737959b1d9c
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=a6a62a22994e644788f5a870…
Author: Alexander Nicolaysen Sørnes <alex(a)thehandofagony.com>
Date: Tue Sep 18 13:18:50 2007 +0200
Use objectManager to display versions
---
appview.php | 2 +-
include/objectManager.php | 23 +++++++++++++++++++++++
include/version.php | 16 ++++++++++++++--
objectManager.php | 17 +++++++++++++----
4 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/appview.php b/appview.php
index 4ad6e8a..6b4e3b3 100644
--- a/appview.php
+++ b/appview.php
@@ -79,7 +79,7 @@ if( isset($aClean['iAppId']) )
} else if( isset($aClean['iVersionId']) ) // We want to see a particular version.
{
$oVersion = new Version($aClean['iVersionId']);
- $iTestingId = isset($aClean['iTestingId']) ? $aClean['iTestingId'] : null;
+
// header
apidb_header("Viewing App: ".version::fullName($oVersion->iVersionId));
$oVersion->display($aClean);
diff --git a/include/objectManager.php b/include/objectManager.php
index 1b2737a..7473998 100644
--- a/include/objectManager.php
+++ b/include/objectManager.php
@@ -700,6 +700,29 @@ class ObjectManager
}
}
+ /* Gets the title of the page to be displayed. Classes can set
+ the page title depending on the action, or return null to
+ let objectManager use one, normally the title specified in
+ the URL. Since this only affects the user interface and not
+ functionality, objectGetCustomTitle is not a required method.
+ Why do we need this method? Think of the versions, for instance.
+ If we were to fetch the name from the URL, that would mean
+ that changes to the version name would not be reflected in
+ static URLs, like external links to the AppDB. */
+ function get_title($sAction)
+ {
+ $oObject = new $this->sClass($this->iId);
+ $sTitle = "";
+
+ if(method_exists($oObject, "objectGetCustomTitle"))
+ $sTitle = $oObject->objectGetCustomTitle($sAction);
+
+ if(!$sTitle)
+ $sTitle = $this->sTitle;
+
+ return $sTitle;
+ }
+
/* Gets the custom variables, if any, from a class depending on
the action which is being taken, such as viewing an entry,
editing one etc.
diff --git a/include/version.php b/include/version.php
index 1d14db2..85c723b 100644
--- a/include/version.php
+++ b/include/version.php
@@ -719,6 +719,18 @@ class version {
$this->iObsoleteBy = 0;
}
+ function objectGetCustomTitle($sAction)
+ {
+ switch($sAction)
+ {
+ case "display":
+ return "Viewing App: ".version::fullName($this->iVersionId);
+
+ default:
+ return null;
+ }
+ }
+
function objectGetCustomVars($aClean, $sAction)
{
switch($sAction)
@@ -986,7 +998,7 @@ class version {
// show the test results table
if($oTest->iTestingId)
{
- $oTest->ShowVersionsTestingTable($_SERVER['PHP_SELF']."?iVersionId=".$this->iVersionId."&iTestingId=",
+ $oTest->ShowVersionsTestingTable($this->objectMakeUrl()."&iTestingId=",
5);
}
if($_SESSION['current']->isLoggedIn())
@@ -1278,7 +1290,7 @@ class version {
function objectMakeUrl()
{
- return APPDB_ROOT."appview.php?iVersionId=$this->iVersionId";
+ return APPDB_ROOT."objectManager.php?sClass=version&iId=$this->iVersionId";
}
function objectMakeLink()
diff --git a/objectManager.php b/objectManager.php
index 7052c62..e880a68 100644
--- a/objectManager.php
+++ b/objectManager.php
@@ -79,12 +79,21 @@ if(isset($aClean['sAction']) && $aClean['sAction'] == "add")
if($oObject->iId && $aClean['sAction'] == "moveChildren" && $aClean['iNewId'])
$oObject->move_children($aClean['iNewId']);
-apidb_header($oObject->sTitle);
+$sAction = $aClean['sAction'];
+
+/* If no action is specified, use a default depending on other parameters */
+if(!$sAction)
+{
+ if($oObject->iId)
+ $sAction = "display";
+}
+
+apidb_header($oObject->get_title($sAction));
/* display a particular element */
if($oObject->iId)
{
- switch($aClean['sAction'])
+ switch($sAction)
{
case "cancel":
$oObject->display_table($aClean); /* go back to the queue */
@@ -102,11 +111,11 @@ if($oObject->iId)
$oObject->delete_prompt();
break;
- default:
+ case "display":
$oObject->view($_SERVER['REQUEST_URI'], $aClean);
break;
}
-} else if (isset($aClean['sAction']) && $aClean['sAction'] == "add")
+} else if ($sAction == "add")
{
$oObject->add_entry($_SERVER['REQUEST_URI'], $sErrors);
} else
Module: wine
Branch: master
Commit: b6f9a30a5d27e31e6bd27f24f7e1457c6aae334b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b6f9a30a5d27e31e6bd27f24f…
Author: Maarten Lankhorst <m.b.lankhorst(a)gmail.com>
Date: Sat Sep 15 15:21:00 2007 +0200
gdi: Implement line-by-line phase of the BiDi algorithm.
---
dlls/gdi32/bidi.c | 237 +++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 229 insertions(+), 8 deletions(-)
diff --git a/dlls/gdi32/bidi.c b/dlls/gdi32/bidi.c
index 7a93ec6..5993e92 100644
--- a/dlls/gdi32/bidi.c
+++ b/dlls/gdi32/bidi.c
@@ -814,6 +814,231 @@ static void resolveImplicit(const WORD * pcls, WORD *plevel, int cch)
}
}
+/* REORDER */
+/*------------------------------------------------------------------------
+ Function: resolveLines
+
+ Breaks a paragraph into lines
+
+ Input: Character count
+ In/Out: Array of characters
+ Array of line break flags
+
+ Returns the count of characters on the first line
+
+ Note: This function only breaks lines at hard line breaks. Other
+ line breaks can be passed in. If pbrk[n] is TRUE, then a break
+ occurs after the character in pszInput[n]. Breaks before the first
+ character are not allowed.
+------------------------------------------------------------------------*/
+static int resolveLines(WCHAR * pszInput, BOOL * pbrk, int cch)
+{
+ /* skip characters not of type LS */
+ int ich = 0;
+ for(; ich < cch; ich++)
+ {
+ if (pszInput[ich] == (WCHAR)'\n' || (pbrk && pbrk[ich]))
+ {
+ ich++;
+ break;
+ }
+ }
+
+ return ich;
+}
+
+/*------------------------------------------------------------------------
+ Function: resolveWhiteSpace
+
+ Resolves levels for WS and S
+ Implements rule L1 of the Unicode bidi Algorithm.
+
+ Input: Base embedding level
+ Character count
+ Array of direction classes (for one line of text)
+
+ In/Out: Array of embedding levels (for one line of text)
+
+ Note: this should be applied a line at a time. The default driver
+ code supplied in this file assumes a single line of text; for
+ a real implementation, cch and the initial pointer values
+ would have to be adjusted.
+------------------------------------------------------------------------*/
+static void resolveWhitespace(int baselevel, const WORD *pcls, WORD *plevel, int cch)
+{
+ int cchrun = 0;
+ int oldlevel = baselevel;
+
+ int ich = 0;
+ for (; ich < cch; ich++)
+ {
+ switch(pcls[ich])
+ {
+ default:
+ cchrun = 0; /* any other character breaks the run */
+ break;
+ case WS:
+ cchrun++;
+ break;
+
+ case RLE:
+ case LRE:
+ case LRO:
+ case RLO:
+ case PDF:
+ case BN:
+ plevel[ich] = oldlevel;
+ cchrun++;
+ break;
+
+ case S:
+ case B:
+ /* reset levels for WS before eot */
+ SetDeferredRun(plevel, cchrun, ich, baselevel);
+ cchrun = 0;
+ plevel[ich] = baselevel;
+ break;
+ }
+ oldlevel = plevel[ich];
+ }
+ /* reset level before eot */
+ SetDeferredRun(plevel, cchrun, ich, baselevel);
+}
+
+
+/*------------------------------------------------------------------------
+ Functions: reorder/reorderLevel
+
+ Recursively reorders the display string
+ "From the highest level down, reverse all characters at that level and
+ higher, down to the lowest odd level"
+
+ Implements rule L2 of the Unicode bidi Algorithm.
+
+ Input: Array of embedding levels
+ Character count
+ Flag enabling reversal (set to false by initial caller)
+
+ In/Out: Text to reorder
+
+ Note: levels may exceed 15 resp. 61 on input.
+
+ Rule L3 - reorder combining marks is not implemented here
+ Rule L4 - glyph mirroring is implemented as a display option below
+
+ Note: this should be applied a line at a time
+-------------------------------------------------------------------------*/
+static int reorderLevel(int level, LPWSTR pszText, const WORD* plevel, int cch, BOOL fReverse)
+{
+ int ich = 0;
+
+ /* true as soon as first odd level encountered */
+ fReverse = fReverse || odd(level);
+
+ for (; ich < cch; ich++)
+ {
+ if (plevel[ich] < level)
+ {
+ break;
+ }
+ else if (plevel[ich] > level)
+ {
+ ich += reorderLevel(level + 1, pszText + ich, plevel + ich,
+ cch - ich, fReverse) - 1;
+ }
+ }
+ if (fReverse)
+ {
+ reverse(pszText, ich);
+ }
+ return ich;
+}
+
+static int reorder(int baselevel, LPWSTR pszText, const WORD* plevel, int cch)
+{
+ int ich = 0;
+
+ while (ich < cch)
+ {
+ ich += reorderLevel(baselevel, pszText + ich, plevel + ich,
+ cch - ich, FALSE);
+ }
+ return ich;
+}
+
+/* DISPLAY OPTIONS */
+/*-----------------------------------------------------------------------
+ Function: mirror
+
+ Crudely implements rule L4 of the Unicode Bidirectional Algorithm
+ Demonstrate mirrored brackets, braces and parens
+
+
+ Input: Array of levels
+ Count of characters
+
+ In/Out: Array of characters (should be array of glyph ids)
+
+ Note;
+ A full implementation would need to substitute mirrored glyphs even
+ for characters that are not paired (e.g. integral sign).
+-----------------------------------------------------------------------*/
+static void mirror(LPWSTR pszInput, const WORD* plevel, int cch)
+{
+ static int warn_once;
+ int i;
+
+ for (i = 0; i < cch; ++i)
+ {
+ if (!odd(plevel[i]))
+ continue;
+ /* This needs the data from http://www.unicode.org/Public/UNIDATA/BidiMirroring.txt */
+ if (!warn_once++)
+ FIXME("stub: mirroring of characters not yet implemented\n");
+ break;
+ }
+}
+
+/*------------------------------------------------------------------------
+ Function: BidiLines
+
+ Implements the Line-by-Line phases of the Unicode Bidi Algorithm
+
+ Input: Count of characters
+ flag whether to mirror
+
+ Inp/Out: Input text
+ Array of character directions
+ Array of levels
+
+------------------------------------------------------------------------*/
+static void BidiLines(int baselevel, WCHAR * pszLine, WORD * pclsLine, WORD * plevelLine, int cchPara, int fMirror, BOOL * pbrk)
+{
+ int cchLine = 0;
+
+ do
+ {
+ /* break lines at LS */
+ cchLine = resolveLines(pszLine, pbrk, cchPara);
+
+ /* resolve whitespace */
+ resolveWhitespace(baselevel, pclsLine, plevelLine, cchLine);
+
+ if (fMirror)
+ mirror(pszLine, plevelLine, cchLine);
+
+ /* reorder each line in place */
+ reorder(baselevel, pszLine, plevelLine, cchLine);
+
+ pszLine += cchLine;
+ plevelLine += cchLine;
+ pbrk += pbrk ? cchLine : 0;
+ pclsLine += cchLine;
+ cchPara -= cchLine;
+
+ } while (cchPara);
+}
+
/*************************************************************
* BIDI_Reorder
*/
@@ -915,14 +1140,10 @@ BOOL BIDI_Reorder(
/* resolveImplicit */
resolveImplicit(chartype, levels, i);
- /* Temporary stub: Just reverse the odd levels */
- for (j = lastgood = 0; j < i; ++j)
- if (levels[j] != levels[lastgood])
- {
- if (odd(levels[lastgood]))
- reverse(lpOutString + done + lastgood, j - 1);
- lastgood = j;
- }
+ /* assign directional types again, but for WS, S this time */
+ classify(lpOutString + done, chartype, i);
+
+ BidiLines(baselevel, lpOutString + done, chartype, levels, i, !(dwFlags & GCP_SYMSWAPOFF), 0);
if (lpOrder)
{