[sword-svn] r236 - trunk/src/SlideBible
kalemas at crosswire.org
kalemas at crosswire.org
Wed Jun 2 11:27:43 MST 2010
Author: kalemas
Date: 2010-06-02 11:27:43 -0700 (Wed, 02 Jun 2010)
New Revision: 236
Modified:
trunk/src/SlideBible/sbControl.cpp
trunk/src/SlideBible/sbCore.cpp
trunk/src/SlideBible/sbCore.h
trunk/src/SlideBible/sbFeatures.cpp
trunk/src/SlideBible/sbItem.cpp
trunk/src/SlideBible/sbItem.h
trunk/src/SlideBible/sbList.cpp
trunk/src/SlideBible/sbList.h
trunk/src/SlideBible/sbTheme.cpp
trunk/src/SlideBible/sbTheme.h
trunk/src/SlideBible/todo.txt
Log:
+ sometime DrawCache mix up items
+ line breaks. do not break lines if there is only one character on the next line.
+ sbItem::getItem (sbDirection) global directions NEXT, PREV, LEFT, RIGHT
+ better enumeration of modules in module selection and module installer
+ warning war - clean build log from warnings
Modified: trunk/src/SlideBible/sbControl.cpp
===================================================================
--- trunk/src/SlideBible/sbControl.cpp 2010-05-24 19:44:18 UTC (rev 235)
+++ trunk/src/SlideBible/sbControl.cpp 2010-06-02 18:27:43 UTC (rev 236)
@@ -20,7 +20,7 @@
sbRect layout (int scheme, int num, int start, int end = 0)
{
- const int themeSize = Core->getTheme()->size;
+ const int themeSize = Theme->size;
sbRect rect;
if (scheme == 1) // bottom bar
@@ -28,14 +28,14 @@
if (end > 0)
{
rect.left = Core->getRect().right*start/num;
- rect.top = Core->getRect().bottom-Core->getTheme()->PanelSize;
+ rect.top = Core->getRect().bottom-Theme->PanelSize;
rect.right = Core->getRect().right*end/num;
rect.bottom = Core->getRect().bottom;
}
else
{
rect.left = Core->getRect().right*(start-1)/num;
- rect.top = Core->getRect().bottom-Core->getTheme()->PanelSize;
+ rect.top = Core->getRect().bottom-Theme->PanelSize;
rect.right = Core->getRect().right*start/num;
rect.bottom = Core->getRect().bottom;
}
@@ -81,7 +81,7 @@
: type ( _type_ )
, text ( L"" )
{
- const int themeSize = Core->getTheme()->size;
+ const int themeSize = Theme->size;
//const sbRect * screenRect = & Core->getSurface( sbCore::SURFACE::TYPE_WHOLE )->rect;
switch (type)
@@ -197,7 +197,7 @@
void sbControl::onPaint ( sbSurface hdc ) const
{
- sbFont font = sbSelectFont(hdc, Core->getTheme()->styles[style].font);
+ sbFont font = sbSelectFont(hdc, Theme->styles[style].font);
switch (type)
{
@@ -218,8 +218,8 @@
case TYPE_OPEN_SEARCH:
case TYPE_OPEN_SEARCH_2:
{
- Core->getTheme()->drawElement(hdc, &rect, sbTheme::ELEMENT::PANEL);
- sbSelectColor(hdc, Core->getTheme()->fadeColor(Core->getTheme()->elements[sbTheme::ELEMENT::PANEL].textColor,textPos.x,textPos.y));
+ Theme->drawElement(hdc, &rect, sbTheme::ELEMENT::PANEL);
+ sbSelectColor(hdc, Theme->fadeColor(Theme->elements[sbTheme::ELEMENT::PANEL].textColor,textPos.x,textPos.y));
sbDrawText(hdc, textPos.x, textPos.y, text, _tcslen(text));
}
break;
@@ -227,7 +227,7 @@
case TYPE_CAN_SWITCH_LEFT:
case TYPE_CAN_SWITCH_RIGHT:
{
- sbSelectColor ( hdc, Core->getTheme()->fadeColor(Core->getTheme()->ItemSubTextColor,textPos.x,textPos.y));
+ sbSelectColor ( hdc, Theme->fadeColor(Theme->ItemSubTextColor,textPos.x,textPos.y));
sbDrawText ( hdc, textPos.x, textPos.y, text, _tcslen(text));
}
break;
@@ -235,21 +235,21 @@
default:
if (isMenu())
{
- sbAssert(Core->fadeSurface != true);
+ sbAssert(Theme->fadeSurface != true);
- Core->fadeSurface = false;
+ Theme->fadeSurface = false;
for (int i=0; i < childrens.size(); i++) childrens[i]->onPaint( hdc );
- sbSelectColor(hdc, Core->getTheme()->ItemMenuTextColor);
+ sbSelectColor(hdc, Theme->ItemMenuTextColor);
sbDrawText(hdc, textPos.x, textPos.y, text, _tcslen(text));
- Core->fadeSurface = true;
+ Theme->fadeSurface = true;
}
else
{
- Core->getTheme()->drawElement(hdc, &rect, sbTheme::ELEMENT::MENU);
- sbSelectColor(hdc, Core->getTheme()->fadeColor(Core->getTheme()->elements[sbTheme::ELEMENT::MENU].textColor,textPos.x,textPos.y));
+ Theme->drawElement(hdc, &rect, sbTheme::ELEMENT::MENU);
+ sbSelectColor(hdc, Theme->fadeColor(Theme->elements[sbTheme::ELEMENT::MENU].textColor,textPos.x,textPos.y));
sbDrawText(hdc, textPos.x, textPos.y, text, _tcslen(text));
}
}
@@ -321,17 +321,17 @@
const int h = (rect.height())/2;
- if (h < Core->getTheme()->styles[sbTheme::STYLE::BUTTON_SMALL].size)
+ if (h < Theme->styles[sbTheme::STYLE::BUTTON_SMALL].size)
style = sbTheme::STYLE::BUTTON_SMALL;
- //else if (h < Core->getTheme()->styles[sbTheme::STYLE::TEXT].size)
+ //else if (h < Theme->styles[sbTheme::STYLE::TEXT].size)
// style = sbTheme::STYLE::TEXT;
- else if (h < Core->getTheme()->styles[sbTheme::STYLE::BUTTON].size)
+ else if (h < Theme->styles[sbTheme::STYLE::BUTTON].size)
style = sbTheme::STYLE::BUTTON;
else
style = sbTheme::STYLE::CAPTION;
- //SelectObject ( hdc, Core->getTheme()->styles[style].font );
- sz = sbGetTextExtent ( Core->getTheme()->styles[style].font, text, _tcslen(text) );
+ //SelectObject ( hdc, Theme->styles[style].font );
+ sz = sbGetTextExtent ( Theme->styles[style].font, text, _tcslen(text) );
textPos.x = (rect.width() - sz.x) / 2 + rect.left;
textPos.y = (rect.height() - sz.y) / 2 + rect.top;
Modified: trunk/src/SlideBible/sbCore.cpp
===================================================================
--- trunk/src/SlideBible/sbCore.cpp 2010-05-24 19:44:18 UTC (rev 235)
+++ trunk/src/SlideBible/sbCore.cpp 2010-06-02 18:27:43 UTC (rev 236)
@@ -53,7 +53,6 @@
options = NULL;
swordMgr = NULL;
- fadeSurface = false;
bScrollTimer = false;
swordMgr = NULL;
@@ -77,9 +76,9 @@
versesMax = atoi((*options)["Ui"].getWithDefault("versesMax", "500"));
versesOptimal = atoi((*options)["Ui"].getWithDefault("versesOptimal", "50"));
- showFps = (bool)atoi((*options)["Ui"].getWithDefault("showFps", "0"));
+ showFps = atoi((*options)["Ui"].getWithDefault("showFps", "0")) == 0 ? false : true;
- stretchSurface = (bool)atoi((*options)["Ui"].getWithDefault("stretchSurface", "0"));
+ stretchSurface = atoi((*options)["Ui"].getWithDefault("stretchSurface", "0")) == 0 ? false : true;
stretchVertical = atof((*options)["Ui"].getWithDefault("stretchVertical", "1.0"));
stretchHorizontal = atof((*options)["Ui"].getWithDefault("stretchHorizontal", "1.0"));
@@ -92,8 +91,8 @@
rClient.right = rClient.width() * stretchHorizontal + rClient.left;
}
- theme.init();
-
+ Theme = new sbTheme (rClient);
+
drawSurface = sbSurfaceCreate (rClient.width(), rClient.height());
sbUpdateScreen();
@@ -136,6 +135,8 @@
for (int i=0; i < strings.size(); i++) free((char*)strings[i]);
+ delete Theme;
+
sbMessage ("Shutdown SlideBible Core.\n");
}
@@ -164,7 +165,7 @@
if (lists[currentList]->controlSelected >= 0)
{
- theme.drawFrame(drawSurface,&(lists[currentList]->getControls()->at(lists[currentList]->controlSelected))->getRect());
+ Theme->drawFrame(drawSurface,&(lists[currentList]->getControls()->at(lists[currentList]->controlSelected))->getRect());
}
if (lists[currentList]->needScroll != 0)
@@ -197,13 +198,13 @@
}
else
{
- Core->getTheme()->drawElement(drawSurface, &rClient, sbTheme::ELEMENT::BACKGROUND);
+ Theme->drawElement(drawSurface, &rClient, sbTheme::ELEMENT::BACKGROUND);
}
if (input.tapCounter > 0)
{
sbRect rect (input.start.x-(input.tapCounter*4), input.start.y-(input.tapCounter*4), input.start.x+(input.tapCounter*4), input.start.y+(input.tapCounter*4));
- Core->getTheme()->drawElement(drawSurface, &rect, sbTheme::ELEMENT::TAPPED);
+ Theme->drawElement(drawSurface, &rect, sbTheme::ELEMENT::TAPPED);
}
if (showFps)
@@ -216,19 +217,19 @@
_sntprintf(text,16,L"%i fps",1000/lastDelta);
- sbSelectFont(drawSurface,theme.styles[sbTheme::STYLE::BUTTON_SMALL].font);
- sbSelectColor(drawSurface,theme.ItemSubTextColor);
+ sbSelectFont(drawSurface,Theme->styles[sbTheme::STYLE::BUTTON_SMALL].font);
+ sbSelectColor(drawSurface,Theme->ItemSubTextColor);
sbDrawText(drawSurface, 4, 3, text, _tcslen(text));
}
if (waitMode)
{
- sbPoint s = sbGetTextExtent(theme.styles[sbTheme::STYLE::TEXT].font,waitMessage, _tcslen(waitMessage));
+ sbPoint s = sbGetTextExtent(Theme->styles[sbTheme::STYLE::TEXT].font,waitMessage, _tcslen(waitMessage));
s.x = (rClient.width()-s.x)/2;
- s.y = rClient.height()-theme.PanelSize-(s.y*1.5f);
+ s.y = rClient.height()-Theme->PanelSize-(s.y*1.5f);
- sbSelectFont(drawSurface,theme.styles[sbTheme::STYLE::TEXT].font);
- sbSelectColor(drawSurface, Core->getTheme()->fadeColor(Core->getTheme()->ItemSubTextColor, s.x, s.y));
+ sbSelectFont(drawSurface,Theme->styles[sbTheme::STYLE::TEXT].font);
+ sbSelectColor(drawSurface, Theme->fadeColor(Theme->ItemSubTextColor, s.x, s.y));
sbDrawText(drawSurface, s.x, s.y, waitMessage, _tcslen(waitMessage));
}
@@ -279,7 +280,7 @@
{
if (!input.mousePressed) return;
- const int max = theme.size / 20;
+ const int max = Theme->size / 20;
int dx = x - input.last.x;
int dy = y - input.last.y;
@@ -337,10 +338,10 @@
float speed = (input.scrollDataY[1]-input.scrollDataY[0])/(float)max((input.scrollDataTicks[1]-input.scrollDataTicks[0]),120);
- cineticPower = (speed*50.0f) + (cineticPower*min(fabs(speed)*200.0f/Core->getTheme()->size,1.0f));
+ cineticPower = (speed*50.0f) + (cineticPower*min(fabs(speed)*200.0f/Theme->size,1.0f));
- sbMessage ("Ticks %i\t Y %i\t cineticPower %f\n", input.scrollDataTicks[0], input.scrollDataY[0], cineticPower);
- sbMessage ("Ticks %i\t Y %i\t Duration %i\t Speed %f\n", input.scrollDataTicks[1], input.scrollDataY[1],input.scrollDataTicks[1]-input.scrollDataTicks[0],speed);
+ //sbMessage ("Ticks %i\t Y %i\t cineticPower %f\n", input.scrollDataTicks[0], input.scrollDataY[0], cineticPower);
+ //sbMessage ("Ticks %i\t Y %i\t Duration %i\t Speed %f\n", input.scrollDataTicks[1], input.scrollDataY[1],input.scrollDataTicks[1]-input.scrollDataTicks[0],speed);
sbKillTimer ( TIMER_TAP );
@@ -598,16 +599,14 @@
void sbCore::controlPressed ( sbControl::TYPE type ) // REMOVE
{
- switch ( type )
- {
- default:
- if (!lists[currentList]->onControl(type)) sbAssert(true);
- }
+ if (!lists[currentList]->onControl(type))
+ sbAssert(true);
}
void sbCore::onChar ( TCHAR character )
{
- if ( lists[currentList] != NULL ) lists[currentList]->onChar( character );
+ if ( lists[currentList] != NULL )
+ lists[currentList]->onChar( character );
}
void sbCore::onKey ( int key , bool down )
Modified: trunk/src/SlideBible/sbCore.h
===================================================================
--- trunk/src/SlideBible/sbCore.h 2010-05-24 19:44:18 UTC (rev 235)
+++ trunk/src/SlideBible/sbCore.h 2010-06-02 18:27:43 UTC (rev 236)
@@ -68,7 +68,6 @@
void redraw ();
- const sbTheme * getTheme () {return &theme;}
sword::SWMgr * getSword () {return swordMgr;}
sword::SWConfig * getOptions () {return options;}
const INPUT * getInput () {return &input;}
@@ -106,8 +105,6 @@
bool redrawTimerOn;
bool bScrollTimer;
-
- sbTheme theme;
sbRect rClient;
@@ -135,7 +132,7 @@
sbFeatures features;
- bool fadeSurface;
+ //bool fadeSurface;
unsigned int scrollStep;
unsigned int versesMax;
Modified: trunk/src/SlideBible/sbFeatures.cpp
===================================================================
--- trunk/src/SlideBible/sbFeatures.cpp 2010-05-24 19:44:18 UTC (rev 235)
+++ trunk/src/SlideBible/sbFeatures.cpp 2010-06-02 18:27:43 UTC (rev 236)
@@ -98,8 +98,8 @@
_ltoa(history[i].placeStart,buf,10); n.addAttribute("placeStart",buf);
_ltoa(history[i].placeEnd,buf,10); n.addAttribute("placeEnd",buf);
- _ltoa(history[i].visitStart,buf,10); n.addAttribute("visitStart",buf);
- _ltoa(history[i].visitEnd,buf,10); n.addAttribute("visitEnd",buf);
+ _ltoa((long)history[i].visitStart,buf,10); n.addAttribute("visitStart",buf);
+ _ltoa((long)history[i].visitEnd,buf,10); n.addAttribute("visitEnd",buf);
n.addAttribute("module",history[i].module);
}
Modified: trunk/src/SlideBible/sbItem.cpp
===================================================================
--- trunk/src/SlideBible/sbItem.cpp 2010-05-24 19:44:18 UTC (rev 235)
+++ trunk/src/SlideBible/sbItem.cpp 2010-06-02 18:27:43 UTC (rev 236)
@@ -13,12 +13,12 @@
* General Public License for more details.
************************************************************************/
-#include "sbCore.h"
+#include "sbTheme.h"
#include "sbItem.h"
#pragma warning(disable : 4018) // signed/unsigned mismatch
-sbItem::sbItem ( sbItem::TYPE _type_, const TCHAR *_text_, int _width_, long _index_, int _number_ )
+sbItem::sbItem ( sbItem::TYPE _type_, const TCHAR *_text_, int _width_, long _index_)
: type ( _type_ )
, width ( _width_ )
, index ( _index_ )
@@ -26,93 +26,15 @@
, prev (NULL)
, left (NULL)
, right (NULL)
-{
- if ( _number_ != -1 )
- {
- switch ( type )
- {
- case sbItem::TYPE_VERSE:
- {
- TCHAR number [10];
- _itot(_number_, number, 10);
- subtext = number;
- }
- break;
- default:
- sbAssert(true);
- }
- }
-
- center = false;
-
- switch ( type )
- {
- case TYPE_CENTRED_DESCRIPTION:
- center = true;
- style = sbTheme::STYLE::DESCRIPTION;
- lines.reserve(1);
- break;
-
- case TYPE_DESCRIPTION:
- case TYPE_BUTTON_CHAPTER_NEXT:
- case TYPE_BUTTON_CHAPTER_PREV:
- style = sbTheme::STYLE::DESCRIPTION;
- lines.reserve(1);
- break;
-
- case TYPE_CHECKBOX:
- center = true;
-
- case TYPE_MODULE_INSTALLER_MODULE:
- case TYPE_MODULE_INSTALLER_UPDATE:
- case TYPE_SEARCH_RANGE_START:
- case TYPE_SEARCH_RANGE_END:
- style = sbTheme::STYLE::BUTTON;
- break;
-
- case TYPE_BUTTON_BOOKMARK:
- case TYPE_BUTTON_SELECTION_BOOK:
- case TYPE_BUTTON_SELECTION_CHAPTER:
- case TYPE_BUTTON_SELECTION_MODULE:
- case TYPE_SWITCH_MODULE_OPTION:
- case TYPE_OPEN_MODULE_INSTALLER:
- case TYPE_START_SEARCH:
- case TYPE_TEXT_FIELD:
- style = sbTheme::STYLE::BUTTON;
- lines.reserve(2);
- center = true;
- break;
-
- case TYPE_BUTTON_BOOKMARK_SMALL:
- style = sbTheme::STYLE::BUTTON_SMALL;
- lines.reserve(2);
- center = true;
- break;
-
- case TYPE_HEADER:
- case TYPE_MODULE_INSTALLER_REPO:
- style = sbTheme::STYLE::CAPTION;
- center = true;
- lines.reserve(1);
- break;
-
- case TYPE_GOTO_MODULES:
- case TYPE_GO_HISTORY:
- style = sbTheme::STYLE::TEXT;
- center = true;
- break;
-
- default:
- style = sbTheme::STYLE::TEXT;
- }
-
+{
+ style = sbTheme::STYLE::TEXT;
highlighted = false;
- height = Core->getTheme()->styles[style].size + Core->getTheme()->itemMargins.top + Core->getTheme()->itemMargins.bottom;
+ height = Theme->styles[style].size + Theme->itemMargins.top + Theme->itemMargins.bottom;
expanding = 0;
processed = false;
- if ( _text_ != NULL ) setText ( _text_ );
+ setText ( _text_ );
}
sbItem::~sbItem()
@@ -122,9 +44,11 @@
if (right != NULL) delete right;
}
-void sbItem::attach (sbItem *item, PIN to)
+void sbItem::attach (sbItem * item, sbDirection to)
{
- if (to == NEXT)
+ sbAssert (this == item);
+
+ if (to == DIRECTION_NEXT)
{
// check space
@@ -142,7 +66,7 @@
item->prev = this;
}
}
- else if (to == PREV)
+ else if (to == DIRECTION_PREV)
{
if (prev != NULL)
{
@@ -158,14 +82,14 @@
item->next = this;
}
}
- else if (to == LEFT)
+ else if (to == DIRECTION_LEFT)
{
sbAssert(left != NULL);
left = item;
item->right = this;
}
- else if (to == RIGHT)
+ else if (to == DIRECTION_RIGHT)
{
sbAssert(right != NULL);
@@ -195,53 +119,66 @@
}
}
-void sbItem::setText ( const TCHAR * _text_ )
+void sbItem::setText ( const TCHAR * newText )
{
- sbPoint sz;
- int lineWidth = 0, length = _tcslen( _text_ );
- bool skip = false, italic = false;
- sbFont font = Core->getTheme()->styles[style].font;
-
- bool manualLines = false;
-
- char changeStyle = style;
-
- LINE currentLine;
-
- currentLine.style = style;
- currentLine.pos = 0;
- currentLine.count = 0;
- currentLine.width = 0;
- currentLine.height = 0; // only last line, with ending = true, contains most large height
- currentLine.ending = false; // last text part in line
-
- // TODO: std::vector<int[3]> (start line position, end line position, begin of <w> tag)
+ int lineWidth = 0 , textWidth = width - Theme->itemMargins.left - Theme->itemMargins.right;
+ int length = _tcslen( newText );
+ int minHeight = 0;
+ bool skip = false;
+ bool alignCenter = false, alignRight = false; // align works before next formating tag, <s a="r"/>
+ bool manualLines = false;
+ sbFont font;
+ LINE currentLine;
std::vector<LINE> underline;
- sbAssert( _text_ == NULL );
+ sbAssert( newText == NULL );
- if (!lines.empty())
- lines.clear();
+ if (!lines.empty()) lines.clear();
- text = _text_;
+ text = newText;
switch (type)
{
- case TYPE_BANNER:
+ case LOOK_BANNER:
case TYPE_HISTORY:
- case TYPE_SEARCH_RANGE_START:
- case TYPE_SEARCH_RANGE_END:
+ case DO_SEARCH_RANGE_START:
+ case DO_SEARCH_RANGE_END:
manualLines = true;
break;
+ case LOOK_SEPARATOR:
+ style = sbTheme::STYLE::DESCRIPTION;
+ alignCenter = true;
+ break;
+ case TYPE_TEXT_FIELD:
+ style = sbTheme::STYLE::BUTTON;
+ minHeight = Theme->styles[style].size + Theme->itemMargins.top + Theme->itemMargins.bottom;
+ break;
+ case TYPE_BUTTON_SELECTION_MODULE:
+ case TYPE_BUTTON_SELECTION_BOOK:
+ case TYPE_BUTTON_SELECTION_CHAPTER:
+ case TYPE_SWITCH_MODULE_OPTION:
+ case TYPE_START_SEARCH:
+ minHeight = Theme->size/6;
+ break;
+ case TYPE_BOOKMARK_VERSE_NUMBER:
+ textWidth = width;
+ break;
}
+ font = Theme->styles[style].font;
+ currentLine.style = style;
+
+ if (manualLines) textWidth = 1000000;
+
+ // TODO use 'const TCHAR *' instead 'i', but for LINE::pos i use displacement
// parse text
- for(int i=0; i<length; i++)
+ for(int i = 0; i<length; i++)
{
- TCHAR c = *(_text_+i);
+ const TCHAR * c = newText+i;
+ bool endLine = i == length - 1;
// process xml tags here
- if (c == L'<')
+ if (*c == L'<')
{
if (currentLine.count > 0)
{
@@ -253,18 +190,60 @@
// and begin new
skip = true;
- if (_tcsncmp(_text_+i+1,L"transChange type=\"added\"",24) == 0)
+ if (_tcsncmp(newText+i+1,L"verse ",6) == 0) // <verse osisID="1John.5.7">
{
- //italic = true;
+ i += 5;
+
+ int state = 0;
+
+ for (int ii = i+1; ii < length && newText[ii] != L'>'; i = ii++)
+ {
+ if (state == 3 && newText[ii] != L'\"')
+ {
+ if (currentLine.count == 0)
+ {
+ currentLine.pos = ii;
+ currentLine.type = LINE::TYPE_VERSE_NUMBER;
+ currentLine.style = sbTheme::STYLE::STANZA;
+ }
+
+ sbPoint sz = sbGetTextExtent(Theme->styles[currentLine.style].font,c,1);
+
+ if (sz.y > currentLine.height)
+ currentLine.height = (unsigned short) sz.y;
+
+ currentLine.width += (unsigned short) sz.x;
+ //lineWidth += (unsigned short) sz.x;
+ currentLine.count++;
+ }
+ else if (_tcsncmp(newText+ii,L"osisID=\"",8) == 0)
+ {
+ ii += 8;
+ state = 1;
+ }
+ else if ((newText[ii] == L'.' || newText[ii] == L'\"') && state > 0)
+ {
+ state++;
+ }
+ }
+
+ lines.push_back(currentLine);
+ currentLine = LINE(); currentLine.style = style;
+ }
+ else if (_tcsncmp(newText+i+1,L"transChange type=\"added\"",24) == 0)
+ {
+ i += 23;
currentLine.style = sbTheme::STYLE::TEXT_ITALIC;
}
- else if (_tcsncmp(_text_+i+1,L"/transChange",12) == 0)
+ else if (_tcsncmp(newText+i+1,L"/transChange",12) == 0)
{
- // TODO push from stack
+ i += 11;
currentLine.style = style;
}
- else if (_tcsncmp(_text_+i+1,L"w ",2) == 0)
+ else if (_tcsncmp(newText+i+1,L"w ",2) == 0)
{
+ i += 2;
+
if ( underline.size() == 0 && lineWidth > 0)
{
underline.push_back(LINE());
@@ -285,80 +264,80 @@
bool lemma = false;
bool morph = false;
- for (int ii = i+3; ii < length && _text_[ii] != L'>'; ii++)
+ for (int ii = i+1; ii < length && newText[ii] != L'>'; i = ii++)
{
- if (_tcsncmp(_text_+ii,L"lemma=\"",7) == 0)
+ if (_tcsncmp(newText+ii,L"lemma=\"",7) == 0)
{
ii += 7;
lemma = true;
}
- else if (_tcsncmp(_text_+ii,L"morph=\"",7) == 0)
+ else if (_tcsncmp(newText+ii,L"morph=\"",7) == 0)
{
ii += 7;
morph = true;
}
- if (_tcsncmp(_text_+ii,L"strong:",7) == 0)
+ if (_tcsncmp(newText+ii,L"strong:",7) == 0)
{
sbAssert(!lemma);
ii += 7;
for (int e = ii;;e++)
{
- if (_text_[e] == L' ' || _text_[e] == L'\"')
+ if (newText[e] == L' ' || newText[e] == L'\"')
{
underline.push_back(LINE());
underline.back().pos = ii;
- underline.back().type = LINE::STRONG;
+ underline.back().type = LINE::TYPE_STRONG;
underline.back().count = e-ii;
- underline.back().height = Core->getTheme()->styles[sbTheme::STYLE::TEXT_UNDER].size;
+ underline.back().height = Theme->styles[sbTheme::STYLE::TEXT_UNDER].size;
underline.back().style = sbTheme::STYLE::TEXT_UNDER;
- underline.back().width = sbGetTextExtent(Core->getTheme()->styles[sbTheme::STYLE::TEXT_UNDER].font,_text_+ii,e-ii).x;
- underline.back().width += sbGetTextExtent(Core->getTheme()->styles[sbTheme::STYLE::TEXT_UNDER].font,L" ",1).x;
+ underline.back().width = sbGetTextExtent(Theme->styles[sbTheme::STYLE::TEXT_UNDER].font,newText+ii,e-ii).x;
+ underline.back().width += sbGetTextExtent(Theme->styles[sbTheme::STYLE::TEXT_UNDER].font,L" ",1).x;
ii = e;
break;
}
}
}
- else if (_tcsncmp(_text_+ii,L"strongMorph:",12) == 0)
+ else if (_tcsncmp(newText+ii,L"strongMorph:",12) == 0)
{
sbAssert(!morph);
ii += 12;
for (int e = ii;;e++)
{
- if (_text_[e] == L' ' || _text_[e] == L'\"')
+ if (newText[e] == L' ' || newText[e] == L'\"')
{
underline.push_back(LINE());
underline.back().pos = ii;
- underline.back().type = LINE::MORPH;
+ underline.back().type = LINE::TYPE_MORPH;
underline.back().count = e-ii;
- underline.back().height = Core->getTheme()->styles[sbTheme::STYLE::TEXT_UNDER].size;
+ underline.back().height = Theme->styles[sbTheme::STYLE::TEXT_UNDER].size;
underline.back().style = sbTheme::STYLE::TEXT_UNDER;
- underline.back().width = sbGetTextExtent(Core->getTheme()->styles[sbTheme::STYLE::TEXT_UNDER].font,_text_+ii,e-ii).x;
- underline.back().width += sbGetTextExtent(Core->getTheme()->styles[sbTheme::STYLE::TEXT_UNDER].font,L" ",1).x;
+ underline.back().width = sbGetTextExtent(Theme->styles[sbTheme::STYLE::TEXT_UNDER].font,newText+ii,e-ii).x;
+ underline.back().width += sbGetTextExtent(Theme->styles[sbTheme::STYLE::TEXT_UNDER].font,L" ",1).x;
ii = e;
break;
}
}
}
- else if (_tcsncmp(_text_+ii,L"robinson:",9) == 0)
+ else if (_tcsncmp(newText+ii,L"robinson:",9) == 0)
{
sbAssert(!morph);
ii += 9;
for (int e = ii;;e++)
{
- if (_text_[e] == L' ' || _text_[e] == L'\"')
+ if (newText[e] == L' ' || newText[e] == L'\"')
{
underline.push_back(LINE());
underline.back().pos = ii;
- underline.back().type = LINE::MORPH;
+ underline.back().type = LINE::TYPE_MORPH;
underline.back().count = e-ii;
- underline.back().height = Core->getTheme()->styles[sbTheme::STYLE::TEXT_UNDER].size;
+ underline.back().height = Theme->styles[sbTheme::STYLE::TEXT_UNDER].size;
underline.back().style = sbTheme::STYLE::TEXT_UNDER;
- underline.back().width = sbGetTextExtent(Core->getTheme()->styles[sbTheme::STYLE::TEXT_UNDER].font,_text_+ii,e-ii).x;
- underline.back().width += sbGetTextExtent(Core->getTheme()->styles[sbTheme::STYLE::TEXT_UNDER].font,L" ",1).x;
+ underline.back().width = sbGetTextExtent(Theme->styles[sbTheme::STYLE::TEXT_UNDER].font,newText+ii,e-ii).x;
+ underline.back().width += sbGetTextExtent(Theme->styles[sbTheme::STYLE::TEXT_UNDER].font,L" ",1).x;
ii = e;
break;
@@ -367,218 +346,304 @@
}
}
}
- else if (_tcsncmp(_text_+i+1,L"s ",2) == 0)
+ else if (_tcsncmp(newText+i+1,L"s ",2) == 0)
{
- for (int ii = i+2; ii < length && _text_[ii] != L'>'; ii++)
+ i += 1;
+
+ for (int ii = i+1; ii < length && newText[ii] != L'>'; i = ii++)
{
- if (_tcsncmp(_text_+ii,L" t=",3) == 0)
+ if (_tcsncmp(newText+ii,L" t=",3) == 0)
{
- if (_tcsncmp(_text_+ii+3,L"\"6\"",3) == 0) currentLine.style = sbTheme::STYLE::DESCRIPTION;
- else if (_tcsncmp(_text_+ii+3,L"\"5\"",3) == 0) currentLine.style = sbTheme::STYLE::CAPTION;
- else if (_tcsncmp(_text_+ii+3,L"\"4\"",3) == 0) currentLine.style = sbTheme::STYLE::STANZA;
- else if (_tcsncmp(_text_+ii+3,L"\"1\"",3) == 0) currentLine.style = sbTheme::STYLE::TEXT_ITALIC;
+ if (_tcsncmp(newText+ii+3,L"\"6\"",3) == 0) currentLine.style = sbTheme::STYLE::DESCRIPTION;
+ else if (_tcsncmp(newText+ii+3,L"\"5\"",3) == 0) currentLine.style = sbTheme::STYLE::CAPTION;
+ else if (_tcsncmp(newText+ii+3,L"\"4\"",3) == 0) currentLine.style = sbTheme::STYLE::STANZA;
+ else if (_tcsncmp(newText+ii+3,L"\"3\"",3) == 0) currentLine.style = sbTheme::STYLE::BUTTON;
+ else if (_tcsncmp(newText+ii+3,L"\"1\"",3) == 0) currentLine.style = sbTheme::STYLE::TEXT_ITALIC;
else sbAssert (true);
- ii += 6;
+ ii += 5;
}
+ else if (_tcsncmp(newText+ii,L" a=",3) == 0)
+ {
+ if (_tcsncmp(newText+ii+3,L"\"c\"",3) == 0) { alignCenter = true; alignRight = false; }
+ else if (_tcsncmp(newText+ii+3,L"\"r\"",3) == 0) { alignCenter = false; alignRight = true; }
+ else if (_tcsncmp(newText+ii+3,L"\"l\"",3) == 0) { alignCenter = false; alignRight = false; }
+ else sbAssert (true);
+
+ ii += 5;
+ }
}
}
- else if (_tcsncmp(_text_+i+1,L"/s>",3) == 0)
+ else if (_tcsncmp(newText+i+1,L"/s>",3) == 0)
{
- // TODO push from stack
+ i += 2;
currentLine.style = style;
- currentLine.type = LINE::TYPE::NONE;
+ currentLine.type = LINE::TYPE_NONE;
}
}
- else if (skip && c == L'>')
+ else if (*c == L'>')
{
+ sbAssert (!skip);
skip = false;
}
- else if (c == L'\n')
+ else if (*c == L'\n')
{
- lineWidth = 0;
-
- lines.push_back(currentLine);
- lines.back().ending = true;
-
- // finish line, sync code
- if (underline.size())
- {
- for (int i = 0; i < underline.size(); i++) lines.push_back(underline[i]);
- underline.clear();
- lines.back().ending = true;
- }
-
- currentLine.count = currentLine.width = currentLine.height = 0;
+ endLine = true;
}
+ else if (*c == L'\t' && currentLine.count == 0) // fix \t\t<verse ...
+ {
+ currentLine.pos = i;
+ }
else if (!skip)
{
+ sbPoint sz = sbGetTextExtent(Theme->styles[currentLine.style].font,c,1);
+
// add character
- sz = sbGetTextExtent(Core->getTheme()->styles[currentLine.style].font,&c,1);
+ if (currentLine.count == 0) currentLine.pos = i;
- if (currentLine.count == 0)
+ if (sz.y > currentLine.height)
+ currentLine.height = (unsigned short) sz.y;
+
+ currentLine.width += (unsigned short) sz.x;
+ lineWidth += (unsigned short) sz.x;
+ currentLine.count++;
+
+ // check line break at space
+ if (*c == L' ' && lineWidth + (textWidth/4) > textWidth)
{
- if (c == L'\t') continue;
+ // forward processing
+ for (int ii = 1, skipped = 0, width = 0; i+ii < length && ii < 16; ii++)
+ {
+ const TCHAR * nc = newText+i+ii+skipped;
- currentLine.pos = i;
+ if (*nc == L'<')
+ {
+ for (;*(newText+i+ii+skipped) != L'>'; skipped++) ;
+ continue;
+ }
+
+ if (_tcschr(L" \n",*nc) != NULL) break;
+
+ if (lineWidth + width >= textWidth)
+ {
+ endLine = true;
+ break;
+ }
+
+ width += sbGetTextExtent(Theme->styles[currentLine.style].font,nc,1).x;
+ }
}
-
- // TODO determine is last symbol, next symbol must be one of "\n <"
- // TODO break lines if sz.x + lineWidth >= width-Core->getTheme()->itemMargins.left
- // line will be too long, divide lines
- if ((lineWidth + sz.x > width-Core->getTheme()->itemMargins.left-Core->getTheme()->itemMargins.right) \
- && c != L'.' && c != L',' && c != L' ' && c != L'!' && c != L'?' && c != L';' && c != L':' && !manualLines)
+ if (!endLine)
{
- lines.push_back(currentLine);
- lines.back().ending = true;
+ // ask next character
+ const TCHAR * nc = c+1;
- // finish line, sync code
- if (underline.size())
+ while (*nc == L'<')
{
- for (int i = 0; i < underline.size(); i++) lines.push_back(underline[i]);
- underline.clear();
- lines.back().ending = true;
+ while (*nc != L'>' && *nc != L'\0') nc++;
+ nc++;
}
- lineWidth = 0;
+ if (lineWidth >= textWidth && !manualLines && _tcschr(L"., !?;:»)",*nc) == NULL)
+ endLine = true;
+ }
+
+ }
- currentLine.count = currentLine.width = currentLine.height = 0;
+ // now process line end only here
+ if (endLine)
+ {
+ if (alignRight || alignCenter)
+ {
+ LINE l; l.width = max(0,(textWidth-lineWidth)/(alignRight ? 1 : 2)); l.type = LINE::TYPE_SPACE;
+
+ if (l.width > 0)
+ {
+ std::vector<LINE>::reverse_iterator it = lines.rbegin();
+ while (it != lines.rend() && !(*it).ending) ++it;
+ lines.insert(it.base(),l);
+
+ // TODO work with underline, if necessary
+ }
}
- if (currentLine.count == 0) currentLine.pos = i;
+ // TODO compensate at space a very short lines somehow
- currentLine.width += (unsigned short) sz.x;
-
- if (sz.y > currentLine.height)
+ if (currentLine.count > 0)
{
- sbAssert ((sz.y >= Core->getTheme()->size/8) && (type == TYPE_VERSE));
- currentLine.height = (unsigned short) sz.y;
+ lines.push_back(currentLine);
+ lines.back().ending = true;
}
-
- currentLine.count++;
+ else if (lines.size() > 0)
+ {
+ lines.back().ending = true;
+ }
- lineWidth += (unsigned short) sz.x;
+ if (underline.size())
+ {
+ for (int i = 0; i < underline.size(); i++) lines.push_back(underline[i]);
+ underline.clear();
+ lines.back().ending = true;
+ }
+
+ lineWidth = 0;
+
+ currentLine.count = currentLine.width = currentLine.height = 0;
}
-
- // TODO: process end of line here
}
- if (currentLine.count > 0)
+ // calculate height
+ if (type == sbItem::TYPE_HISTORY)
{
- lines.push_back(currentLine);
- lines.back().ending = true;
+ height = Theme->itemMargins.top + Theme->itemMargins.bottom;
+ height += max (Theme->styles[sbTheme::STYLE::CAPTION].size,Theme->styles[sbTheme::STYLE::TEXT].size+Theme->styles[sbTheme::STYLE::DESCRIPTION].size);
}
- else if (lines.size() > 0)
+ else if (type == LOOK_BANNER && lines.size() == 2)
{
- lines.back().ending = true;
+ height = (Theme->BannerBorderSize * 2) + Theme->styles[lines[0].style].size + Theme->styles[lines[1].style].size;
}
+ else if (type == DO_SEARCH_RANGE_START || type == DO_SEARCH_RANGE_END)
+ {
+ height = Theme->itemMargins.top + Theme->itemMargins.bottom + lines[0].height;
+ width = Theme->itemMargins.left + Theme->itemMargins.left + lines[0].width;
+ }
+ else
+ {
+ height = Theme->itemMargins.top + Theme->itemMargins.bottom;
- // finish line, sync code
- if (underline.size())
+ //if (type == TYPE_TEXT_FIELD && lines.size() == 0) height += Theme->styles[style].size;
+
+ for (int i=0; i<lines.size(); i++) if (lines[i].ending) height += lines[i].height;
+ }
+
+ if (minHeight && height < minHeight)
{
- for (int i = 0; i < underline.size(); i++) lines.push_back(underline[i]);
- underline.clear();
- lines.back().ending = true;
+ LINE l; l.style = style; l.ending = true; l.height = (minHeight-height)/2;
+ lines.insert(lines.begin(),l);
+ height = minHeight;
}
+}
- if (type == sbItem::TYPE_HISTORY)
+void sbItem::render ( sbSurface surface, const sbRect & rect ) const
+{
+ if (type == LOOK_BANNER)
{
- height = Core->getTheme()->itemMargins.top + Core->getTheme()->itemMargins.bottom;
- height += max (Core->getTheme()->styles[sbTheme::STYLE::CAPTION].size,Core->getTheme()->styles[sbTheme::STYLE::TEXT].size+Core->getTheme()->styles[sbTheme::STYLE::DESCRIPTION].size);
+ sbAssert (lines.size() != 2);
+
+ Theme->drawElement( surface, &rect, sbTheme::ELEMENT::BANNER );
+
+ sbSelectColor(surface, Theme->fadeColor(Theme->elements[sbTheme::ELEMENT::BANNER].textColor,rect.left,rect.top));
+
+ sbSelectFont (surface, Theme->styles[lines[0].style].font);
+ sbDrawText (surface, rect.left + Theme->BannerBorderSize, rect.top + Theme->BannerBorderSize, text.c_str() + lines[0].pos, lines[0].count);
+
+ sbSelectFont (surface, Theme->styles[lines[1].style].font);
+ sbDrawText (surface, rect.left + Theme->BannerBorderSize, rect.top + Theme->BannerBorderSize + lines[0].height, text.c_str() + lines[1].pos, lines[1].count);
}
- else if (type == TYPE_BANNER && lines.size() == 2)
+ else if (type == TYPE_HISTORY)
{
- height = (Core->getTheme()->BannerBorderSize * 2) + Core->getTheme()->styles[lines[0].style].size + Core->getTheme()->styles[lines[1].style].size;
+ sbAssert (lines.size() != 3);
+
+ Theme->drawElement( surface, &rect, sbTheme::ELEMENT::ITEM );
+
+ sbSelectFont (surface, Theme->styles[lines[0].style].font);
+ sbSelectColor(surface, Theme->fadeColor(Theme->elements[sbTheme::ELEMENT::ITEM].textColor,rect.left,rect.top));
+ sbDrawText (surface, rect.left + Theme->itemMargins.left, rect.top + Theme->itemMargins.top, text.c_str() + lines[0].pos, lines[0].count);
+
+ sbSelectFont (surface, Theme->styles[lines[1].style].font);
+ sbDrawText (surface, rect.right - Theme->itemMargins.right - lines[1].width, rect.top + Theme->itemMargins.top, text.c_str() + lines[1].pos, lines[1].count);
+
+ sbSelectFont (surface, Theme->styles[lines[2].style].font);
+ sbDrawText (surface, rect.left + Theme->itemMargins.left, rect.top + Theme->itemMargins.top + lines[0].height, text.c_str() + lines[2].pos, lines[2].count);
}
- else if (type == TYPE_SEARCH_RANGE_START || type == TYPE_SEARCH_RANGE_END)
+ else if (type > LOOK_BUTTON && type < LOOK_BUTTON_COUNT)
{
- height = Core->getTheme()->itemMargins.top + Core->getTheme()->itemMargins.bottom + lines[0].height;
- width = Core->getTheme()->itemMargins.left + Core->getTheme()->itemMargins.left + lines[0].width;
+ Theme->drawElement( surface, &rect, sbTheme::ELEMENT::PANEL );
- if (height < Core->getTheme()->size/6)
+ for (int i = 0, lx = 0, ly = rect.top + Theme->itemMargins.top; i < lines.size(); i++)
{
- lines.insert(lines.begin(),LINE(style,true,0,((Core->getTheme()->size/6)-height)/2));
- height = Core->getTheme()->size/6;
+ int x = lx + Theme->itemMargins.left + rect.left;
+ int y = ly;
+
+ lines[i].ending ? lx = 0, ly += lines[i].height : lx += lines[i].width;
+
+ if (lines[i].count == 0) continue;
+
+ sbSelectFont(surface, Theme->styles[lines[i].style].font);
+ sbSelectColor (surface, Theme->fadeColor(Theme->elements[sbTheme::ELEMENT::PANEL].textColor,x,y));
+
+ sbDrawText (surface, x, y, text.c_str() + lines[i].pos, lines[i].count);
}
}
- else
+ else if (type == LOOK_SEPARATOR)
{
- height = Core->getTheme()->itemMargins.top + Core->getTheme()->itemMargins.bottom;
+ Theme->drawElement( surface, &rect, sbTheme::ELEMENT::ITEM_SEPARATOR );
- if (type == TYPE_TEXT_FIELD && lines.size() == 0) height += Core->getTheme()->styles[style].size;
-
- for (int i=0; i<lines.size(); i++) if (lines[i].ending) height += lines[i].height;
-
- // hack to make space for buttons
- if ((style == sbTheme::STYLE::BUTTON || style == sbTheme::STYLE::BUTTON_SMALL) && height < Core->getTheme()->size/6)
+ for (int i = 0, lx = 0, ly = rect.top + Theme->itemMargins.top; i < lines.size(); i++)
{
- lines.insert(lines.begin(),LINE(style,true,0,((Core->getTheme()->size/6)-height)/2));
- height = Core->getTheme()->size/6;
- }
- }
-}
+ int x = lx + Theme->itemMargins.left + rect.left;
+ int y = ly;
-void sbItem::render ( sbSurface surface, const sbRect & rect, sbTheme::ELEMENT::TYPE element ) const
-{
- Core->getTheme()->drawElement( surface, &rect, element );
+ lines[i].ending ? lx = 0, ly += lines[i].height : lx += lines[i].width;
- if (type == sbItem::TYPE_BANNER)
- {
- sbAssert (lines.size() != 2);
+ if (lines[i].count == 0) continue;
- sbSelectColor(surface, Core->getTheme()->fadeColor(Core->getTheme()->elements[sbTheme::ELEMENT::BANNER].textColor,rect.left,rect.top));
+ sbSelectFont(surface, Theme->styles[lines[i].style].font);
+ sbSelectColor (surface, Theme->fadeColor(Theme->elements[sbTheme::ELEMENT::ITEM_SEPARATOR].textColor,x,y));
- sbSelectFont (surface, Core->getTheme()->styles[lines[0].style].font);
- sbDrawText (surface, rect.left + Core->getTheme()->BannerBorderSize, rect.top + Core->getTheme()->BannerBorderSize, text.c_str() + lines[0].pos, lines[0].count);
-
- sbSelectFont (surface, Core->getTheme()->styles[lines[1].style].font);
- sbDrawText (surface, rect.left + Core->getTheme()->BannerBorderSize, rect.top + Core->getTheme()->BannerBorderSize + lines[0].height, text.c_str() + lines[1].pos, lines[1].count);
+ sbDrawText (surface, x, y, text.c_str() + lines[i].pos, lines[i].count);
+ }
}
- else if (type == sbItem::TYPE_HISTORY)
+ else if (type > LOOK_PANEL && type < LOOK_PANEL_COUNT)
{
- sbAssert (lines.size() != 3);
+ // TODO multiline panel
+ Theme->drawElement( surface, &rect, sbTheme::ELEMENT::PANEL );
- sbSelectFont (surface, Core->getTheme()->styles[lines[0].style].font);
- sbSelectColor(surface, Core->getTheme()->fadeColor(Core->getTheme()->elements[sbTheme::ELEMENT::ITEM].textColor,rect.left,rect.top));
- sbDrawText (surface, rect.left + Core->getTheme()->itemMargins.left, rect.top + Core->getTheme()->itemMargins.top, text.c_str() + lines[0].pos, lines[0].count);
+ for (int i = 0, lx = 0, ly = rect.top + Theme->itemMargins.top; i < lines.size(); i++)
+ {
+ int x = lx + Theme->itemMargins.left + rect.left;
+ int y = ly;
- sbSelectFont (surface, Core->getTheme()->styles[lines[1].style].font);
- sbDrawText (surface, rect.right - Core->getTheme()->itemMargins.right - lines[1].width, rect.top + Core->getTheme()->itemMargins.top, text.c_str() + lines[1].pos, lines[1].count);
+ if (lines[i].ending)
+ {
+ lx = 0;
+ ly += lines[i].height;
+ }
+ else
+ lx += lines[i].width;
- sbSelectFont (surface, Core->getTheme()->styles[lines[2].style].font);
- sbDrawText (surface, rect.left + Core->getTheme()->itemMargins.left, rect.top + Core->getTheme()->itemMargins.top + lines[0].height, text.c_str() + lines[2].pos, lines[2].count);
+ if (lines[i].count == 0) continue;
+
+ sbSelectFont(surface, Theme->styles[lines[i].style].font);
+ sbSelectColor (surface, Theme->fadeColor(Theme->elements[sbTheme::ELEMENT::PANEL].textColor,x,y));
+
+ sbDrawText (surface, x, y, text.c_str() + lines[i].pos, lines[i].count);
+ }
}
else
{
- if ( text.size() > 0 )
+ Theme->drawElement( surface, &rect, highlighted ? sbTheme::ELEMENT::ITEM_HIGHLIGHTED : sbTheme::ELEMENT::ITEM );
+
+ if ( lines.size() > 0 )
{
- if ( subtext.size() > 0 )
+ int i = 0;
+
+ if ( lines[0].type == LINE::TYPE_VERSE_NUMBER )
{
- sbPoint pos = sbGetTextExtent(Core->getTheme()->styles[sbTheme::STYLE::STANZA].font,subtext.c_str(), subtext.size());
+ sbPoint pos (rect.left+((Theme->itemMargins.left-lines[0].width)/2),rect.top);
- pos.x = rect.left+((Core->getTheme()->itemMargins.left-pos.x)/2);
- pos.y = rect.top;
+ sbSelectFont(surface, Theme->styles[lines[0].style].font);
+ sbSelectColor(surface, Theme->fadeColor(Theme->ItemSubTextColor, pos.x, pos.y));
- sbSelectFont(surface, Core->getTheme()->styles[sbTheme::STYLE::STANZA].font);
- sbSelectColor(surface, Core->getTheme()->fadeColor(Core->getTheme()->ItemSubTextColor, pos.x, pos.y));
-
- sbDrawText(surface, pos.x, pos.y, subtext.c_str(), subtext.size());
+ sbDrawText(surface, pos.x, pos.y, text.c_str()+lines[0].pos, lines[0].count);
+
+ i++;
}
- int lx = 0;
- int ly = rect.top + Core->getTheme()->itemMargins.top;
-
- for (int i=0; i < lines.size(); i++)
+ for (int lx = 0, ly = rect.top + Theme->itemMargins.top; i < lines.size(); i++)
{
- if (center && lx == 0)
- {
- int w = 0;
- for (int ii=i; ii < lines.size(); ii++) if (lines[ii].ending) { w += lines[ii].width; break; } else w += lines[ii].width;
- lx += (rect.width()-Core->getTheme()->itemMargins.left-Core->getTheme()->itemMargins.right - w)/2;
- }
-
- int x = lx + Core->getTheme()->itemMargins.left + rect.left;
+ int x = lx + Theme->itemMargins.left + rect.left;
int y = ly;
if (lines[i].ending)
@@ -591,49 +656,89 @@
if (lines[i].count == 0) continue;
- if (y + Core->getTheme()->styles[lines[i].style].size >= rect.top + height) break; // item expansion
- if (y < -Core->getTheme()->styles[lines[i].style].size) continue; // clip top
- if (y >= rect.bottom) break; // clip bottom
+ if (y + Theme->styles[lines[i].style].size >= rect.top + height) break; // item expansion
+ if (y < -Theme->styles[lines[i].style].size) continue; // clip top
+ if (y >= rect.bottom) break; // clip bottom
- sbSelectFont(surface, Core->getTheme()->styles[lines[i].style].font);
+ sbSelectFont(surface, Theme->styles[lines[i].style].font);
switch (lines[i].type)
{
- case sbItem::LINE::TYPE::NONE:
- sbSelectColor(surface, Core->getTheme()->fadeColor(Core->getTheme()->elements[element].textColor,x,y));
+ case sbItem::LINE::TYPE_NONE:
+ sbSelectColor(surface, Theme->fadeColor(Theme->elements[sbTheme::ELEMENT::ITEM].textColor,x,y));
break;
- case sbItem::LINE::TYPE::STRONG:
- sbSelectColor(surface, Core->getTheme()->fadeColor(Core->getTheme()->ItemStrongColor,x,y));
+ case sbItem::LINE::TYPE_STRONG:
+ sbSelectColor(surface, Theme->fadeColor(Theme->ItemStrongColor,x,y));
break;
- case sbItem::LINE::TYPE::MORPH:
- sbSelectColor(surface, Core->getTheme()->fadeColor(Core->getTheme()->ItemMorphColor,x,y));
+ case sbItem::LINE::TYPE_MORPH:
+ sbSelectColor(surface, Theme->fadeColor(Theme->ItemMorphColor,x,y));
break;
- case sbItem::LINE::TYPE::WORDS_OF_CHRIST:
- sbSelectColor(surface, Core->getTheme()->fadeColor(Core->getTheme()->ItemRedColor,x,y));
+ case sbItem::LINE::TYPE_REDWORDS:
+ sbSelectColor(surface, Theme->fadeColor(Theme->ItemRedColor,x,y));
break;
}
sbDrawText (surface, x, y, text.c_str() + lines[i].pos, lines[i].count);
}
}
- else
- {
- if (subtext.size() > 0)
- {
- sbPoint pos = sbGetTextExtent(Core->getTheme()->styles[sbTheme::STYLE::BUTTON].font, subtext.c_str(), subtext.size());
+ }
+}
- pos.x = rect.left+((rect.width()-pos.x)/2);
- pos.y = rect.top+((rect.height()-pos.y)/2);
+sbItem * sbItem::append ( sbItem::TYPE type, const TCHAR * text, int width, long index )
+{
+ sbItem * n = create (type,text,width,index);
- sbSelectFont(surface, Core->getTheme()->styles[sbTheme::STYLE::BUTTON].font);
- sbSelectColor(surface, Core->getTheme()->fadeColor(Core->getTheme()->ItemSubTextColor,pos.x,pos.y));
+ if (this != NULL)
+ {
+ sbItem * l = getItem(DIRECTION_NEXT,true);
+ l->attach(n,DIRECTION_NEXT);
+ }
+ return n;
+}
- sbDrawText (surface, pos.x, pos.y, subtext.c_str(), subtext.size());
- }
- else if ( type != sbItem::TYPE_SPACE && type != sbItem::TYPE_TEXT_FIELD )
- {
- sbAssert(true);
- }
+sbItem * sbItem::getItem ( TYPE type )
+{
+ sbItem * w = this;
+
+ while (w->prev != NULL) w = w->prev;
+ while (w->type != type && w->next != NULL) w = w->next;
+
+ if (w->type == type)
+ return w;
+ else
+ return NULL;
+}
+
+sbItem * sbItem::getItem( sbDirection direction, bool last /*= false */ )
+{
+ sbItem * i = this;
+
+ switch (direction)
+ {
+ case DIRECTION_NEXT:
+ if (last)
+ {
+ while ( i->left != NULL ) i = i->left;
+ while ( i->next != NULL ) i = i->next;
+ while ( i->right != NULL ) i = i->right;
+
+ return i;
}
+ else
+ {
+ int c = 0;
+ for ( ; i->left != NULL; c++, i = i->left ) ;
+ if ((i = i->next) != NULL) for ( ; c > 0 && i != NULL; c--, i = i->right ) ;
+ return i;
+ }
+ default:
+ sbAssert(true);
}
+
+ return i;
}
+
+sbItem * sbItem::create( TYPE type, const TCHAR * text, int width, long index /*= -1 */ )
+{
+ return new sbItem (type,text,width,index);
+}
\ No newline at end of file
Modified: trunk/src/SlideBible/sbItem.h
===================================================================
--- trunk/src/SlideBible/sbItem.h 2010-05-24 19:44:18 UTC (rev 235)
+++ trunk/src/SlideBible/sbItem.h 2010-06-02 18:27:43 UTC (rev 236)
@@ -52,98 +52,120 @@
next,prev,child
*/
+// Global directions
+enum sbDirection
+{
+ DIRECTION_NONE = 0,
+ DIRECTION_NEXT = 1 << 0,
+ DIRECTION_PREV = 1 << 1,
+ DIRECTION_LEFT = 1 << 2,
+ DIRECTION_RIGHT = 1 << 3,
+ DIRECTION_COUNT
+};
+
class sbItem
{
public:
+ // type responds for visual appearance and work that item do
+ // some types like LOOK_CONTAINER should create derived classes
enum TYPE
{
- TYPE_NONE = 0,
- TYPE_HEADER,
- TYPE_SPACE,
- TYPE_ICON,
- TYPE_TEXT,
- TYPE_DESCRIPTION, // small text
- TYPE_CENTRED_DESCRIPTION,
- TYPE_VERSE, // linked to verse, versification?
- TYPE_TEXT_WITH_DESCRIPTION,
- TYPE_TEXT_FIELD,
- TYPE_CHECKBOX,
- TYPE_SWITCH_MODULE_OPTION,
- TYPE_BUTTON_CHAPTER_NEXT,
- TYPE_BUTTON_CHAPTER_PREV,
- TYPE_BUTTON_SELECTION_MODULE,
- TYPE_BUTTON_SELECTION_BOOK,
- TYPE_BUTTON_SELECTION_CHAPTER,
- TYPE_BUTTON_SELECTION_VERSE,
- TYPE_BUTTON_OPEN_SELECT_MODULE,
- TYPE_BUTTON_OPEN_SELECT_BOOK,
- TYPE_BUTTON_OPEN_SELECT_CHAPTER,
- TYPE_BUTTON_OPEN_SELECT_VERSE,
+ DO_NONE = 0,
+
+ LOOK_NORMAL = 0,
+ TYPE_VERSE,
TYPE_BUTTON_BOOKMARK,
- TYPE_BUTTON_BOOKMARK_SMALL,
- TYPE_BUTTON_BOOKMARK_GO,
- TYPE_BUTTON_BOOKMARK_DELETE,
- TYPE_BUTTON_BOOKMARK_POSITION,
- TYPE_BUTTON_ADD_BOOKMARK,
- TYPE_BUTTON_ADD_FAVORITE,
TYPE_GOTO_MODULES,
TYPE_GO_HISTORY,
TYPE_HISTORY,
- TYPE_OPEN_MODULE_INSTALLER,
- TYPE_MODULE_INSTALLER_REPO,
TYPE_MODULE_INSTALLER_MODULE,
TYPE_MODULE_INSTALLER_UPDATE,
- TYPE_START_SEARCH,
- TYPE_SEARCH_RANGE_START,
- TYPE_SEARCH_RANGE_END,
TYPE_GO_READING,
- TYPE_BANNER
- };
+ TYPE_BUTTON_SELECTION_MODULE,
+ TYPE_BUTTON_SELECTION_BOOK,
+ TYPE_BUTTON_SELECTION_CHAPTER,
+ TYPE_BOOKMARK_VERSE_NUMBER,
+ LOOK_NORMAL_COUNT,
- // Types
- enum LOOK
- {
- LOOK_NONE = 0,
- LOOK_TEXT,
+ LOOK_CONTAINER,
+ TYPE_CONTAINER_PANEL,
+ TYPE_CONTAINER_DIALOG,
+ TYPE_CONTAINER_MENU,
+ LOOK_CONTAINER_COUNT,
+
+ LOOK_VERSE,
+
+ LOOK_SEPARATOR,
+ TYPE_CENTRED_DESCRIPTION,
+
LOOK_DESCRIPTION,
+
LOOK_CAPTION,
- LOOK_CHECK_BUTTON,
- LOOK_INPUT_TEXT,
- LOOK_SEPARATOR,
+
+ LOOK_INPUT,
+ TYPE_TEXT_FIELD,
+
+ LOOK_BUTTON,
+ TYPE_OPEN_MODULE_INSTALLER,
+ TYPE_SWITCH_MODULE_OPTION,
+ TYPE_START_SEARCH,
+ TYPE_MODULE_INSTALLER_REPO,
+ LOOK_BUTTON_COUNT,
+
LOOK_PANEL,
+ DO_EXIT,
+ DO_WIDE_CLOSE,
+ DO_CLOSE,
+ DO_BUTTON_OPEN_FILE,
+ DO_OPEN_NAVIGATION,
+ DO_OPEN_NAVIGATION_LIST,
+ DO_OPEN_MODULE_SELECTION,
+ DO_OPEN_BOOK_SELECTION,
+ DO_OPEN_SEARCH,
+ DO_OPEN_HOME,
+ DO_OPEN_TEXT,
+ DO_OPEN_BOOKMARKS,
+ DO_OPEN_READINGS,
+ DO_OPEN_HISTORY,
+ DO_MODE_ADD_STAR,
+ DO_MENU_CANCEL,
+ DO_MENU_VERSE,
+ DO_OPEN_OPTIONS,
+ DO_INSTALLER_DISCLAIMER_ACCEPT,
+ DO_INSTALLER_DISCLAIMER_DECLINE,
+ LOOK_PANEL_COUNT,
+
LOOK_MENU,
- LOOK_COUNT
- };
+ DO_SEARCH_RANGE_START,
+ DO_SEARCH_RANGE_END,
+ LOOK_MENU_COUNT,
- enum DO
- {
- DO_NONE = 0,
- DO_CHANGE_PLACE,
- DO_CHANGE_VIEW,
- DO_SIP_RAISE,
- DO_COUNT
+ LOOK_BANNER,
+
+ TYPE_COUNT
};
- static sbItem * addText (sbItem * parent, const TCHAR * text);
- static sbItem * add (DO action, LOOK view, const TCHAR * text, sbRect place, long parameter = -1);
-
+ sbRect getRect ( bool familyMode = false );
+ bool putInto ( sbRect toPut );
+
+ sbItem * getItem ( sbDirection direction, bool last = false );
+ sbItem * getItem ( sbPoint relativeXy ); // for container-items
+ sbItem * getItem ( TYPE type );
+
// hide
- sbItem( sbItem::TYPE type, const TCHAR * text, int width, long index = -1, int number = -1 );
- ~sbItem();
+ sbItem ( sbItem::TYPE type, const TCHAR * text, int width, long index = -1 );
+ virtual ~sbItem ();
- /* remove */
- void render ( sbSurface surface, const sbRect & rect, sbTheme::ELEMENT::TYPE element ) const;
+ virtual void render ( sbSurface surface, const sbRect & rect ) const;
const TYPE type;
- char style;
+ char style; // remove
std::wstring text;
- std::wstring subtext;
bool processed;
- bool center;
-
+ // none, highlighted, inactive, hover, hover+highlighted
bool highlighted;
bool active;
@@ -154,16 +176,19 @@
struct LINE
{
- LINE ( char _style_ = 0, bool _newLine_ = false , unsigned short _width_ = 0 ,unsigned short _height_ = 0 , unsigned short _pos_ = 0, unsigned short _count_ = 0 ) :
- pos (_pos_) , width (_width_) , height (_height_) , style (_style_) , count (_count_) , ending (_newLine_) , type (0) { ; }
+ LINE () { memset (this,0,sizeof(LINE)); }
enum TYPE
{
- NONE = 0,
- STRONG,
- MORPH,
- WORDS_OF_CHRIST,
- BREAKING_LINE
+ TYPE_NONE = 0,
+ TYPE_VERSE_NUMBER,
+ TYPE_SPACE,
+ TYPE_STRONG,
+ TYPE_MORPH,
+ TYPE_REDWORDS,
+ TYPE_LINE,
+ TYPE_IMAGE,
+ TYPE_IMAGE_COUNT = TYPE_IMAGE + DIRECTION_COUNT /*alignment*/
};
unsigned short pos;
@@ -171,8 +196,8 @@
unsigned short width;
unsigned short height;
char style;
- char type;
- bool ending:1;
+ TYPE type;
+ bool ending;
};
std::vector<LINE> lines;
@@ -180,20 +205,19 @@
void setText ( const TCHAR * text );
long index;
- //void *parameter;
- // remove
- enum PIN
- {
- NEXT, PREV, LEFT, RIGHT
- };
+ // TODO ? make private
+ void attach ( sbItem * item, sbDirection to );
- void attach ( sbItem *item, PIN to );
-
sbItem *next;
sbItem *prev;
sbItem *left;
sbItem *right;
+
+ // TODO ? automatic item width using sbTheme
+ // perform automatic layout and hidden derived class creation
+ sbItem * append ( sbItem::TYPE type, const TCHAR * text, int width, long index = -1 );
+ static sbItem * create ( sbItem::TYPE type, const TCHAR * text, int width, long index = -1 );
};
#endif
Modified: trunk/src/SlideBible/sbList.cpp
===================================================================
--- trunk/src/SlideBible/sbList.cpp 2010-05-24 19:44:18 UTC (rev 235)
+++ trunk/src/SlideBible/sbList.cpp 2010-06-02 18:27:43 UTC (rev 236)
@@ -108,8 +108,7 @@
if (debug) sbMessage ("Place in cache %i [%i,%i]\n",ci.item,ci.rect.top,ci.rect.bottom);
- item->render(surface,ci.rect,item->type == sbItem::TYPE_BANNER ? sbTheme::ELEMENT::BANNER : sbTheme::ELEMENT::ITEM);
- //sbFillRect(surface,&sbRect(ci.rect.right-20,ci.rect.top,ci.rect.right,ci.rect.top+20),sbColor("FF0066FF"));
+ item->render(surface,ci.rect);
sbBitBlt(surf,rect,surface,sbPoint(ci.rect.left,ci.rect.top));
return true;
}
@@ -135,7 +134,7 @@
initialized = true;
sbMessage ("Cache created of size %i x %i\n",width,height);
- debug = atoi((*Core->getOptions())["General"].getWithDefault("DrawCacheDebug","0"));
+ debug = atoi((*Core->getOptions())["General"].getWithDefault("DrawCacheDebug","0")) == 0 ? false : true;
}
else
{
@@ -228,7 +227,7 @@
controlSelected = -1;
rect = Core->getRect();
- rect.bottom -= Core->getTheme()->PanelSize;
+ rect.bottom -= Theme->PanelSize;
switch(type)
{
@@ -396,7 +395,7 @@
workRect.left += sideDisplacement;
workRect.right += sideDisplacement;
- Core->getTheme()->drawElement ( hdc, &workRect, sbTheme::ELEMENT::BACKGROUND );
+ Theme->drawElement ( hdc, &workRect, sbTheme::ELEMENT::BACKGROUND );
if (sideDisplacement <= 0) DrawCache.prepare();
@@ -414,25 +413,15 @@
// horizontal parse
while (workItem != NULL)
{
- sbTheme::ELEMENT::TYPE element = sbTheme::ELEMENT::ITEM;
-
workRect.top = screenHeight;
workRect.bottom = workRect.top + workItem->height;
workRect.left = workRect.right;
workRect.right = workRect.left + workItem->width;
- if ((type == TYPE_HISTORY || type == TYPE_MENU_OPTIONS) && workItem->type == sbItem::TYPE_CENTRED_DESCRIPTION)
- element = sbTheme::ELEMENT::ITEM_SEPARATOR;
-
- if ( workItem == itemHover )
- element = sbTheme::ELEMENT::ITEM_PRESSED;
- else if ( workItem->highlighted )
- element = sbTheme::ELEMENT::ITEM_HIGHLIGHTED;
-
- if (workItem->type != sbItem::TYPE_VERSE || workItem->text.size() == 0 || workItem->expanding != 0 || !workItem->processed || Core->fadeSurface)
- workItem->render(hdc,workRect,element);
+ if (workItem->type != sbItem::TYPE_VERSE || workItem->text.size() == 0 || workItem->expanding != 0 || !workItem->processed || Theme->fadeSurface)
+ workItem->render(hdc,workRect);
else if (!DrawCache.blit(hdc,workItem,workRect))
- workItem->render(hdc,workRect,element);
+ workItem->render(hdc,workRect);
if ( workItem == itemSelected ) selectedRect = workRect;
@@ -441,16 +430,16 @@
workItem = oldItem;
- if (Core->getTheme()->ListSeparatorHeight > 0 && workItem->next != NULL)
+ if (Theme->ListSeparatorHeight > 0 && workItem->next != NULL)
{
workRect.top = workRect.bottom;
- workRect.bottom = workRect.top + Core->getTheme()->ListSeparatorHeight;
+ workRect.bottom = workRect.top + Theme->ListSeparatorHeight;
workRect.left = sideDisplacement;
workRect.right = sideDisplacement+rect.width();
- Core->getTheme()->drawElement(hdc, &workRect, sbTheme::ELEMENT::SEPARATOR);
+ Theme->drawElement(hdc, &workRect, sbTheme::ELEMENT::SEPARATOR);
- screenHeight += Core->getTheme()->ListSeparatorHeight;
+ screenHeight += Theme->ListSeparatorHeight;
}
screenHeight += workItem->height;
@@ -472,7 +461,7 @@
workRect.bottom = workRect.top + workItem->height;
- workItem->render(hdc,workRect,sbTheme::ELEMENT::ANOTHER_MENU);
+ workItem->render(hdc,workRect);
workRect.top = workRect.bottom;
@@ -506,7 +495,7 @@
// selection
if (selectedRect.width() > 0)
{
- Core->getTheme()->drawFrame(hdc,&selectedRect);
+ Theme->drawFrame(hdc,&selectedRect);
needScroll = ((rect.height()/2)-((selectedRect.height()/2)+selectedRect.top));
}
}
@@ -516,8 +505,7 @@
{
if (itemBanner == NULL)
{
- itemBanner = new sbItem (sbItem::TYPE_BANNER,L"",0);
- itemBanner->center = true;
+ itemBanner = new sbItem (sbItem::LOOK_BANNER,L"",0);
}
if (itemBanner->index != place.Index())
@@ -538,14 +526,14 @@
mbstowcs ( kw, kt, kl+1 );
mbstowcs ( mw, mt, ml+1 );
- sbSelectFont (hdc, Core->getTheme()->styles[sbTheme::STYLE::CAPTION].font );
- ks = sbGetTextExtent (Core->getTheme()->styles[sbTheme::STYLE::CAPTION].font, kw, kl);
+ sbSelectFont (hdc, Theme->styles[sbTheme::STYLE::CAPTION].font );
+ ks = sbGetTextExtent (Theme->styles[sbTheme::STYLE::CAPTION].font, kw, kl);
- sbSelectFont ( hdc, Core->getTheme()->styles[sbTheme::STYLE::DESCRIPTION].font );
+ sbSelectFont ( hdc, Theme->styles[sbTheme::STYLE::DESCRIPTION].font );
for (int width = 0; mc < ml; mc++)
{
- sbPoint sz = sbGetTextExtent ( Core->getTheme()->styles[sbTheme::STYLE::DESCRIPTION].font, mw+mc, 1 );
+ sbPoint sz = sbGetTextExtent ( Theme->styles[sbTheme::STYLE::DESCRIPTION].font, mw+mc, 1 );
if ( width + sz.x > ks.x ) break;
@@ -561,7 +549,7 @@
_sntprintf(finalText,64,L"<s t=\"5\">%s</s><s t=\"6\">%s</s>",kw,mw);
itemBanner->index = place.Index();
- itemBanner->width = ks.x + (Core->getTheme()->BannerBorderSize * 2);
+ itemBanner->width = ks.x + (Theme->BannerBorderSize * 2);
itemBanner->setText(finalText);
delete [] kw;
@@ -570,10 +558,10 @@
workRect.left = (rect.width()-itemBanner->width)/2 + sideDisplacement;
workRect.right = workRect.left + itemBanner->width;
- workRect.top = (Core->getTheme()->size/6)-(itemBanner->height/2);
+ workRect.top = (Theme->size/6)-(itemBanner->height/2);
workRect.bottom = workRect.top + itemBanner->height;
- if (!DrawCache.blit(hdc,itemBanner,workRect)) itemBanner->render(hdc,workRect,sbTheme::ELEMENT::BANNER);
+ if (!DrawCache.blit(hdc,itemBanner,workRect)) itemBanner->render(hdc,workRect);
}
}
@@ -590,9 +578,9 @@
int oldDisplace = (int)displace;
// don't allow scroll further then list is
- if (amount < 0 && itemCurrent->next == NULL && itemCurrent->height+Core->getTheme()->ListSeparatorHeight+displace+amount < 0)
+ if (amount < 0 && itemCurrent->next == NULL && itemCurrent->height+Theme->ListSeparatorHeight+displace+amount < 0)
{
- amount = -(itemCurrent->height+Core->getTheme()->ListSeparatorHeight+displace);
+ amount = -(itemCurrent->height+Theme->ListSeparatorHeight+displace);
sbAssert (amount > 0);
}
if (amount > 0 && itemCurrent->prev == NULL)
@@ -649,7 +637,7 @@
return NULL;
}
top += i->height;
- top += Core->getTheme()->ListSeparatorHeight;
+ top += Theme->ListSeparatorHeight;
i = i->next;
}
@@ -751,7 +739,8 @@
void sbList::onItem ( sbItem * item )
{
- TCHAR tempText[256];
+ const int tempTextSize = 256;
+ TCHAR tempText[tempTextSize];
switch (item->type)
{
@@ -759,8 +748,8 @@
setEditMode (item);
break;
- case sbItem::TYPE_SEARCH_RANGE_START:
- case sbItem::TYPE_SEARCH_RANGE_END:
+ case sbItem::DO_SEARCH_RANGE_START:
+ case sbItem::DO_SEARCH_RANGE_END:
{
sword::VerseKey workKey = Core->currentModule == NULL ? Core->defaultModule->getKey() : Core->currentModule->getKey();
@@ -769,7 +758,7 @@
workKey.Index(item->index);
- if (item->type == sbItem::TYPE_SEARCH_RANGE_END)
+ if (item->type == sbItem::DO_SEARCH_RANGE_END)
((sword::VerseKey *)Core->searchRange.getElement(0))->UpperBound(workKey);
else
((sword::VerseKey *)Core->searchRange.getElement(0))->LowerBound(workKey);
@@ -798,7 +787,7 @@
{
sbMessage ("\t%s\n",result.GetElement(i)->getText());
mbstowcs(tempText,result.GetElement(i)->getText(),256);
- tempItem->attach(new sbItem (sbItem::TYPE_BUTTON_BOOKMARK,tempText,rect.width(),result.GetElement(i)->Index()),sbItem::PIN::NEXT);
+ tempItem->attach(new sbItem (sbItem::TYPE_BUTTON_BOOKMARK,tempText,rect.width(),result.GetElement(i)->Index()),DIRECTION_NEXT);
tempItem = tempItem->next;
}
@@ -826,7 +815,7 @@
sword::SWModule * module = ((sword::SWModule*)item->index);
- _sntprintf(tempText,256,L"Dou you want to install %S of size %S KB ?\n",module->Name(),module->getConfigEntry("InstallSize"));
+ _sntprintf(tempText,tempTextSize,L"Dou you want to install %S of size %S KB ?\n",module->Name(),module->getConfigEntry("InstallSize"));
if (sbQueryBox(tempText))
success = Core->installMgr.installModule(Core->getSword(),"",module->Name(),source);
@@ -846,28 +835,62 @@
{
sword::InstallSource * source = (sword::InstallSource *)item->index;
- if (item->next == NULL || !(item->next->type == sbItem::TYPE_MODULE_INSTALLER_MODULE || item->next->type == sbItem::TYPE_MODULE_INSTALLER_UPDATE))
+ // repository expand / collapse
+ if (item->next == NULL || item->next->type == sbItem::TYPE_MODULE_INSTALLER_REPO)
{
+ sword::StringList sl;
std::map<sword::SWModule *,int> diff = Core->installMgr.getModuleStatus(*Core->getSword(),*source->getMgr());
+ sbItem * lastItem = item;
for (std::map<sword::SWModule *,int>::iterator it = diff.begin(); it != diff.end(); it++)
{
+ if (std::find(sl.begin(),sl.end(),(*it).first->Type()) == sl.end())
+ {
+ sl.push_back((*it).first->Type());
+
+ _sntprintf(tempText,tempTextSize,L"%S",(*it).first->Type());
+ lastItem->attach(sbItem::create(sbItem::LOOK_SEPARATOR,tempText,rect.width()),DIRECTION_NEXT);
+ lastItem = lastItem->next;
+
+ for (std::map<sword::SWModule *,int>::iterator im = it; im != diff.end(); im++)
+ {
+ if (!strcmp((*it).first->Type(),(*im).first->Type()))
+ {
+ if ( (*im).second & sword::InstallMgr::MODSTAT_NEW )
+ {
+ _sntprintf(tempText,tempTextSize,L"%S\n<s t=\"6\">%S</s>",(*im).first->Name(),(*im).first->Description());
+ lastItem->attach(new sbItem (sbItem::TYPE_MODULE_INSTALLER_MODULE,tempText,rect.width(),(long)(*im).first),DIRECTION_NEXT);
+ lastItem = lastItem->next;
+ }
+ else if ( (*im).second & sword::InstallMgr::MODSTAT_UPDATED )
+ {
+ _sntprintf(tempText,tempTextSize,L"%S<s t=\"6\"> - Update\n%S</s>",(*im).first->Name(),(*im).first->Description());
+ lastItem->attach(new sbItem (sbItem::TYPE_MODULE_INSTALLER_UPDATE,tempText,rect.width(),(long)(*im).first),DIRECTION_NEXT);
+ lastItem = lastItem->next;
+ }
+ }
+ }
+ }
+ }
+
+ /*for (std::map<sword::SWModule *,int>::iterator it = diff.begin(); it != diff.end(); it++)
+ {
if ( (*it).second & sword::InstallMgr::MODSTAT_NEW )
{
_sntprintf(tempText,256,L"%S\n<s t=\"6\">%S\n[%S]</s>",(*it).first->Name(),(*it).first->Description(),(*it).first->Type());
- item->attach(new sbItem (sbItem::TYPE_MODULE_INSTALLER_MODULE,tempText,rect.width(),(long)(*it).first),sbItem::NEXT);
+ item->attach(new sbItem (sbItem::TYPE_MODULE_INSTALLER_MODULE,tempText,rect.width(),(long)(*it).first),DIRECTION_NEXT);
}
else if ( (*it).second & sword::InstallMgr::MODSTAT_UPDATED )
{
_sntprintf(tempText,128,L"%S<s t=\"6\"> - Update\n%S\n[%S]</s>",(*it).first->Name(),(*it).first->Description(),(*it).first->Type());
- item->attach(new sbItem (sbItem::TYPE_MODULE_INSTALLER_UPDATE,tempText,rect.width(),(long)(*it).first),sbItem::NEXT);
+ item->attach(new sbItem (sbItem::TYPE_MODULE_INSTALLER_UPDATE,tempText,rect.width(),(long)(*it).first),DIRECTION_NEXT);
}
- }
+ }*/
}
else
{
- while (item->next != NULL && (item->next->type == sbItem::TYPE_MODULE_INSTALLER_MODULE || item->next->type == sbItem::TYPE_MODULE_INSTALLER_UPDATE) )
+ while (item->next != NULL && (item->next->type == sbItem::LOOK_SEPARATOR || item->next->type == sbItem::TYPE_MODULE_INSTALLER_MODULE || item->next->type == sbItem::TYPE_MODULE_INSTALLER_UPDATE) )
delete item->next;
}
}
@@ -918,7 +941,7 @@
break;
case sbItem::TYPE_BUTTON_BOOKMARK:
- case sbItem::TYPE_BUTTON_BOOKMARK_SMALL:
+ case sbItem::TYPE_BOOKMARK_VERSE_NUMBER:
{
Core->goVerse = true;
if (Core->currentModule == NULL)
@@ -950,8 +973,8 @@
for (int i=0; i < workKey.getChapterMax(); i++)
{
workKey.setChapter(i+1);
- _itot(workKey.getChapter(), tempText, 10);
-
+
+ _sntprintf(tempText,tempTextSize,L"<s t=\"3\" a=\"c\">%i</s>",workKey.getChapter());
sbItem *item = new sbItem (sbItem::TYPE_BUTTON_SELECTION_CHAPTER, tempText, rect.width()/3, workKey.Index());
if (tmpItem->type == sbItem::TYPE_BUTTON_SELECTION_CHAPTER &&
@@ -959,11 +982,11 @@
{
sbItem *last = tmpItem;
while(last->right != NULL) last = last->right;
- last->attach(item, sbItem::RIGHT);
+ last->attach(item, DIRECTION_RIGHT);
}
else
{
- tmpItem->attach (item, sbItem::NEXT);
+ tmpItem->attach (item, DIRECTION_NEXT);
tmpItem = tmpItem->next;
}
}
@@ -972,9 +995,9 @@
if (tmpItem->type == sbItem::TYPE_BUTTON_SELECTION_CHAPTER)
{
if (tmpItem->right == NULL)
- tmpItem->attach(new sbItem (sbItem::TYPE_SPACE, L"", rect.width()/3*2), sbItem::RIGHT);
+ tmpItem->attach(new sbItem (sbItem::DO_NONE, L"", rect.width()/3*2), DIRECTION_RIGHT);
else if (tmpItem->right->right == NULL)
- tmpItem->right->attach(new sbItem (sbItem::TYPE_SPACE, L"", rect.width()/3), sbItem::RIGHT);
+ tmpItem->right->attach(new sbItem (sbItem::DO_NONE, L"", rect.width()/3), DIRECTION_RIGHT);
}
}
}
@@ -1036,10 +1059,10 @@
{
sbAssert (itemMenu != NULL);
- itemMenu = new sbItem (sbItem::TYPE::TYPE_SEARCH_RANGE_START,L"Search from",rect.width()/2,item->index);
- itemMenu->attach(new sbItem (sbItem::TYPE::TYPE_SEARCH_RANGE_END,L"Search to",rect.width()/2,item->index),sbItem::PIN::NEXT);
+ itemMenu = new sbItem (sbItem::DO_SEARCH_RANGE_START,L"Search from",rect.width()/2,item->index);
+ itemMenu->attach(new sbItem (sbItem::DO_SEARCH_RANGE_END,L"Search to",rect.width()/2,item->index),DIRECTION_NEXT);
- menuPosition = sbPoint (max(Core->getTheme()->size/10,x-itemMenu->width),max(Core->getTheme()->size/10,y-itemMenu->height-itemMenu->next->height));
+ menuPosition = sbPoint (max(Theme->size/10,x-itemMenu->width),max(Theme->size/10,y-itemMenu->height-itemMenu->next->height));
}
}
@@ -1247,9 +1270,9 @@
if ( controls.back()->isMenu() )
{
- sbAssert(Core->fadeSurface || Core->getInput()->block);
+ sbAssert(Theme->fadeSurface || Core->getInput()->block);
- Core->fadeSurface = true;
+ Theme->fadeSurface = true;
Core->getInput()->block = true;
}
}
@@ -1262,9 +1285,9 @@
{
if ((*it)->isMenu())
{
- sbAssert(!Core->fadeSurface || !Core->getInput()->block);
+ sbAssert(!Theme->fadeSurface || !Core->getInput()->block);
- Core->fadeSurface = false;
+ Theme->fadeSurface = false;
Core->getInput()->block = false;
}
@@ -1297,7 +1320,7 @@
if ( item->expanding != 0 && !( direction == 1 && item == itemCurrent ) )
{
// out of screen
- if ( y < -(item->height+Core->getTheme()->ListSeparatorHeight) || y > rect.height() )
+ if ( y < -(item->height+Theme->ListSeparatorHeight) || y > rect.height() )
{
item->height = item->expanding;
item->expanding = 0;
@@ -1353,6 +1376,9 @@
case sbCore::TIMER_BEFORE_REDRAW:
{
+ const int tempTextSize = 72;
+ TCHAR tempText [tempTextSize];
+
// add blank verses
if ( type == sbList::TYPE_MODULE_VIEW && module != NULL )
{
@@ -1362,18 +1388,18 @@
if (itemCurrent == NULL)
{
- itemCurrent = new sbItem (sbItem::TYPE_VERSE, NULL, rect.width(), workKey.Index(), workKey.getVerse());
+ _sntprintf(tempText,tempTextSize,L"<s a=\"c\">%i</s>",workKey.getVerse());
+ itemCurrent = new sbItem (sbItem::TYPE_VERSE, tempText, rect.width(), workKey.Index());
+
before.verse = itemCurrent;
after.verse = itemCurrent;
if (workKey.getVerse() == 1)
{
- TCHAR headerText [32];
+ _sntprintf(tempText,tempTextSize,L"<s a=\"c\" t=\"5\">%S %i</s>",workKey.getBookName(),workKey.getChapter());
- _sntprintf(headerText,32,L"%S %i",workKey.getBookName(),workKey.getChapter());
-
- itemCurrent->attach(new sbItem (sbItem::TYPE_HEADER, headerText, rect.width(), workKey.Index()), sbItem::PREV);
+ itemCurrent->attach(new sbItem (sbItem::LOOK_CAPTION, tempText, rect.width(), workKey.Index()), DIRECTION_PREV);
}
added++;
@@ -1419,8 +1445,10 @@
if (workKey.Index() != index)
{
- item->attach(new sbItem (sbItem::TYPE_VERSE, NULL, rect.width(), workKey.Index(), workKey.getVerse()), atEnd ? sbItem::NEXT : sbItem::PREV);
+ _sntprintf(tempText,tempTextSize,L"<s a=\"c\">%i</s>",workKey.getVerse());
+ item->attach(new sbItem (sbItem::TYPE_VERSE, tempText, rect.width(), workKey.Index()), atEnd ? DIRECTION_NEXT : DIRECTION_PREV);
+
if (atEnd)
{
after.verse = item->next;
@@ -1434,27 +1462,15 @@
if (workKey.getVerse() == 1)
{
- TCHAR headerText [32];
+ _sntprintf(tempText,tempTextSize,L"<s a=\"c\" t=\"5\">%S %i</s>",workKey.getBookName(),workKey.getChapter());
- const char* book = workKey.getBookName();
- int length = strlen(book);
- mbstowcs(headerText,book,length);
-
- char chap[8];
- _itoa(workKey.getChapter(),chap,10);
-
- headerText[length++] = length > 9 ? L'\n' : L' ';
-
- for(int i=0;i<strlen(chap)+1;i++)
- headerText[length++] = chap[i];
-
if (atEnd)
{
- after.verse->attach(new sbItem (sbItem::TYPE_HEADER, headerText, rect.width(), workKey.Index()), sbItem::PREV);
+ after.verse->attach(new sbItem (sbItem::LOOK_CAPTION, tempText, rect.width(), workKey.Index()), DIRECTION_PREV);
}
else
{
- before.verse->attach(new sbItem (sbItem::TYPE_HEADER, headerText, rect.width(), workKey.Index()), sbItem::PREV);
+ before.verse->attach(new sbItem (sbItem::LOOK_CAPTION, tempText, rect.width(), workKey.Index()), DIRECTION_PREV);
}
}
added++;
@@ -1469,7 +1485,7 @@
// itemCurrent may be not first on screen, so do correction
if ( itemCurrent != NULL )
{
- while (displace > -Core->getTheme()->ListSeparatorHeight && itemCurrent->prev != NULL)
+ while (displace > -Theme->ListSeparatorHeight && itemCurrent->prev != NULL)
{
if (itemCurrent->type == sbItem::TYPE_VERSE)
{
@@ -1478,14 +1494,14 @@
}
itemCurrent = itemCurrent->prev;
- displace -= itemCurrent->height + Core->getTheme()->ListSeparatorHeight;
+ displace -= itemCurrent->height + Theme->ListSeparatorHeight;
}
- while (displace < 0 && fabs(displace) > itemCurrent->height + Core->getTheme()->ListSeparatorHeight)
+ while (displace < 0 && fabs(displace) > itemCurrent->height + Theme->ListSeparatorHeight)
{
if (itemCurrent->next == NULL) break;
- displace += itemCurrent->height + Core->getTheme()->ListSeparatorHeight;
+ displace += itemCurrent->height + Theme->ListSeparatorHeight;
if (itemCurrent->type == sbItem::TYPE_VERSE)
{ before.verseCount++; after.verseCount--; }
@@ -1503,7 +1519,8 @@
*/
void sbList::onActivate ( )
{
- static TCHAR tempText [256];
+ const int tempTextSize = 256;
+ static TCHAR tempText [tempTextSize];
sbSetSip ( itemEdit != NULL );
@@ -1513,8 +1530,6 @@
{
case TYPE_SEARCH:
{
- //clear();
-
if (Core->currentModule != NULL)
{
if (!Core->searchRange.Count())
@@ -1523,24 +1538,20 @@
Core->searchRange = workKey.ParseVerseList("Gen-Rev",NULL,true,true);
}
- if (!itemCurrent || itemCurrent->type == sbItem::TYPE_TEXT)
+ if (itemCurrent == NULL || itemCurrent->type == sbItem::DO_NONE)
{
- clear ();
- // TODO: gray inactive text for text fields "type here"
+ clear();
+
itemCurrent = new sbItem (sbItem::TYPE_TEXT_FIELD,L"",rect.width());
- itemCurrent->attach(new sbItem (sbItem::TYPE_START_SEARCH,L"",rect.width()),sbItem::PIN::NEXT);
+ itemCurrent->attach(new sbItem (sbItem::TYPE_START_SEARCH,L"",rect.width()),DIRECTION_NEXT);
}
- sbItem * workItem = itemCurrent;
- while (workItem->prev != NULL) workItem = workItem->prev;
- while (workItem->type != sbItem::TYPE_START_SEARCH && workItem->next != NULL) workItem = workItem->next;
-
- _sntprintf(tempText,256,L"Search ...\n<s t=\"6\">%S</s>",Core->searchRange.getRangeText());
- workItem->setText(tempText);
+ _sntprintf(tempText,tempTextSize,L"<s t=\"3\" a=\"c\">Search ...\n</s><s a=\"l\" t=\"6\">%S in %S</s>",Core->currentModule->Name(),Core->searchRange.getRangeText());
+ itemCurrent->getItem(sbItem::TYPE_START_SEARCH)->setText(tempText);
}
else
{
- itemCurrent = new sbItem (sbItem::TYPE_TEXT,L"No Module Selected",rect.width());
+ itemCurrent = new sbItem (sbItem::DO_NONE,L"<s a=\"c\" t=\"3\">No Module Selected</s>",rect.width());
}
}
break;
@@ -1548,14 +1559,14 @@
case TYPE_MODULE_INSTALLER_DISCLAIMER:
{
clear();
- itemCurrent = new sbItem (sbItem::TYPE_TEXT,L"WARNING\n \nAlthough Install Manager provides a convenient way for installing and upgrading SWORD components, it also uses a systematic method for accessing sites which gives packet sniffers a target to lock into for singling out users.\n \nIF YOU LIVE IN A PERSECUTED COUNTRY AND DO NOT WISH TO RISK DETECTION, YOU SHOULD <b>NOT</b> USE INSTALL MANAGER'S REMOTE SOURCE FEATURES.\n \nAlso, Remote Sources other than CrossWire may contain less than quality modules, modules with unorthodox content, or even modules which are not legitimately distributable. Many repositories contain wonderfully useful content. These repositories simply are not reviewed or maintained by CrossWire and CrossWire cannot be held responsible for their content.\n \nIf you understand this and are willing to enable remote source features then type yes at the prompt.",rect.width());
+ itemCurrent = new sbItem (sbItem::DO_NONE,L"WARNING\n \nAlthough Install Manager provides a convenient way for installing and upgrading SWORD components, it also uses a systematic method for accessing sites which gives packet sniffers a target to lock into for singling out users.\n \nIF YOU LIVE IN A PERSECUTED COUNTRY AND DO NOT WISH TO RISK DETECTION, YOU SHOULD <b>NOT</b> USE INSTALL MANAGER'S REMOTE SOURCE FEATURES.\n \nAlso, Remote Sources other than CrossWire may contain less than quality modules, modules with unorthodox content, or even modules which are not legitimately distributable. Many repositories contain wonderfully useful content. These repositories simply are not reviewed or maintained by CrossWire and CrossWire cannot be held responsible for their content.\n \nIf you understand this and are willing to enable remote source features then type yes at the prompt.",rect.width());
}
break;
case TYPE_MODULE_INSTALLER:
{
sbItem * tempItem;
- bool refreshed = (bool)atoi((*Core->installMgr.installConf)["General"].getWithDefault("Refreshed","0"));
+ bool refreshed = atoi((*Core->installMgr.installConf)["General"].getWithDefault("Refreshed","0")) == 0 ? false : true;
clear();
@@ -1566,14 +1577,15 @@
if (success != 0) sbMessage ("Install Manager Refresh Sources : %i\n",success);
+ tempItem = itemCurrent = sbItem::create(sbItem::LOOK_SEPARATOR,L"Available repositories:",rect.width());
+
for (sword::InstallSourceMap::iterator it = Core->installMgr.sources.begin(); it != Core->installMgr.sources.end(); it++)
{
- _sntprintf(tempText,256,L"%S",(*it).second->caption);
+ _sntprintf(tempText,tempTextSize,L"<s a=\"c\" t=\"5\">%S</s>",(*it).second->caption);
- tempItem = new sbItem (sbItem::TYPE_MODULE_INSTALLER_REPO,tempText,rect.width(),(long)(*it).second);
+ tempItem->attach(sbItem::create(sbItem::TYPE_MODULE_INSTALLER_REPO,tempText,rect.width(),(long)(*it).second),DIRECTION_NEXT);
+ tempItem = tempItem->next;
- if (itemCurrent == NULL) itemCurrent = tempItem; else itemCurrent->attach(tempItem,sbItem::NEXT);
-
if (!refreshed) Core->installMgr.refreshRemoteSource((*it).second);
Core->installMgr.getModuleStatus(*Core->getSword(),*(*it).second->getMgr());
@@ -1581,16 +1593,8 @@
sbWaitMode ( false );
- if (itemCurrent == NULL)
- {
- itemCurrent = new sbItem (sbItem::TYPE_TEXT,L"No Repositories found",rect.width());
- }
- else
- {
+ if (Core->installMgr.sources.size() > 0)
(*Core->installMgr.installConf)["General"]["Refreshed"] = "1";
- }
-
- while (itemCurrent != NULL && itemCurrent->prev != NULL) itemCurrent = itemCurrent->prev;
}
break;
@@ -1598,15 +1602,15 @@
{
clear();
- itemCurrent = new sbItem(sbItem::TYPE_CENTRED_DESCRIPTION,L"Module Options :",rect.width());
+ itemCurrent = new sbItem(sbItem::LOOK_SEPARATOR,L"Module Options :",rect.width());
for (int i = 0; i < Core->moduleOptions.size(); i++)
{
- _sntprintf(tempText,256,L"%S : %S",Core->moduleOptions[i],Core->getSword()->getGlobalOption(Core->moduleOptions[i]));
+ _sntprintf(tempText,tempTextSize,L"%S : %S",Core->moduleOptions[i],Core->getSword()->getGlobalOption(Core->moduleOptions[i]));
sbItem * item = new sbItem(sbItem::TYPE_SWITCH_MODULE_OPTION,tempText,rect.width(),i);
- itemCurrent->attach(item,sbItem::NEXT);
+ itemCurrent->attach(item,DIRECTION_NEXT);
itemCurrent = itemCurrent->next;
}
@@ -1620,10 +1624,9 @@
{
clear ();
- _sntprintf(tempText,256,L"%S %i",Core->currentVerse.getBookName(),Core->currentVerse.getChapter());
+ _sntprintf(tempText,tempTextSize,L"<s a=\"c\" t=\"5\">%S %i</s>",Core->currentVerse.getBookName(),Core->currentVerse.getChapter());
+ itemCurrent = new sbItem (sbItem::DO_NONE, tempText, rect.width(), Core->currentVerse.Index());
- itemCurrent = new sbItem (sbItem::TYPE_HEADER, tempText, rect.width(), Core->currentVerse.Index());
-
// add verses
sbItem * tempItem = itemCurrent;
@@ -1632,120 +1635,81 @@
for (int i=0; i < workKey.getVerseMax(); i++)
{
workKey.setVerse(i+1);
- TCHAR text[8];
- _itot(workKey.getVerse(), text, 10);
+
+ _sntprintf(tempText,tempTextSize,L"<s a=\"c\" t=\"3\">%i</s>",workKey.getVerse());
+ sbItem * item = new sbItem (sbItem::TYPE_BOOKMARK_VERSE_NUMBER, tempText, rect.width()/4, workKey.Index());
- sbItem * item = new sbItem (sbItem::TYPE_BUTTON_BOOKMARK_SMALL, text, rect.width()/4, workKey.Index());
-
- if (tempItem->type == sbItem::TYPE_BUTTON_BOOKMARK_SMALL &&
+ if (tempItem->type == sbItem::TYPE_BOOKMARK_VERSE_NUMBER &&
(tempItem->right == NULL || tempItem->right->right == NULL || tempItem->right->right->right == NULL))
{
sbItem *last = tempItem;
while(last->right != NULL) last = last->right;
- last->attach(item, sbItem::RIGHT);
+ last->attach(item, DIRECTION_RIGHT);
}
else
{
- tempItem->attach (item, sbItem::NEXT);
+ tempItem->attach (item, DIRECTION_NEXT);
tempItem = tempItem->next;
}
}
// add space
- if (tempItem->type == sbItem::TYPE_BUTTON_BOOKMARK_SMALL)
+ if (tempItem->type == sbItem::TYPE_BOOKMARK_VERSE_NUMBER)
{
if (tempItem->right == NULL)
- tempItem->attach(new sbItem (sbItem::TYPE_SPACE, L"", rect.width()/4*3), sbItem::RIGHT);
+ tempItem->attach(new sbItem (sbItem::DO_NONE, L"", rect.width()/4*3), DIRECTION_RIGHT);
else if (tempItem->right->right == NULL)
- tempItem->right->attach(new sbItem (sbItem::TYPE_SPACE, L"", rect.width()/4*2), sbItem::RIGHT);
+ tempItem->right->attach(new sbItem (sbItem::DO_NONE, L"", rect.width()/4*2), DIRECTION_RIGHT);
else if (tempItem->right->right->right == NULL)
- tempItem->right->right->attach(new sbItem (sbItem::TYPE_SPACE, L"", rect.width()/4), sbItem::RIGHT);
+ tempItem->right->right->attach(new sbItem (sbItem::DO_NONE, L"", rect.width()/4), DIRECTION_RIGHT);
}
}
break;
case TYPE_HOME:
{
- float saveDisplacement = 0;
-
- if (itemCurrent != NULL)
- {
- while (itemCurrent->prev != NULL)
- {
- itemCurrent = itemCurrent->prev;
- displace -= itemCurrent->height + Core->getTheme()->ListSeparatorHeight;
- }
- saveDisplacement = displace;
- }
-
clear();
- displace = saveDisplacement;
-
- itemCurrent = new sbItem (sbItem::TYPE_HEADER, L"Welcome to\nSlideBible Beta!", rect.width());
-
+ itemCurrent = new sbItem (sbItem::DO_NONE, L"<s t=\"5\" a=\"c\">Welcome to\nSlideBible Beta!</s>", rect.width());
+
if ( Core->defaultModule != NULL )
{
sword::VerseKey workKey ( Core->defaultModule->getKey() );
if ( Core->currentModule != NULL ) // here we should check last active module view
{
- const char * place = Core->currentVerse.getText();
-
- const TCHAR * pre = L" \nReturn to ";
-
- TCHAR * text = new TCHAR [_tcslen(pre)+strlen(place)+1+2];
- memcpy ( text, pre, sizeof(TCHAR)*_tcslen(pre) );
- mbstowcs ( text+_tcslen(pre), place , strlen( place ) + 1 );
-
- text[_tcslen(text)+2] = NULL;
- text[_tcslen(text)+1] = L' ';
- text[_tcslen(text)] = L'\n';
-
- itemCurrent->attach(new sbItem (sbItem::TYPE_GOTO_MODULES, text, rect.width()), sbItem::NEXT);
+ _sntprintf(tempText,tempTextSize,L"<s a=\"c\"/> \nReturn to %S\n ",Core->currentVerse.getText());
+
+ itemCurrent->attach(new sbItem (sbItem::TYPE_GOTO_MODULES, tempText, rect.width()), DIRECTION_NEXT);
itemCurrent = itemCurrent->next;
-
- delete [] text;
}
else if (Core->features.history.size() > 0)
{
workKey.copyFrom(Core->getSword()->getModule(Core->features.history.back().module)->getKey());
workKey.Index(Core->features.history.back().placeEnd);
- const char * place = workKey.getText();
+ _sntprintf(tempText,tempTextSize,L"<s a=\"c\"/> \nContinue read from %S\n ",workKey.getText());
- const TCHAR * pre = L" \nContinue read from ";
-
- TCHAR * text = new TCHAR [_tcslen(pre)+strlen(place)+1+2];
- memcpy ( text, pre, sizeof(TCHAR)*_tcslen(pre) );
- mbstowcs ( text+_tcslen(pre), place , strlen( place ) + 1 );
-
- text[_tcslen(text)+2] = NULL;
- text[_tcslen(text)+1] = L' ';
- text[_tcslen(text)] = L'\n';
-
- itemCurrent->attach(new sbItem (sbItem::TYPE_GO_HISTORY, text, rect.width(), Core->features.history.size()-1), sbItem::NEXT);
+ itemCurrent->attach(new sbItem (sbItem::TYPE_GO_HISTORY, tempText, rect.width(), Core->features.history.size()-1), DIRECTION_NEXT);
itemCurrent = itemCurrent->next;
-
- delete [] text;
}
else
{
workKey.setText ( "John 1:1" );
- itemCurrent->attach(new sbItem (sbItem::TYPE_BUTTON_BOOKMARK, L" \nRead Bible ...\n ", rect.width(), workKey.Index()), sbItem::NEXT);
+ itemCurrent->attach(new sbItem (sbItem::TYPE_BUTTON_BOOKMARK, L"<s a=\"c\"/> \nRead Bible ...\n ", rect.width(), workKey.Index()), DIRECTION_NEXT);
itemCurrent = itemCurrent->next;
}
}
else
{
- itemCurrent->attach (new sbItem (sbItem::TYPE_TEXT, L"No modules Found!\n\nPlease download any Bible module from www.crosswire.org and put \"mods.d\" and \"modules\" folders into application folder.", rect.width()), sbItem::NEXT);
+ itemCurrent->attach (new sbItem (sbItem::DO_NONE, L"No modules Found!\n\nPlease download any Bible module from www.crosswire.org and put \"mods.d\" and \"modules\" folders into application folder.", rect.width()), DIRECTION_NEXT);
itemCurrent = itemCurrent->next;
- itemCurrent->attach (new sbItem (sbItem::TYPE_OPEN_MODULE_INSTALLER,L"Install Modules ...", rect.width()),sbItem::NEXT);
+ itemCurrent->attach (new sbItem (sbItem::TYPE_OPEN_MODULE_INSTALLER,L"Install Modules ...", rect.width()),DIRECTION_NEXT);
itemCurrent = itemCurrent->next;
}
- _sntprintf(tempText,256,L"About :\nBuilt on %S\nUsing SWORD version %S",__DATE__,sword::SWVersion::currentVersion.getText());
- itemCurrent->attach(new sbItem (sbItem::TYPE_CENTRED_DESCRIPTION, tempText, rect.width()), sbItem::NEXT);
+ _sntprintf(tempText,tempTextSize,L"<s a=\"c\" t=\"6\">About :\nBuilt on %S\nUsing SWORD version %S</s>",__DATE__,sword::SWVersion::currentVersion.getText());
+ itemCurrent->attach(new sbItem (sbItem::DO_NONE, tempText, rect.width()), DIRECTION_NEXT);
itemCurrent = itemCurrent->next;
while ( itemCurrent->prev != NULL ) itemCurrent = itemCurrent->prev;
@@ -1835,6 +1799,7 @@
case TYPE_SELECT_BOOK:
{
sbItem * setItem = NULL;
+ int t = 0;
sword::VerseKey workKey ( Core->currentVerse );
@@ -1846,28 +1811,30 @@
while ( true )
{
- const char * book = workKey.getBookName();
+ _sntprintf(tempText,tempTextSize,L"<s t=\"3\" a=\"c\">%S</s>",workKey.getBookName());
+ sbItem *item = new sbItem (sbItem::TYPE_BUTTON_SELECTION_BOOK, tempText, rect.width(), workKey.Index());
- TCHAR * text = new TCHAR [strlen(book)+1];
+ if (moduleBook == workKey.getBookName()) setItem = item;
- mbstowcs(text,book,strlen(book)+1);
-
- sbItem *item = new sbItem (sbItem::TYPE_BUTTON_SELECTION_BOOK, text, rect.width(), workKey.Index());
-
- delete [] text;
-
- if (moduleBook == book) setItem = item;
-
if (itemCurrent == NULL)
{
itemCurrent = item;
}
else
{
- itemCurrent->attach (item, sbItem::NEXT);
+ itemCurrent->attach (item, DIRECTION_NEXT);
itemCurrent = itemCurrent->next;
}
+ // testament separator
+ if (t != workKey.getTestament())
+ {
+ if (t == 0) itemCurrent->attach(sbItem::create(sbItem::LOOK_SEPARATOR,L"Old Testament",rect.width()),DIRECTION_PREV);
+ else if (t == 1) itemCurrent->attach(sbItem::create(sbItem::LOOK_SEPARATOR,L"New Testament",rect.width()),DIRECTION_PREV);
+
+ t = workKey.getTestament();
+ }
+
// next book
int b = workKey.getBook();
@@ -1877,7 +1844,12 @@
}
if (setItem != NULL)
- itemCurrent = setItem;
+ {
+ if (setItem->prev != NULL && setItem->prev->type == sbItem::LOOK_SEPARATOR)
+ itemCurrent = setItem->prev;
+ else
+ itemCurrent = setItem;
+ }
else
while (itemCurrent->prev != NULL) itemCurrent = itemCurrent->prev;
}
@@ -1885,68 +1857,42 @@
case TYPE_SELECT_MODULE:
{
- sbItem * tempItem;
- int id = 0;
-
clear();
+ sword::StringList sl;
+ sbItem * tempItem;
+
for (sword::ModMap::iterator it = Core->getSword()->Modules.begin(); it != Core->getSword()->Modules.end(); it++)
{
- sword::SWModule *mod = (*it).second;
-
- if (!strcmp(mod->Type(), "Biblical Texts"))
+ if (std::find(sl.begin(),sl.end(),(*it).second->Type()) == sl.end())
{
- _sntprintf(tempText,128,L"%S\n<s t=\"6\">%S</s>",mod->Name(),mod->Description());
+ sl.push_back((*it).second->Type());
- sbItem *item = new sbItem (sbItem::TYPE_BUTTON_SELECTION_MODULE, tempText, rect.width(), (long)mod);
+ _sntprintf(tempText,tempTextSize,L"%S",(*it).second->Type());
+ tempItem = sbItem::create(sbItem::LOOK_SEPARATOR,tempText,rect.width());
- if (Core->currentModule == mod) item->highlighted = true;
-
if (itemCurrent == NULL)
- {
- itemCurrent = item;
- }
+ itemCurrent = tempItem;
else
+ itemCurrent->attach(tempItem,DIRECTION_NEXT), itemCurrent = itemCurrent->next;
+
+ for (sword::ModMap::iterator im = it; im != Core->getSword()->Modules.end(); im++)
{
- itemCurrent->attach (item, sbItem::NEXT);
- itemCurrent = itemCurrent->next;
- }
- }
+ if (!strcmp((*it).second->Type(),(*im).second->Type()))
+ {
+ _sntprintf(tempText,tempTextSize,L"%S\n<s t=\"6\">%S</s>",(*im).second->Name(),(*im).second->Description());
+ itemCurrent->attach(new sbItem (sbItem::TYPE_BUTTON_SELECTION_MODULE, tempText, rect.width(), (long)(*im).second),DIRECTION_NEXT);
+ itemCurrent = itemCurrent->next;
- id++;
- }
-
- id = 0;
-
- for (sword::ModMap::iterator it = Core->getSword()->Modules.begin(); it != Core->getSword()->Modules.end(); it++)
- {
- sword::SWModule *mod = (*it).second;
-
- if (!strcmp(mod->Type(), "Commentaries"))
- {
- _sntprintf(tempText,128,L"%S\n<s t=\"6\">%S</s>",mod->Name(),mod->Description());
-
- sbItem *item = new sbItem (sbItem::TYPE_BUTTON_SELECTION_MODULE, tempText, rect.width(), (long)mod);
-
- if (Core->currentModule == mod) item->highlighted = true;
-
- if (itemCurrent == NULL)
- {
- itemCurrent = item;
+ if (Core->currentModule == (*im).second) itemCurrent->highlighted = true;
+ }
}
- else
- {
- itemCurrent->attach (item, sbItem::NEXT);
- itemCurrent = itemCurrent->next;
- }
}
-
- id++;
}
- tempItem = new sbItem (sbItem::TYPE_OPEN_MODULE_INSTALLER,L"Install Modules ...", rect.width());
+ tempItem = sbItem::create (sbItem::TYPE_OPEN_MODULE_INSTALLER, L" \n<s a=\"c\" t=\"3\">Install Modules ...</s>\n ", rect.width());
- if (itemCurrent == NULL) itemCurrent = tempItem; else itemCurrent->attach(tempItem,sbItem::NEXT);
+ itemCurrent == NULL ? itemCurrent = tempItem : itemCurrent->attach(tempItem,DIRECTION_NEXT);
while (itemCurrent->prev != NULL) itemCurrent = itemCurrent->prev;
}
@@ -1991,7 +1937,7 @@
sword::VerseKey workKey ( Core->getSword()->getModule(hi->module)->getKey() );
workKey.Index (hi->placeEnd);
- _sntprintf(tempText,128,L"%S\n<s t=\"5\">%i:%i\n</s><s t=\"6\">%S</s>",workKey.getBookName(),workKey.getChapter(),workKey.getVerse(),hi->module);
+ _sntprintf(tempText,tempTextSize,L"%S\n<s t=\"5\">%i:%i\n</s><s t=\"6\">%S</s>",workKey.getBookName(),workKey.getChapter(),workKey.getVerse(),hi->module);
sbItem * timeHeader = NULL;
@@ -1999,7 +1945,7 @@
{
if(!createdNow)
{
- timeHeader = new sbItem (sbItem::TYPE_CENTRED_DESCRIPTION, L"Now", rect.width());
+ timeHeader = new sbItem (sbItem::LOOK_SEPARATOR, L"Now", rect.width());
createdNow = true;
}
}
@@ -2007,7 +1953,7 @@
{
if(!createdToday)
{
- timeHeader = new sbItem (sbItem::TYPE_CENTRED_DESCRIPTION, L"Today", rect.width());
+ timeHeader = new sbItem (sbItem::LOOK_SEPARATOR, L"Today", rect.width());
createdToday = true;
}
}
@@ -2015,7 +1961,7 @@
{
if(!createdYesterday)
{
- timeHeader = new sbItem (sbItem::TYPE_CENTRED_DESCRIPTION, L"Yesterday", rect.width());
+ timeHeader = new sbItem (sbItem::LOOK_SEPARATOR, L"Yesterday", rect.width());
createdYesterday = true;
}
}
@@ -2023,13 +1969,13 @@
{
if(!createdWeek)
{
- timeHeader = new sbItem (sbItem::TYPE_CENTRED_DESCRIPTION, L"Last Week", rect.width());
+ timeHeader = new sbItem (sbItem::LOOK_SEPARATOR, L"Last Week", rect.width());
createdWeek = true;
}
}
else if (!createdOlder)
{
- timeHeader = new sbItem (sbItem::TYPE_CENTRED_DESCRIPTION, L"Older", rect.width());
+ timeHeader = new sbItem (sbItem::LOOK_SEPARATOR, L"Older", rect.width());
createdOlder = true;
}
@@ -2041,7 +1987,7 @@
}
else
{
- itemCurrent->attach(timeHeader,sbItem::NEXT);
+ itemCurrent->attach(timeHeader,DIRECTION_NEXT);
itemCurrent = itemCurrent->next;
}
}
@@ -2054,7 +2000,7 @@
}
else
{
- itemCurrent->attach(item,sbItem::NEXT);
+ itemCurrent->attach(item,DIRECTION_NEXT);
itemCurrent = itemCurrent->next;
}
}
Modified: trunk/src/SlideBible/sbList.h
===================================================================
--- trunk/src/SlideBible/sbList.h 2010-05-24 19:44:18 UTC (rev 235)
+++ trunk/src/SlideBible/sbList.h 2010-06-02 18:27:43 UTC (rev 236)
@@ -22,9 +22,7 @@
#include <swmodule.h>
#include <versekey.h>
-#include "sbBase.h"
#include "sbItem.h"
-#include "sbControl.h"
class sbList
{
Modified: trunk/src/SlideBible/sbTheme.cpp
===================================================================
--- trunk/src/SlideBible/sbTheme.cpp 2010-05-24 19:44:18 UTC (rev 235)
+++ trunk/src/SlideBible/sbTheme.cpp 2010-06-02 18:27:43 UTC (rev 236)
@@ -14,18 +14,22 @@
************************************************************************/
#include "sbTheme.h"
-#include "sbCore.h"
#include "platform\xmlParser.h"
#pragma warning(disable : 4018)
#pragma warning(disable : 4244)
-void sbTheme::init()
+sbTheme * Theme;
+
+sbTheme::sbTheme (sbRect screenArea) : rect (screenArea)
{
+ // TODO handle global Theme variable here, reinit Theme by new sbTheme
+
XMLNode xml = XMLNode::openFileHelper(".\\theme.xml");
- size = min(Core->getRect().height(), Core->getRect().width());
+ size = min(rect.height(), rect.width());
+ fadeSurface = false;
ItemSubTextColor = sbColor(xml.getChildNodeByPath("List/Item/SubText").getAttribute("color","909090FF"));
ItemMenuTextColor = sbColor(xml.getChildNodeByPath("Menu/Text" ).getAttribute("color","FFFFFFFF"));
@@ -38,7 +42,7 @@
itemMargins.top = size*atof(xml.getChildNodeByPath("List/Item/Margins").getAttribute("top", "0.01"));
itemMargins.left = size*atof(xml.getChildNodeByPath("List/Item/Margins").getAttribute("left", "0.1"));
itemMargins.bottom = size*atof(xml.getChildNodeByPath("List/Item/Margins").getAttribute("bottom","0.02"));
- itemMargins.right = size*atof(xml.getChildNodeByPath("List/Item/Margins").getAttribute("right", "0.08"));
+ itemMargins.right = size*atof(xml.getChildNodeByPath("List/Item/Margins").getAttribute("right", "0.1"));
ListSeparatorHeight = size*atof(xml.getChildNodeByPath("List/Separator").getAttribute("height","0.008"));
BannerBorderSize = size*atof(xml.getChildNodeByPath("List/Banner" ).getAttribute("border","0.03"));
@@ -55,8 +59,6 @@
e = xml.getChildNodeByPath("List/ItemSeparator/e", "<e textColor=\"FFFFFFFF\" gradient=\"1\" vertical=\"1\"><s c=\"66808AAF\"/><s c=\"90B0B8AF\"/></e>");
else if (i == ELEMENT::ITEM_HIGHLIGHTED)
e = xml.getChildNodeByPath("List/ItemHighlighted/e","<e textColor=\"141414FF\" gradient=\"1\" vertical=\"1\"><s c=\"FF55AA00\"/><s c=\"FF55AA60\"/><s c=\"FF55AA00\"/></e>");
- else if (i == ELEMENT::ITEM_PRESSED)
- e = xml.getChildNodeByPath("List/ItemHover/e", "<e textColor=\"505050FF\"><s c=\"FFFFFF00\"/></e>");//"<e textColor=\"141414FF\" gradient=\"1\" vertical=\"1\"><s c=\"FFFF0000\"/><s c=\"FFFF0060\"/><s c=\"FFFF0000\"/></e>");
else if (i == ELEMENT::SEPARATOR)
e = xml.getChildNodeByPath("List/Separator/e", "<e textColor=\"FFFFFFFF\" gradient=\"1\" vertical=\"0\"><s c=\"FFFFFF00\"/><s c=\"E0E0E080\"/><s c=\"FFFFFF00\"/></e>");
else if (i == ELEMENT::BACKGROUND)
@@ -65,8 +67,6 @@
e = xml.getChildNodeByPath("Menu/Button/e", "<e textColor=\"FFFFFFFF\" gradient=\"1\" vertical=\"1\"><s c=\"A0C0D0FF\"/><s c=\"9098A0FF\"/></e>");
else if (i == ELEMENT::ANOTHER_MENU)
e = xml.getChildNodeByPath("Menu/Another/e", "<e textColor=\"FFFFFFFF\"><s c=\"76808AFF\"/></e>");
- else if (i == ELEMENT::MENU_PRESSED)
- e = xml.getChildNodeByPath("Menu/ButtonPressed/e", "<e textColor=\"141414FF\" gradient=\"1\" vertical=\"1\"><s c=\"CBDADDFF\"/><s c=\"FFFFFFFF\"/></e>");
else if (i == ELEMENT::PANEL)
e = xml.getChildNodeByPath("Panel/e", "<e textColor=\"F4F4F4FF\" gradient=\"1\" vertical=\"1\"><s c=\"808080FF\"/><s c=\"808080FF\" p=\"50\"/><s c=\"90B0B8FF\" p=\"50\"/><s c=\"36404AFF\"/></e>");
else if (i == ELEMENT::PANEL_PRESSED)
@@ -130,29 +130,15 @@
styles[STYLE::TEXT_FOOTNOTE].font = sbMakeFont(styles[STYLE::STANZA].TEXT_FOOTNOTE,tfont, true, false);
delete [] tfont;
-
- // cache background
- //listBackground = sbSurfaceCreate(max(Core->getRect().width(),Core->getRect().height()),max(Core->getRect().width(),Core->getRect().height()));
-
- //drawElement(listBackground,&sbRect(Core->getRect().left,Core->getRect().top,Core->getRect().right,Core->getRect().bottom-PanelSize),ELEMENT::BACKGROUND);
- //drawElement(listBackground,&sbRect(Core->getRect().left,Core->getRect().bottom-PanelSize,Core->getRect().right,Core->getRect().bottom),ELEMENT::PANEL);
}
sbTheme::~sbTheme()
{
for (int i=0; i < STYLE::COUNT; i++) sbDeleteFont (styles[i].font);
-
- if (listBackground != NULL) sbSurfaceDestroy(listBackground);
}
void sbTheme::drawElement ( sbSurface rc , const sbRect * rect , sbTheme::ELEMENT::TYPE type ) const
{
- //if (rc != listBackground && !Core->fadeSurface && (type == ELEMENT::BACKGROUND || type == ELEMENT::PANEL))
- //{
- // sbBitBlt(rc,*rect,listBackground,sbPoint(rect->left,rect->top));
- // return;
- //}
-
for (int i = 0; i < elements[type].fill.size(); i++)
{
sbColor start = elements[type].fill[i].first;
@@ -190,8 +176,6 @@
{
if (elements[sbTheme::ELEMENT::BACKGROUND].fill.size() == 2)
{
- const sbRect rect = Core->getRect();
-
unsigned char r1 = elements[sbTheme::ELEMENT::BACKGROUND].fill[0].first.red;
unsigned char g1 = elements[sbTheme::ELEMENT::BACKGROUND].fill[0].first.green;
unsigned char b1 = elements[sbTheme::ELEMENT::BACKGROUND].fill[0].first.blue;
@@ -215,7 +199,8 @@
}
}
- if (Core->fadeSurface)
+ // TODO move fadeSurface to sbTheme
+ if (fadeSurface)
{
newColor.red = FadingColor.red + ((newColor.red - FadingColor.red) * FadingColor.alpha / 255);
newColor.green = FadingColor.green + ((newColor.green - FadingColor.green) * FadingColor.alpha / 255);
@@ -230,6 +215,7 @@
int x1 = rect->left, y1 = rect->top, x2 = rect->right, y2 = rect->bottom, round = size*0.04f;
sbColor color = fadeColor(SelectionFrameColor,x1,y1);
+ // TODO made inside for-cycle
sbDrawLine(surface, sbPoint(x1+round,y1), sbPoint(x2-round,y1),color,SelectionFrameWidth);
sbDrawLine(surface, sbPoint(x2-round,y1), sbPoint(x2-(round/3),y1+(round/3)),color,SelectionFrameWidth);
sbDrawLine(surface, sbPoint(x2-(round/3),y1+(round/3)), sbPoint(x2,y1+round),color,SelectionFrameWidth);
Modified: trunk/src/SlideBible/sbTheme.h
===================================================================
--- trunk/src/SlideBible/sbTheme.h 2010-05-24 19:44:18 UTC (rev 235)
+++ trunk/src/SlideBible/sbTheme.h 2010-06-02 18:27:43 UTC (rev 236)
@@ -22,11 +22,9 @@
class sbTheme
{
public:
-
- sbTheme(){};
+ sbTheme(sbRect screenArea);
~sbTheme();
-
- void init ();
+
sbColor fadeColor ( const sbColor & color, int x, int y ) const;
sbColor ItemSubTextColor;
@@ -61,11 +59,11 @@
struct ELEMENT
{
+ // TODO states : normal, inactive, highlighted, hover, hover+highlighted
+
enum TYPE
{
ITEM = 0,
- //ITEM_SELECTED,
- ITEM_PRESSED,
ITEM_HIGHLIGHTED,
ITEM_SEPARATOR,
SEPARATOR,
@@ -73,21 +71,14 @@
TAPPED,
PANEL,
PANEL_PRESSED,
- //PANEL_SELECTED,
MENU,
- MENU_PRESSED,
ANOTHER_MENU,
- //MENU_SELECTED,
BANNER,
COUNT
};
std::vector<std::pair<sbColor,short>> fill; // short - gradients vertical/horizontal sparation in range 0-1000
- //sbBitmap bitmap;
-
- //bool haveBitmap; // have bitmap
-
bool vertical;
bool gradient;
bool stretch;
@@ -106,11 +97,14 @@
int PanelSize;
int SelectionFrameWidth;
+ const sbRect rect;
+ bool fadeSurface;
+
int size; // screen minimal dimension, determine font and control sizes
sbRect itemMargins;
-
- sbSurface listBackground;
};
+extern sbTheme * Theme;
+
#endif
Modified: trunk/src/SlideBible/todo.txt
===================================================================
--- trunk/src/SlideBible/todo.txt 2010-05-24 19:44:18 UTC (rev 235)
+++ trunk/src/SlideBible/todo.txt 2010-06-02 18:27:43 UTC (rev 236)
@@ -1,52 +1,62 @@
-ALPHA
-+ combining unicode accents, like accute, should be in platform-dependent part [I don't know how it's fixed]
-+ 2. Ïàðàëèïîìå\níîí\n4 in chapter title
-+ text retriveing stopped on empty verses
-+ close menus on fail-click
-+ limit history
-+ currentVerse from defaultModule
-+ perfomance optimization: sbItem caching, can work only if background is solid
-+ banner showing current place make as sbItem
-+ Global Options switch in one module cause switch in another
- do not break lines if there is only one character on the next line.
+KALEMAS:
module manager
- raise connection
+ reinit Sword
+ message boxes before installing module
+ installManager data in special folder
module features
+ options dialog
++ strongs and morphs
++ option sbItem with text like "Strongs: On" + option value enumeration
+ search
++ input text items
++ sip control
++ range selection
++ menus in PlaceSelection dialog: Search From | Search To
++ sometime DrawCache mix up items
++ line breaks. do not break lines if there is only one character on the next line.
++ sbItem::getItem (sbDirection) global directions NEXT, PREV, LEFT, RIGHT
++ better enumeration of modules in module selection and module installer
++ warning war - clean build log from warnings
+================================================================================
+ create patch for ftplibt
+ ring sensor support
+ panel on sbItem
+ scrollbar
+ count list height, if listStartConstructed and listEndConstructed
+ proper method to scroll list
+ module manager
+ raise connection
+ module features
words of Christ in red
-+ strongs and morphs
headings
cross-references
footnotes
-+ option sbItem with text like "Strongs: On" + option value enumeration
search
clucence
-+ input text items
-+ sip control
- cursor
- range selection
- menus in PlaceSelection dialog: Search From | Search To
- request encoding ?
+ input item cursor drawing
lexicon / dictionary modules
testament persitence check
better strongs/morphs placement in sbItem text
- sbItem::getItem (sbDirection)
- global directions NEXT, PREV, LEFT, RIGHT
- sometime DrawCache mix up items
+ bug with onMouse:Move,Y=0
+ move DrawCache to sbItem, make prepare() call in another way
+ message boxes on sbItem
+ keypad navigation
+ mouse tapping on item in container
+ scroll item (tooltip for example)
+ switch sword to utf8 locale, fix skipped languages (hu)
+ drawing of two long long long items on screen reduce fps, i thik i need to optimize draw system
XNA port
+
loading all locales takes too long
even on win32
also look into xiphos dirent.cpp
- maybe deploy packages for only language
- warning war - clean build log from warnings
+ maybe deploy packages for only one language (ex. slidebible_ru.cab with RusSynodal module default)
controls, pressed/released
volume +/- scroll half of screen, long press linvolve cinetic scroll with increasing speed, zoom-/+ scroll as mouse scroll
+ proper sbList scrollin method
built-in theme
version tag in theme xml
if version == 0 - always replace
@@ -59,9 +69,6 @@
? add | edit annotation
internationalization
gettext support
- scrollbar
- count list height, if listStartConstructed and listEndConstructed
- proper method to scroll list
Framework Improvements
named constructors for sbItem
@@ -69,20 +76,30 @@
remove sbControl
sbItem * sbList::panel
sbItem * sbList::menu
+ sbItemContainer
+ sbPoint position
sbList::BOUND sbList::before,after {pixels,lastItem,numItems,finished}
wait mode
- sbWaitMode ( const TCHAR * )
- search accepts void (*precent) (char , void *)
- module installer - ?
+ a. search accepts void (*precent) (char , void *)
+ b. module installer - ?
+ 1. call in back thread
+ 2. receive messages on progress update
+ interface element, displaying progress and cancel button
menus based on sbList
? divide from backend
+
+ move DrawCache to sbItem
+? how to call sbDrawCache:;prepare()
+
+
BETA
to test
other locales, utf encoding
locale paths
other language modules:
Hebrew
+ right alignment for verse items
Greek
1.1 RELEASE
@@ -103,16 +120,14 @@
date created (for sorting)
place in uri format (sword://Module/Key)
static / dynamic
-
-
-
-1.2 RELEASE
icons and graphics
graphics theme uses large png file
remove built-in theme, application will not run if theme not found
unlock locked modules
-1.3 RELEASE
+
+
+1.2 RELEASE
re-concept interface
More information about the sword-cvs
mailing list