You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(92) |
Dec
(141) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(126) |
Feb
(72) |
Mar
(31) |
Apr
(200) |
May
(81) |
Jun
(130) |
Jul
(112) |
Aug
(134) |
Sep
(76) |
Oct
(89) |
Nov
(153) |
Dec
(9) |
2007 |
Jan
(59) |
Feb
(82) |
Mar
(50) |
Apr
(20) |
May
(9) |
Jun
(81) |
Jul
(41) |
Aug
(109) |
Sep
(91) |
Oct
(87) |
Nov
(33) |
Dec
(60) |
2008 |
Jan
(21) |
Feb
(15) |
Mar
(38) |
Apr
(75) |
May
(59) |
Jun
(46) |
Jul
(30) |
Aug
(20) |
Sep
(35) |
Oct
(32) |
Nov
(34) |
Dec
(19) |
2009 |
Jan
(29) |
Feb
(71) |
Mar
(54) |
Apr
(17) |
May
(4) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(58) |
Sep
(7) |
Oct
(7) |
Nov
(12) |
Dec
(18) |
2011 |
Jan
(17) |
Feb
(29) |
Mar
(11) |
Apr
(5) |
May
(1) |
Jun
|
Jul
|
Aug
(11) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(87) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(44) |
Jun
(79) |
Jul
(16) |
Aug
(31) |
Sep
|
Oct
(51) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Paul F. <pg...@us...> - 2006-11-04 17:23:38
|
Update of /cvsroot/roadmap/roadmap/src/gtk2 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv29173/gtk2 Modified Files: roadmap_dialog.c Log Message: add support for hidden dialog data, to allow invisible context to be carried along with the dialog. Index: roadmap_dialog.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/gtk2/roadmap_dialog.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** roadmap_dialog.c 7 Dec 2005 01:07:32 -0000 1.16 --- roadmap_dialog.c 4 Nov 2006 17:22:45 -0000 1.17 *************** *** 50,53 **** --- 50,54 ---- #define ROADMAP_WIDGET_LIST 4 #define ROADMAP_WIDGET_LABEL 5 + #define ROADMAP_WIDGET_HIDDEN 6 enum { *************** *** 277,280 **** --- 278,286 ---- child = roadmap_dialog_get (parent, name); + if (w == NULL) { + child->w = w; + return child; + } + if (parent->w == NULL) { *************** *** 406,409 **** --- 412,420 ---- } + void roadmap_dialog_new_hidden (const char *frame, const char *name) { + RoadMapDialogItem child = roadmap_dialog_new_item (frame, name, 0, 0); + + child->widget_type = ROADMAP_WIDGET_HIDDEN; + } void roadmap_dialog_new_choice (const char *frame, |
From: Paul F. <pg...@us...> - 2006-11-03 14:42:32
|
Update of /cvsroot/roadmap/roadmap/src/qt In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv27046 Modified Files: qt_canvas.cc qt_canvas.h qt_dialog.cc qt_dialog.h qt_fileselection.cc qt_fileselection.h qt_main.cc qt_main.h roadmap_canvas.cc roadmap_dialog.cc roadmap_fileselection.cc roadmap_main.cc roadmap_messagebox.cc Log Message: whitespace changes only: eliminate tabs, after setting the tabstop to 3. code is all much more legible now. Index: qt_main.cc =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/qt_main.cc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** qt_main.cc 3 Jul 2006 01:30:49 -0000 1.11 --- qt_main.cc 3 Nov 2006 14:42:15 -0000 1.12 *************** *** 29,93 **** // Implementation of RMapInput class RMapInput::RMapInput(int fd1, RoadMapQtInput cb) { ! fd = fd1; ! callback = cb; ! nf = new QSocketNotifier(fd, QSocketNotifier::Read, 0); ! connect(nf, SIGNAL(activated(int)), this, SLOT(fire(int))); } RMapInput::~RMapInput() { ! if (nf) { ! delete nf; ! nf = 0; ! } } void RMapInput::fire(int s) { ! if (callback != 0) { ! callback(s); ! } } // Implementation of RMapCallback class RMapCallback::RMapCallback(RoadMapCallback cb) { ! callback = cb; } void RMapCallback::fire() { ! if (callback != 0) { ! callback(); ! } } int RMapCallback::same(RoadMapCallback cb) { ! return (callback == cb); } // Implementation of RMapMainWindow class RMapMainWindow::RMapMainWindow(const char* name, int width, int height) : QMainWindow(0, name) { ! spacePressed = false; ! for (int i = 0 ; i < ROADMAP_MAX_TIMER; ++i) { ! tm[i] = 0; ! tcb[i] = 0; ! } ! setCaption(QString::fromUtf8(name)); ! canvas = new RMapCanvas(this); ! setCentralWidget(canvas); ! canvas->setFocus(); ! setToolBarsMovable(FALSE); ! resize(width,height); toolBar = 0; } RMapMainWindow::~RMapMainWindow() { ! QMap<int, RMapInput*>::Iterator it; ! for(it = inputMap.begin(); it != inputMap.end(); ++it) { ! delete it.data(); ! inputMap.remove(it); ! } } void RMapMainWindow::setKeyboardCallback(RoadMapKeyInput c) { ! keyCallback = c; } --- 29,93 ---- // Implementation of RMapInput class RMapInput::RMapInput(int fd1, RoadMapQtInput cb) { ! fd = fd1; ! callback = cb; ! nf = new QSocketNotifier(fd, QSocketNotifier::Read, 0); ! connect(nf, SIGNAL(activated(int)), this, SLOT(fire(int))); } RMapInput::~RMapInput() { ! if (nf) { ! delete nf; ! nf = 0; ! } } void RMapInput::fire(int s) { ! if (callback != 0) { ! callback(s); ! } } // Implementation of RMapCallback class RMapCallback::RMapCallback(RoadMapCallback cb) { ! callback = cb; } void RMapCallback::fire() { ! if (callback != 0) { ! callback(); ! } } int RMapCallback::same(RoadMapCallback cb) { ! return (callback == cb); } // Implementation of RMapMainWindow class RMapMainWindow::RMapMainWindow(const char* name, int width, int height) : QMainWindow(0, name) { ! spacePressed = false; ! for (int i = 0 ; i < ROADMAP_MAX_TIMER; ++i) { ! tm[i] = 0; ! tcb[i] = 0; ! } ! setCaption(QString::fromUtf8(name)); ! canvas = new RMapCanvas(this); ! setCentralWidget(canvas); ! canvas->setFocus(); ! setToolBarsMovable(FALSE); ! resize(width,height); toolBar = 0; } RMapMainWindow::~RMapMainWindow() { ! QMap<int, RMapInput*>::Iterator it; ! for(it = inputMap.begin(); it != inputMap.end(); ++it) { ! delete it.data(); ! inputMap.remove(it); ! } } void RMapMainWindow::setKeyboardCallback(RoadMapKeyInput c) { ! keyCallback = c; } *************** *** 95,99 **** QPopupMenu *RMapMainWindow::newMenu(const char *title) { ! return new QPopupMenu(this, title); } --- 95,99 ---- QPopupMenu *RMapMainWindow::newMenu(const char *title) { ! return new QPopupMenu(this, title); } *************** *** 105,109 **** void RMapMainWindow::addMenu(QPopupMenu *menu, const char* label) { ! menuBar()->insertItem(label, menu); } --- 105,109 ---- void RMapMainWindow::addMenu(QPopupMenu *menu, const char* label) { ! menuBar()->insertItem(label, menu); } *************** *** 120,136 **** RoadMapCallback callback) { ! RMapCallback* cb = new RMapCallback(callback); ! menu->insertItem(label, cb, SLOT(fire())); } void RMapMainWindow::addMenuSeparator(QPopupMenu *menu) { ! menu->insertSeparator(); } void RMapMainWindow::addToolbar(const char* orientation) { ! if (toolBar == 0) { ! toolBar = new QToolBar(this, "map view"); #ifndef QWS // moveDockWindow not available on QtE v2.3.10. --- 120,136 ---- RoadMapCallback callback) { ! RMapCallback* cb = new RMapCallback(callback); ! menu->insertItem(label, cb, SLOT(fire())); } void RMapMainWindow::addMenuSeparator(QPopupMenu *menu) { ! menu->insertSeparator(); } void RMapMainWindow::addToolbar(const char* orientation) { ! if (toolBar == 0) { ! toolBar = new QToolBar(this, "map view"); #ifndef QWS // moveDockWindow not available on QtE v2.3.10. *************** *** 152,158 **** } #endif ! toolBar->setFocusPolicy(QWidget::NoFocus); ! toolBar->setHorizontalStretchable(TRUE); ! } } --- 152,158 ---- } #endif ! toolBar->setFocusPolicy(QWidget::NoFocus); ! toolBar->setHorizontalStretchable(TRUE); ! } } *************** *** 163,174 **** #ifndef QWS ! // For some unknown reason, this toolbar crashes RoadMap ! // on the Sharp Zaurus. // This should be fixed and the ifndef removed. // Pascal: I believe this has been fixed now. ! if (toolBar == 0) { ! addToolbar(""); ! } if (label != NULL) { --- 163,174 ---- #ifndef QWS ! // For some unknown reason, this toolbar crashes RoadMap ! // on the Sharp Zaurus. // This should be fixed and the ifndef removed. // Pascal: I believe this has been fixed now. ! if (toolBar == 0) { ! addToolbar(""); ! } if (label != NULL) { *************** *** 188,203 **** } #endif ! } void RMapMainWindow::addToolSpace(void) { #ifndef QWS ! // For some unknown reason, this toolbar crashes RoadMap ! // on the Sharp Zaurus. This should be fixed and the ifndef ! // removed. addTool (NULL, NULL, NULL, NULL); ! toolBar->addSeparator(); #endif } --- 188,203 ---- } #endif ! } void RMapMainWindow::addToolSpace(void) { #ifndef QWS ! // For some unknown reason, this toolbar crashes RoadMap ! // on the Sharp Zaurus. This should be fixed and the ifndef ! // removed. addTool (NULL, NULL, NULL, NULL); ! toolBar->addSeparator(); #endif } *************** *** 205,336 **** void RMapMainWindow::addCanvas(void) { ! canvas->configure(); ! adjustSize(); } void RMapMainWindow::addInput(int fd, RoadMapQtInput callback) { ! RMapInput* rmi = new RMapInput(fd, callback); ! inputMap.insert(fd, rmi); } void RMapMainWindow::removeInput(int fd) { ! RMapInput* rmi = inputMap[fd]; ! if (rmi != 0) { ! inputMap.remove(fd); ! delete rmi; ! } } void RMapMainWindow::setStatus(const char* text) { ! statusBar()->message(text); } void RMapMainWindow::keyReleaseEvent(QKeyEvent* event) { ! int k = event->key(); ! if (k == ' ') { ! spacePressed = false; ! } ! event->accept(); } void RMapMainWindow::keyPressEvent(QKeyEvent* event) { ! char* key = 0; ! char regular_key[2]; ! int k = event->key(); ! switch (k) { ! case ' ': ! spacePressed = true; ! break; ! case Key_Left: ! if (spacePressed) { ! key = "Button-Calendar"; ! } else { ! key = "Button-Left"; ! } ! break; ! case Key_Right: ! if (spacePressed) { ! key = "Button-Contact"; ! } else { ! key = "Button-Right"; ! } ! break; ! case Key_Up: ! key = "Button-Up"; ! break; ! case Key_Down: ! key = "Button-Down"; ! break; ! default: ! if (k>0 && k<128) { ! regular_key[0] = k; ! regular_key[1] = 0; ! key = regular_key; ! } ! } ! if (key!=0 && keyCallback!=0) { ! keyCallback(key); ! } ! event->accept(); } void RMapMainWindow::closeEvent(QCloseEvent* ev) { ! roadmap_main_exit(); ! ev->accept(); } void RMapMainWindow::setTimer(int interval, RoadMapCallback callback) { ! int empty = -1; ! for (int i = 0; i < ROADMAP_MAX_TIMER; ++i) { ! if (tm[i] == 0) { ! empty = i; ! } else if (tcb[i]->same(callback)) { ! return; ! } ! } ! if (empty < 0) { ! roadmap_log (ROADMAP_ERROR, "too many timers"); ! } ! tm[empty] = new QTimer(this); ! tcb[empty] = new RMapCallback(callback); ! connect(tm[empty], SIGNAL(timeout()), tcb[empty], SLOT(fire())); ! tm[empty]->start(interval, FALSE); } void RMapMainWindow::removeTimer(RoadMapCallback callback) { ! int found = -1; ! for (int i = 0; i < ROADMAP_MAX_TIMER; ++i) { ! if (tcb[i] != 0) { ! if (tcb[i]->same(callback)) { ! found = i; ! break; ! } ! } ! } ! if (found < 0) return; ! tm[found]->stop(); ! delete tm[found]; ! delete tcb[found]; ! tm[found] = 0; ! tcb[found] = 0; } --- 205,336 ---- void RMapMainWindow::addCanvas(void) { ! canvas->configure(); ! adjustSize(); } void RMapMainWindow::addInput(int fd, RoadMapQtInput callback) { ! RMapInput* rmi = new RMapInput(fd, callback); ! inputMap.insert(fd, rmi); } void RMapMainWindow::removeInput(int fd) { ! RMapInput* rmi = inputMap[fd]; ! if (rmi != 0) { ! inputMap.remove(fd); ! delete rmi; ! } } void RMapMainWindow::setStatus(const char* text) { ! statusBar()->message(text); } void RMapMainWindow::keyReleaseEvent(QKeyEvent* event) { ! int k = event->key(); ! if (k == ' ') { ! spacePressed = false; ! } ! event->accept(); } void RMapMainWindow::keyPressEvent(QKeyEvent* event) { ! char* key = 0; ! char regular_key[2]; ! int k = event->key(); ! switch (k) { ! case ' ': ! spacePressed = true; ! break; ! case Key_Left: ! if (spacePressed) { ! key = "Button-Calendar"; ! } else { ! key = "Button-Left"; ! } ! break; ! case Key_Right: ! if (spacePressed) { ! key = "Button-Contact"; ! } else { ! key = "Button-Right"; ! } ! break; ! case Key_Up: ! key = "Button-Up"; ! break; ! case Key_Down: ! key = "Button-Down"; ! break; ! default: ! if (k>0 && k<128) { ! regular_key[0] = k; ! regular_key[1] = 0; ! key = regular_key; ! } ! } ! if (key!=0 && keyCallback!=0) { ! keyCallback(key); ! } ! event->accept(); } void RMapMainWindow::closeEvent(QCloseEvent* ev) { ! roadmap_main_exit(); ! ev->accept(); } void RMapMainWindow::setTimer(int interval, RoadMapCallback callback) { ! int empty = -1; ! for (int i = 0; i < ROADMAP_MAX_TIMER; ++i) { ! if (tm[i] == 0) { ! empty = i; ! } else if (tcb[i]->same(callback)) { ! return; ! } ! } ! if (empty < 0) { ! roadmap_log (ROADMAP_ERROR, "too many timers"); ! } ! tm[empty] = new QTimer(this); ! tcb[empty] = new RMapCallback(callback); ! connect(tm[empty], SIGNAL(timeout()), tcb[empty], SLOT(fire())); ! tm[empty]->start(interval, FALSE); } void RMapMainWindow::removeTimer(RoadMapCallback callback) { ! int found = -1; ! for (int i = 0; i < ROADMAP_MAX_TIMER; ++i) { ! if (tcb[i] != 0) { ! if (tcb[i]->same(callback)) { ! found = i; ! break; ! } ! } ! } ! if (found < 0) return; ! tm[found]->stop(); ! delete tm[found]; ! delete tcb[found]; ! tm[found] = 0; ! tcb[found] = 0; } Index: qt_fileselection.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/qt_fileselection.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** qt_fileselection.h 27 Mar 2003 05:35:43 -0000 1.1 --- qt_fileselection.h 3 Nov 2006 14:42:15 -0000 1.2 *************** *** 49,76 **** public: ! FileSelector(QWidget* parent, const char* title, const char* filter, ! const char* path, const char* mode, RoadMapFileCallback cb); ! ~FileSelector(); protected: ! QComboBox* dirList; ! QListView* fileList; ! QLineEdit* fileEdit; ! // QPushButton* okButton; ! // QPishButton* cancelButton; ! QDir currentDir; ! QFile currentFile; ! RoadMapFileCallback callback; ! QString filter; ! const char* mode; ! void populateList(); ! virtual void resizeEvent(QResizeEvent*); protected slots: ! void onDirSelect(const QString& dir); ! void onFileSelect(QListViewItem* lvi); ! void accept(); }; --- 49,76 ---- public: ! FileSelector(QWidget* parent, const char* title, const char* filter, ! const char* path, const char* mode, RoadMapFileCallback cb); ! ~FileSelector(); protected: ! QComboBox* dirList; ! QListView* fileList; ! QLineEdit* fileEdit; ! // QPushButton* okButton; ! // QPishButton* cancelButton; ! QDir currentDir; ! QFile currentFile; ! RoadMapFileCallback callback; ! QString filter; ! const char* mode; ! void populateList(); ! virtual void resizeEvent(QResizeEvent*); protected slots: ! void onDirSelect(const QString& dir); ! void onFileSelect(QListViewItem* lvi); ! void accept(); }; Index: roadmap_fileselection.cc =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/roadmap_fileselection.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_fileselection.cc 27 Mar 2003 05:35:43 -0000 1.1 --- roadmap_fileselection.cc 3 Nov 2006 14:42:15 -0000 1.2 *************** *** 33,66 **** void roadmap_fileselection_new (const char *title, const char *filter, ! const char *path, const char *mode, RoadMapFileCallback callback) { #ifdef QWS ! FileSelector fselect(mainWindow, title, filter, path, ! mode, callback); ! fselect.exec(); #else ! QFileDialog *dlg = new QFileDialog( path, QString::null, 0, 0, TRUE ); ! dlg->setCaption( QFileDialog::tr( title ) ); ! if (mode[0] == 'w') { ! dlg->setMode( QFileDialog::AnyFile ); ! } else { ! dlg->setMode( QFileDialog::ExistingFile ); ! } ! if ( dlg->exec() == QDialog::Accepted ) { ! QString result; ! result = dlg->selectedFile(); ! delete dlg; ! callback (result, mode); ! } else { ! delete dlg; ! } #endif } --- 33,66 ---- void roadmap_fileselection_new (const char *title, const char *filter, ! const char *path, const char *mode, RoadMapFileCallback callback) { #ifdef QWS ! FileSelector fselect(mainWindow, title, filter, path, ! mode, callback); ! fselect.exec(); #else ! QFileDialog *dlg = new QFileDialog( path, QString::null, 0, 0, TRUE ); ! dlg->setCaption( QFileDialog::tr( title ) ); ! if (mode[0] == 'w') { ! dlg->setMode( QFileDialog::AnyFile ); ! } else { ! dlg->setMode( QFileDialog::ExistingFile ); ! } ! if ( dlg->exec() == QDialog::Accepted ) { ! QString result; ! result = dlg->selectedFile(); ! delete dlg; ! callback (result, mode); ! } else { ! delete dlg; ! } #endif } Index: qt_dialog.cc =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/qt_dialog.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** qt_dialog.cc 3 Dec 2005 03:25:18 -0000 1.6 --- qt_dialog.cc 3 Nov 2006 14:42:15 -0000 1.7 *************** *** 31,35 **** // Implementation of RMapDialog class RMapDialog::RMapDialog(QWidget* parent, const char* name):QDialog(parent, name) { ! setCaption(name); } --- 31,35 ---- // Implementation of RMapDialog class RMapDialog::RMapDialog(QWidget* parent, const char* name):QDialog(parent, name) { ! setCaption(name); } *************** *** 38,86 **** QList<Entry>* RMapDialog::getFrame(QString frameName) { ! QList<Entry>* frame = frames[frameName]; ! if (frame == 0) { ! frame = new QList<Entry>; ! frameNames.append(new QString(frameName)); ! frames.insert(frameName, frame); ! } ! return frame; } Entry* RMapDialog::getEntry(QString frameName, QString entryName) { ! QList<Entry>* frame = frames[frameName]; ! if (frame == 0) { ! return 0; ! } ! Entry* entry; ! for(entry = frame->first(); entry != 0; entry = frame->next()) { ! if (entry->getName() == entryName) { ! break; ! } ! } ! return entry; } void RMapDialog::addTextEntry(const char* frameName, const char* name) { ! QList<Entry>* frame = getFrame(frameName); ! Entry* entry = new Entry(this, Entry::TextEntry, name); ! frame->append(entry); } void RMapDialog::addLabelEntry(const char* frameName, const char* name) { ! QList<Entry>* frame = getFrame(frameName); ! Entry* entry = new Entry(this, Entry::LabelEntry, name); ! frame->append(entry); } void RMapDialog::addColorEntry(const char* frameName, const char* name) { ! addTextEntry(frameName, name); } --- 38,86 ---- QList<Entry>* RMapDialog::getFrame(QString frameName) { ! QList<Entry>* frame = frames[frameName]; ! if (frame == 0) { ! frame = new QList<Entry>; ! frameNames.append(new QString(frameName)); ! frames.insert(frameName, frame); ! } ! return frame; } Entry* RMapDialog::getEntry(QString frameName, QString entryName) { ! QList<Entry>* frame = frames[frameName]; ! if (frame == 0) { ! return 0; ! } ! Entry* entry; ! for(entry = frame->first(); entry != 0; entry = frame->next()) { ! if (entry->getName() == entryName) { ! break; ! } ! } ! return entry; } void RMapDialog::addTextEntry(const char* frameName, const char* name) { ! QList<Entry>* frame = getFrame(frameName); ! Entry* entry = new Entry(this, Entry::TextEntry, name); ! frame->append(entry); } void RMapDialog::addLabelEntry(const char* frameName, const char* name) { ! QList<Entry>* frame = getFrame(frameName); ! Entry* entry = new Entry(this, Entry::LabelEntry, name); ! frame->append(entry); } void RMapDialog::addColorEntry(const char* frameName, const char* name) { ! addTextEntry(frameName, name); } *************** *** 93,210 **** RoadMapDialogCallback callback) { ! QList<Entry>* frame = getFrame(frameName); ! QVector<Item> items(count); ! for(int i = 0; i < count; i++) { ! Item* item = new Item(); ! item->label = labels[i]; ! item->value = values[i]; ! items.insert(i, item); ! } ! Entry* entry = new Entry(this, Entry::ChoiceEntry, name, items, current, callback); ! frame->append(entry); } void RMapDialog::addListEntry(const char* frameName, const char* name) { ! QList<Entry>* frame = getFrame(frameName); ! Entry* entry = new Entry(this, Entry::ListEntry, name); ! frame->append(entry); } void RMapDialog::setListEntryValues(const char* frameName, const char* name, ! int count, char** labels, void** values, RoadMapDialogCallback callback) { ! Entry* entry = getEntry(frameName, name); ! if (entry == 0) { ! return; ! } ! QVector<Item> items(count); ! for(int i = 0; i < count; i++) { ! Item* item = new Item(); ! item->label = labels[i]; ! item->value = values[i]; ! items.insert(i, item); ! } ! entry->setValues(items, callback); } void RMapDialog::addButton(char* label, RoadMapDialogCallback callback) { ! QVector<Item> items; ! Entry* entry = new Entry(this, Entry::ButtonEntry, label, items, 0, callback); ! buttons.append(entry); } void RMapDialog::complete(int) { ! QVBoxLayout* main = new QVBoxLayout(this); ! QWidget* topw = 0; ! main->setSpacing(4); ! main->setMargin(2); ! if (frames.count() > 1) { ! QTabWidget* tw = new QTabWidget(this); ! for(QString* name = frameNames.first(); name != 0; ! name = frameNames.next()) { ! QList<Entry>* frame = frames[*name]; ! QWidget* w = new QWidget(tw); ! initTab(w, frame); ! tw->addTab(w, *name); ! } ! topw = tw; ! } else { ! topw = new QWidget(this); ! initTab(topw, *frames.begin()); ! } ! QWidget* bw = new QWidget(this); ! QHBoxLayout* btns = new QHBoxLayout(bw); ! for(Entry* entry = buttons.first(); entry != 0; entry = buttons.next()) { ! QWidget* w = entry->create(bw); ! btns->addWidget(w); ! } ! main->addWidget(topw); ! main->addWidget(bw); ! adjustSize(); ! show(); } void* RMapDialog::getEntryValue(const char* frame, const char* name) { ! Entry* entry = getEntry(frame, name); ! if (entry == 0) { ! return 0; ! } ! return entry->getValue(); } void RMapDialog::setEntryValue(const char* frame, const char* name, const void* data) { ! Entry* entry = getEntry(frame, name); ! if (entry == 0) { ! return; ! } ! return entry->setValue(data); } void RMapDialog::initTab(QWidget* tab, QList<Entry>* entries) { ! QGridLayout* grid = new QGridLayout(tab, entries->count(), 2, 2, 5); ! int i = 0; for(Entry* entry = entries->first(); entry != 0; entry = entries->next(), i++) { ! QWidget* w = entry->create(tab); ! QLabel* l; if (entry->getName()[0] == '.') { --- 93,210 ---- RoadMapDialogCallback callback) { ! QList<Entry>* frame = getFrame(frameName); ! QVector<Item> items(count); ! for(int i = 0; i < count; i++) { ! Item* item = new Item(); ! item->label = labels[i]; ! item->value = values[i]; ! items.insert(i, item); ! } ! Entry* entry = new Entry(this, Entry::ChoiceEntry, name, items, current, callback); ! frame->append(entry); } void RMapDialog::addListEntry(const char* frameName, const char* name) { ! QList<Entry>* frame = getFrame(frameName); ! Entry* entry = new Entry(this, Entry::ListEntry, name); ! frame->append(entry); } void RMapDialog::setListEntryValues(const char* frameName, const char* name, ! int count, char** labels, void** values, RoadMapDialogCallback callback) { ! Entry* entry = getEntry(frameName, name); ! if (entry == 0) { ! return; ! } ! QVector<Item> items(count); ! for(int i = 0; i < count; i++) { ! Item* item = new Item(); ! item->label = labels[i]; ! item->value = values[i]; ! items.insert(i, item); ! } ! entry->setValues(items, callback); } void RMapDialog::addButton(char* label, RoadMapDialogCallback callback) { ! QVector<Item> items; ! Entry* entry = new Entry(this, Entry::ButtonEntry, label, items, 0, callback); ! buttons.append(entry); } void RMapDialog::complete(int) { ! QVBoxLayout* main = new QVBoxLayout(this); ! QWidget* topw = 0; ! main->setSpacing(4); ! main->setMargin(2); ! if (frames.count() > 1) { ! QTabWidget* tw = new QTabWidget(this); ! for(QString* name = frameNames.first(); name != 0; ! name = frameNames.next()) { ! QList<Entry>* frame = frames[*name]; ! QWidget* w = new QWidget(tw); ! initTab(w, frame); ! tw->addTab(w, *name); ! } ! topw = tw; ! } else { ! topw = new QWidget(this); ! initTab(topw, *frames.begin()); ! } ! QWidget* bw = new QWidget(this); ! QHBoxLayout* btns = new QHBoxLayout(bw); ! for(Entry* entry = buttons.first(); entry != 0; entry = buttons.next()) { ! QWidget* w = entry->create(bw); ! btns->addWidget(w); ! } ! main->addWidget(topw); ! main->addWidget(bw); ! adjustSize(); ! show(); } void* RMapDialog::getEntryValue(const char* frame, const char* name) { ! Entry* entry = getEntry(frame, name); ! if (entry == 0) { ! return 0; ! } ! return entry->getValue(); } void RMapDialog::setEntryValue(const char* frame, const char* name, const void* data) { ! Entry* entry = getEntry(frame, name); ! if (entry == 0) { ! return; ! } ! return entry->setValue(data); } void RMapDialog::initTab(QWidget* tab, QList<Entry>* entries) { ! QGridLayout* grid = new QGridLayout(tab, entries->count(), 2, 2, 5); ! int i = 0; for(Entry* entry = entries->first(); entry != 0; entry = entries->next(), i++) { ! QWidget* w = entry->create(tab); ! QLabel* l; if (entry->getName()[0] == '.') { *************** *** 215,353 **** grid->addWidget(w, i, 1); } ! } } void RMapDialog::setContext(void* ctx) { ! context = ctx; } // Implementation of Entry class Entry::Entry(RMapDialog* dlg, int etype, QString ename) { ! dialog = dlg; ! type = etype; ! name = ename; ! callback = 0; ! widget = 0; current = 0; } Entry::Entry(RMapDialog* dlg, int etype, QString ename, QVector<Item>& eitems, ! int ecurrent, RoadMapDialogCallback ecallback) { ! dialog = dlg; ! type = etype; ! name = ename; current = ecurrent; ! callback = ecallback; ! items.resize(eitems.count()); ! for(uint i = 0; i < eitems.count(); i++) { ! items.insert(i, eitems[i]); ! } } Entry::~Entry() { ! for(uint i = 0; i < items.count(); i++) { ! delete items[i]; ! } } QWidget* Entry::create(QWidget* parent) { ! widget = 0; ! ! switch (type) { ! case TextEntry: ! widget = new QLineEdit(parent, name); ! break; ! case ColorEntry: ! widget = new QLineEdit(parent, name); ! break; ! case ChoiceEntry: ! { ! QComboBox* cb = new QComboBox(parent, name); ! cb->setEditable(false); ! ! for(uint i = 0; i < items.count(); i++) { ! cb->insertItem(items[i]->label); ! } cb->setCurrentItem(current); ! connect(cb, SIGNAL(activated(int)), this, SLOT(run())); ! ! widget = cb; ! } ! break; ! case ListEntry: { ! QListBox* lb = new QListBox(parent, name); ! widget = lb; ! // ugly hack ... ! lb->setMinimumHeight(200); ! lb->setMinimumWidth(150); ! connect(widget, SIGNAL(highlighted(int)), this, SLOT(run())); ! } ! break; ! case ButtonEntry: ! widget = new QPushButton(name, parent, name); ! connect(widget, SIGNAL(clicked()), this, SLOT(run())); ! break; ! case LabelEntry: ! widget = new QLabel(parent, name); ((QLabel *)widget)->setAlignment (AlignRight|AlignVCenter|ExpandTabs); ! break; ! } ! return widget; } QString Entry::getName() { ! return name; } void* Entry::getValue() { ! void* ret = 0; ! switch (type) { ! case TextEntry: { ! QString s = ((QLineEdit*) widget)->text(); ! const char* ss = s.latin1(); ! ret = (void *) ss; ! } ! break; ! case ColorEntry: ! ret = (void *) (const char*) ((QLineEdit*) widget)->text().latin1(); ! break; ! case ChoiceEntry: ! ret = items[((QComboBox*) widget)->currentItem()]->value; ! break; ! case ListEntry: ! ret = items[((QListBox*) widget)->currentItem()]->value; ! break; ! } ! return ret; } void Entry::setValue(const void* val) { ! switch (type) { ! case TextEntry: ! ((QLineEdit*) widget)->setText((char*) val); ! break; ! case ColorEntry: ! ((QLineEdit*) widget)->setText((char*) val); ! break; ! case ChoiceEntry: for (uint i = 0; i < items.count(); ++i) { if (items[i] == val) { --- 215,353 ---- grid->addWidget(w, i, 1); } ! } } void RMapDialog::setContext(void* ctx) { ! context = ctx; } // Implementation of Entry class Entry::Entry(RMapDialog* dlg, int etype, QString ename) { ! dialog = dlg; ! type = etype; ! name = ename; ! callback = 0; ! widget = 0; current = 0; } Entry::Entry(RMapDialog* dlg, int etype, QString ename, QVector<Item>& eitems, ! int ecurrent, RoadMapDialogCallback ecallback) { ! dialog = dlg; ! type = etype; ! name = ename; current = ecurrent; ! callback = ecallback; ! items.resize(eitems.count()); ! for(uint i = 0; i < eitems.count(); i++) { ! items.insert(i, eitems[i]); ! } } Entry::~Entry() { ! for(uint i = 0; i < items.count(); i++) { ! delete items[i]; ! } } QWidget* Entry::create(QWidget* parent) { ! widget = 0; ! ! switch (type) { ! case TextEntry: ! widget = new QLineEdit(parent, name); ! break; ! case ColorEntry: ! widget = new QLineEdit(parent, name); ! break; ! case ChoiceEntry: ! { ! QComboBox* cb = new QComboBox(parent, name); ! cb->setEditable(false); ! ! for(uint i = 0; i < items.count(); i++) { ! cb->insertItem(items[i]->label); ! } cb->setCurrentItem(current); ! connect(cb, SIGNAL(activated(int)), this, SLOT(run())); ! ! widget = cb; ! } ! break; ! case ListEntry: { ! QListBox* lb = new QListBox(parent, name); ! widget = lb; ! // ugly hack ... ! lb->setMinimumHeight(200); ! lb->setMinimumWidth(150); ! connect(widget, SIGNAL(highlighted(int)), this, SLOT(run())); ! } ! break; ! case ButtonEntry: ! widget = new QPushButton(name, parent, name); ! connect(widget, SIGNAL(clicked()), this, SLOT(run())); ! break; ! case LabelEntry: ! widget = new QLabel(parent, name); ((QLabel *)widget)->setAlignment (AlignRight|AlignVCenter|ExpandTabs); ! break; ! } ! return widget; } QString Entry::getName() { ! return name; } void* Entry::getValue() { ! void* ret = 0; ! switch (type) { ! case TextEntry: { ! QString s = ((QLineEdit*) widget)->text(); ! const char* ss = s.latin1(); ! ret = (void *) ss; ! } ! break; ! case ColorEntry: ! ret = (void *) (const char*) ((QLineEdit*) widget)->text().latin1(); ! break; ! case ChoiceEntry: ! ret = items[((QComboBox*) widget)->currentItem()]->value; ! break; ! case ListEntry: ! ret = items[((QListBox*) widget)->currentItem()]->value; ! break; ! } ! return ret; } void Entry::setValue(const void* val) { ! switch (type) { ! case TextEntry: ! ((QLineEdit*) widget)->setText((char*) val); ! break; ! case ColorEntry: ! ((QLineEdit*) widget)->setText((char*) val); ! break; ! case ChoiceEntry: for (uint i = 0; i < items.count(); ++i) { if (items[i] == val) { *************** *** 356,362 **** } } ! break; ! case ListEntry: for (uint i = 0; i < items.count(); ++i) { if (items[i] == val) { --- 356,362 ---- } } ! break; ! case ListEntry: for (uint i = 0; i < items.count(); ++i) { if (items[i] == val) { *************** *** 365,401 **** } } ! break; ! case LabelEntry: ! ((QLabel*) widget)->setText((char *)val); ! break; ! } } void Entry::setValues(QVector<Item>& eitems, ! RoadMapDialogCallback cb) { ! if (type != ListEntry) { ! return; ! } ! QListBox* lb = (QListBox*) widget; if (lb->count() > 0) lb->clear(); ! items.resize(eitems.count()); ! for(uint i = 0; i < eitems.count(); i++) { ! items.insert(i, eitems[i]); ! lb->insertItem(eitems[i]->label); ! } ! callback = cb; } void Entry::run() { ! if (callback != 0) { ! callback(name, dialog->getContext()); ! } } --- 365,401 ---- } } ! break; ! case LabelEntry: ! ((QLabel*) widget)->setText((char *)val); ! break; ! } } void Entry::setValues(QVector<Item>& eitems, ! RoadMapDialogCallback cb) { ! if (type != ListEntry) { ! return; ! } ! QListBox* lb = (QListBox*) widget; if (lb->count() > 0) lb->clear(); ! items.resize(eitems.count()); ! for(uint i = 0; i < eitems.count(); i++) { ! items.insert(i, eitems[i]); ! lb->insertItem(eitems[i]->label); ! } ! callback = cb; } void Entry::run() { ! if (callback != 0) { ! callback(name, dialog->getContext()); ! } } Index: qt_fileselection.cc =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/qt_fileselection.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** qt_fileselection.cc 27 Mar 2003 05:35:43 -0000 1.1 --- qt_fileselection.cc 3 Nov 2006 14:42:15 -0000 1.2 *************** *** 31,83 **** // Implementation of FileSelection class FileSelector::FileSelector(QWidget* parent, const char* title, const char* flt, ! const char* path, const char* mod, RoadMapFileCallback cb): ! QDialog(parent, title, TRUE) { ! filter = flt; ! mode = mod; ! callback = cb; ! fileEdit = 0; ! setCaption(title); ! if (QFileInfo(path).exists()) { ! currentDir.setPath(path); ! } else { ! currentDir.setPath(QDir::currentDirPath()); ! } ! QVBoxLayout* l = new QVBoxLayout(this); ! l->setSpacing(4); ! l->setMargin(2); ! ! dirList = new QComboBox(this); ! dirList->setEditable(false); ! l->addWidget(dirList); ! fileList = new QListView(this); ! fileList->setSorting(2, FALSE); ! fileList->setSelectionMode(QListView::Single); ! fileList->setAllColumnsShowFocus(TRUE); ! fileList->addColumn(tr("Name")); ! fileList->addColumn(tr("Size")); ! fileList->setColumnAlignment(1, Qt::AlignRight); ! l->addWidget(fileList); ! if (strcmp(mode, "w") == 0) { ! fileEdit = new QLineEdit(this); ! l->addWidget(fileEdit); ! } ! connect(dirList, SIGNAL(activated(const QString&)), ! this, SLOT(onDirSelect(const QString&))); ! connect(fileList, SIGNAL(clicked(QListViewItem*)), ! this, SLOT(onFileSelect(QListViewItem*))); ! if (parent != 0) { ! resize(parent->width(), parent->height()); ! } ! populateList(); } --- 31,83 ---- // Implementation of FileSelection class FileSelector::FileSelector(QWidget* parent, const char* title, const char* flt, ! const char* path, const char* mod, RoadMapFileCallback cb): ! QDialog(parent, title, TRUE) { ! filter = flt; ! mode = mod; ! callback = cb; ! fileEdit = 0; ! setCaption(title); ! if (QFileInfo(path).exists()) { ! currentDir.setPath(path); ! } else { ! currentDir.setPath(QDir::currentDirPath()); ! } ! QVBoxLayout* l = new QVBoxLayout(this); ! l->setSpacing(4); ! l->setMargin(2); ! ! dirList = new QComboBox(this); ! dirList->setEditable(false); ! l->addWidget(dirList); ! fileList = new QListView(this); ! fileList->setSorting(2, FALSE); ! fileList->setSelectionMode(QListView::Single); ! fileList->setAllColumnsShowFocus(TRUE); ! fileList->addColumn(tr("Name")); ! fileList->addColumn(tr("Size")); ! fileList->setColumnAlignment(1, Qt::AlignRight); ! l->addWidget(fileList); ! if (strcmp(mode, "w") == 0) { ! fileEdit = new QLineEdit(this); ! l->addWidget(fileEdit); ! } ! connect(dirList, SIGNAL(activated(const QString&)), ! this, SLOT(onDirSelect(const QString&))); ! connect(fileList, SIGNAL(clicked(QListViewItem*)), ! this, SLOT(onFileSelect(QListViewItem*))); ! if (parent != 0) { ! resize(parent->width(), parent->height()); ! } ! populateList(); } *************** *** 86,208 **** void FileSelector::populateList() { ! // populate dir list ! dirList->clear(); ! QString dir = currentDir.canonicalPath(); ! char sep = QDir::separator(); ! while (dir.length() > 0) { ! dirList->insertItem(dir); ! if (dir == "/") { ! break; ! } ! int n = dir.findRev(sep); ! if (n > 0) { ! dir = dir.left(n); ! } else if (n == 0) { ! dir = dir.left(1); ! } else { ! dir = ""; ! } ! } ! // populate file list ! currentDir.setFilter(QDir::All | QDir::Readable); ! currentDir.setSorting(QDir::DirsFirst); ! currentDir.setMatchAllDirs(TRUE); ! if (filter.isEmpty()) { ! currentDir.setNameFilter(filter); ! } ! const QFileInfoList* fil = currentDir.entryInfoList(); ! QFileInfoListIterator it(*fil); ! QFileInfo* fi; ! fileList->clear(); ! while ((fi = it.current()) != 0) { ! if (fi->fileName() != ".") { ! QString fsize, fname; ! fsize.sprintf("%10d", fi->size()); ! fname = fi->fileName(); ! if (fi->isDir()) { ! fname += "/"; ! } ! new QListViewItem(fileList, fname, fsize); ! } ! ++it; ! } ! fileList->setSorting(2, FALSE); } ! ! void FileSelector::onDirSelect(const QString& dir) { ! currentDir.setPath(dir); ! populateList(); } void FileSelector::onFileSelect(QListViewItem* lvi) { ! QString fname = lvi->text(0); ! QFileInfo fi(currentDir, fname); ! while (fi.isSymLink()) { ! fi.setFile(fi.readLink()); ! } ! if (fi.isDir()) { ! currentDir.setPath(currentDir.canonicalPath() + ! QDir::separator() + fname); ! populateList(); ! } else { ! if (fileEdit != 0) { ! fileEdit->setText(fname); ! } ! } } void FileSelector::accept() { ! QString fname = QString::null; ! if (fileEdit != 0) { ! fname = fileEdit->text(); ! } else { ! QListViewItem* lvi = fileList->selectedItem(); ! if (lvi != 0) { ! fname = lvi->text(0); ! } ! } ! if (fname.isNull() || fname.isEmpty()) { ! QMessageBox::critical(this, "Error", "Please choose filename"); ! return; ! } ! QFileInfo f(currentDir, fname); ! fname = f.absFilePath(); ! if (strcmp(mode, "r") == 0) { ! if (!f.exists()) { ! QMessageBox::critical(this, "Error", "The file doesn't exist"); ! return; ! } ! } ! if (!fname.isNull() && callback != 0) { ! callback((const char*) fname.local8Bit(), mode); ! } ! QDialog::accept(); } void FileSelector::resizeEvent(QResizeEvent* e) { ! fileList->setColumnWidth(1,(fileList->width())/4); ! fileList->setColumnWidth(0,fileList->width() - 20 - ! fileList->columnWidth(1)); } --- 86,208 ---- void FileSelector::populateList() { ! // populate dir list ! dirList->clear(); ! QString dir = currentDir.canonicalPath(); ! char sep = QDir::separator(); ! while (dir.length() > 0) { ! dirList->insertItem(dir); ! if (dir == "/") { ! break; ! } ! int n = dir.findRev(sep); ! if (n > 0) { ! dir = dir.left(n); ! } else if (n == 0) { ! dir = dir.left(1); ! } else { ! dir = ""; ! } ! } ! // populate file list ! currentDir.setFilter(QDir::All | QDir::Readable); ! currentDir.setSorting(QDir::DirsFirst); ! currentDir.setMatchAllDirs(TRUE); ! if (filter.isEmpty()) { ! currentDir.setNameFilter(filter); ! } ! const QFileInfoList* fil = currentDir.entryInfoList(); ! QFileInfoListIterator it(*fil); ! QFileInfo* fi; ! fileList->clear(); ! while ((fi = it.current()) != 0) { ! if (fi->fileName() != ".") { ! QString fsize, fname; ! fsize.sprintf("%10d", fi->size()); ! fname = fi->fileName(); ! if (fi->isDir()) { ! fname += "/"; ! } ! new QListViewItem(fileList, fname, fsize); ! } ! ++it; ! } ! fileList->setSorting(2, FALSE); } ! ! void FileSelector::onDirSelect(const QString& dir) { ! currentDir.setPath(dir); ! populateList(); } void FileSelector::onFileSelect(QListViewItem* lvi) { ! QString fname = lvi->text(0); ! QFileInfo fi(currentDir, fname); ! while (fi.isSymLink()) { ! fi.setFile(fi.readLink()); ! } ! if (fi.isDir()) { ! currentDir.setPath(currentDir.canonicalPath() + ! QDir::separator() + fname); ! populateList(); ! } else { ! if (fileEdit != 0) { ! fileEdit->setText(fname); ! } ! } } void FileSelector::accept() { ! QString fname = QString::null; ! if (fileEdit != 0) { ! fname = fileEdit->text(); ! } else { ! QListViewItem* lvi = fileList->selectedItem(); ! if (lvi != 0) { ! fname = lvi->text(0); ! } ! } ! if (fname.isNull() || fname.isEmpty()) { ! QMessageBox::critical(this, "Error", "Please choose filename"); ! return; ! } ! QFileInfo f(currentDir, fname); ! fname = f.absFilePath(); ! if (strcmp(mode, "r") == 0) { ! if (!f.exists()) { ! QMessageBox::critical(this, "Error", "The file doesn't exist"); ! return; ! } ! } ! if (!fname.isNull() && callback != 0) { ! callback((const char*) fname.local8Bit(), mode); ! } ! QDialog::accept(); } void FileSelector::resizeEvent(QResizeEvent* e) { ! fileList->setColumnWidth(1,(fileList->width())/4); ! fileList->setColumnWidth(0,fileList->width() - 20 - ! fileList->columnWidth(1)); } Index: roadmap_messagebox.cc =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/roadmap_messagebox.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** roadmap_messagebox.cc 2 Dec 2005 22:54:27 -0000 1.3 --- roadmap_messagebox.cc 3 Nov 2006 14:42:15 -0000 1.4 *************** *** 33,40 **** void roadmap_messagebox(const char* title, const char* message) { ! QMessageBox::information(0, roadmap_start_get_title(title), message); } void roadmap_messagebox_wait(const char* title, const char* message) { ! QMessageBox::critical(0, roadmap_start_get_title(title), message); } --- 33,40 ---- void roadmap_messagebox(const char* title, const char* message) { ! QMessageBox::information(0, roadmap_start_get_title(title), message); } void roadmap_messagebox_wait(const char* title, const char* message) { ! QMessageBox::critical(0, roadmap_start_get_title(title), message); } Index: qt_canvas.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/qt_canvas.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** qt_canvas.h 13 Jul 2006 15:47:53 -0000 1.7 --- qt_canvas.h 3 Nov 2006 14:42:15 -0000 1.8 *************** *** 39,45 **** #include "roadmap_canvas.h" ! struct roadmap_canvas_pen { ! QPen* pen; ! }; }; --- 39,45 ---- #include "roadmap_canvas.h" ! struct roadmap_canvas_pen { ! QPen* pen; ! }; }; *************** *** 49,70 **** public: ! RMapCanvas(QWidget* parent); ! virtual ~RMapCanvas(); ! RoadMapPen createPen(const char* name); ! void selectPen(RoadMapPen); ! void setPenColor(const char* color); ! void setPenThickness(int thickness); ! void erase(void); ! void drawString(RoadMapGuiPoint* position, int corner, ! const char* text); ! void drawStringAngle(RoadMapGuiPoint* position, ! int center, const char* text, int angle); ! void drawMultiplePoints(int count, RoadMapGuiPoint* points); ! void drawMultipleLines(int count, int* lines, RoadMapGuiPoint* points); ! void drawMultiplePolygons(int count, int* polygons, ! RoadMapGuiPoint* points, int filled); ! void drawMultipleCircles(int count, RoadMapGuiPoint* centers, ! int* radius, int filled); void registerButtonPressedHandler(RoadMapCanvasMouseHandler handler); void registerButtonReleasedHandler(RoadMapCanvasMouseHandler handler); --- 49,70 ---- public: ! RMapCanvas(QWidget* parent); ! virtual ~RMapCanvas(); ! RoadMapPen createPen(const char* name); ! void selectPen(RoadMapPen); ! void setPenColor(const char* color); ! void setPenThickness(int thickness); ! void erase(void); ! void drawString(RoadMapGuiPoint* position, int corner, ! const char* text); ! void drawStringAngle(RoadMapGuiPoint* position, ! int center, const char* text, int angle); ! void drawMultiplePoints(int count, RoadMapGuiPoint* points); ! void drawMultipleLines(int count, int* lines, RoadMapGuiPoint* points); ! void drawMultiplePolygons(int count, int* polygons, ! RoadMapGuiPoint* points, int filled); ! void drawMultipleCircles(int count, RoadMapGuiPoint* centers, ! int* radius, int filled); void registerButtonPressedHandler(RoadMapCanvasMouseHandler handler); void registerButtonReleasedHandler(RoadMapCanvasMouseHandler handler); *************** *** 72,91 **** void registerMouseWheelHandler(RoadMapCanvasMouseHandler handler); ! void registerConfigureHandler(RoadMapCanvasConfigureHandler handler); ! void getTextExtents(const char* text, int* width, int* ascent, ! int* descent, int *can_tilt); ! int getHeight(); ! int getWidth(); ! void refresh(void); ! void configure(); protected: ! QMap<QString, QColor*> colors; ! QMap<QString, RoadMapPen> pens; ! QPen* currentPen; ! QPixmap* pixmap; ! RoadMapCanvasConfigureHandler configureHandler; RoadMapCanvasMouseHandler buttonPressedHandler; RoadMapCanvasMouseHandler buttonReleasedHandler; --- 72,91 ---- void registerMouseWheelHandler(RoadMapCanvasMouseHandler handler); ! void registerConfigureHandler(RoadMapCanvasConfigureHandler handler); ! void getTextExtents(const char* text, int* width, int* ascent, ! int* descent, int *can_tilt); ! int getHeight(); ! int getWidth(); ! void refresh(void); ! void configure(); protected: ! QMap<QString, QColor*> colors; ! QMap<QString, RoadMapPen> pens; ! QPen* currentPen; ! QPixmap* pixmap; ! RoadMapCanvasConfigureHandler configureHandler; RoadMapCanvasMouseHandler buttonPressedHandler; RoadMapCanvasMouseHandler buttonReleasedHandler; *************** *** 96,106 **** void initColors(); ! QColor getColor(const char* color); ! virtual void mousePressEvent(QMouseEvent*); virtual void mouseReleaseEvent(QMouseEvent*); virtual void mouseMoveEvent(QMouseEvent*); virtual void wheelEvent(QWheelEvent*); ! virtual void resizeEvent(QResizeEvent*); ! virtual void paintEvent(QPaintEvent*); }; --- 96,106 ---- void initColors(); ! QColor getColor(const char* color); ! virtual void mousePressEvent(QMouseEvent*); virtual void mouseReleaseEvent(QMouseEvent*); virtual void mouseMoveEvent(QMouseEvent*); virtual void wheelEvent(QWheelEvent*); ! virtual void resizeEvent(QResizeEvent*); ! virtual void paintEvent(QPaintEvent*); }; Index: roadmap_dialog.cc =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/roadmap_dialog.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** roadmap_dialog.cc 3 Dec 2005 03:26:12 -0000 1.6 --- roadmap_dialog.cc 3 Nov 2006 14:42:15 -0000 1.7 *************** *** 38,76 **** int roadmap_dialog_activate(const char* name, void* context) { ! RMapDialog* dialog = dialogs[name]; ! int ret = 0; ! if (dialog != 0) { ! dialog->show(); ! ret = 0; ! } else { ! dialog = new RMapDialog(0, roadmap_start_get_title(name)); dialogs[name] = dialog; ! ret = 1; ! } ! currentDialog = dialog; ! currentDialog->setContext(context); ! return ret; } void roadmap_dialog_hide(const char* name) { ! // RMapDialog* dialog = dialogs[name]; ! if (currentDialog != 0) { ! currentDialog->hide(); ! } } void roadmap_dialog_new_entry (const char *frame, const char *name) { ! currentDialog->addTextEntry(frame, name); } void roadmap_dialog_new_label (const char *frame, const char *name) { ! currentDialog->addLabelEntry(frame, name); } void roadmap_dialog_new_color (const char *frame, const char *name) { ! currentDialog->addColorEntry(frame, name); } --- 38,76 ---- int roadmap_dialog_activate(const char* name, void* context) { ! RMapDialog* dialog = dialogs[name]; ! int ret = 0; ! if (dialog != 0) { ! dialog->show(); ! ret = 0; ! } else { ! dialog = new RMapDialog(0, roadmap_start_get_title(name)); dialogs[name] = dialog; ! ret = 1; ! } ! currentDialog = dialog; ! currentDialog->setContext(context); ! return ret; } void roadmap_dialog_hide(const char* name) { ! // RMapDialog* dialog = dialogs[name]; ! if (currentDialog != 0) { ! currentDialog->hide(); ! } } void roadmap_dialog_new_entry (const char *frame, const char *name) { ! currentDialog->addTextEntry(frame, name); } void roadmap_dialog_new_label (const char *frame, const char *name) { ! currentDialog->addLabelEntry(frame, name); } void roadmap_dialog_new_color (const char *frame, const char *name) { ! currentDialog->addColorEntry(frame, name); } *************** *** 83,122 **** RoadMapDialogCallback callback) { ! currentDialog->addChoiceEntry (frame, name, count, current, labels, values, callback); } void roadmap_dialog_new_list (const char *frame, const char *name) { ! currentDialog->addListEntry(frame, name); } void roadmap_dialog_show_list (const char* frame, const char* name, int count, ! char **labels, void **values, RoadMapDialogCallback callback) { ! currentDialog->setListEntryValues(frame, name, count, labels, values, callback); } void roadmap_dialog_add_button (char *label, RoadMapDialogCallback callback) { ! currentDialog->addButton(label, callback); } void roadmap_dialog_complete (int use_keyboard) { ! currentDialog->complete(use_keyboard); } void roadmap_dialog_select(const char *dialog) { ! RMapDialog* d = dialogs[dialog]; ! if (d != 0) { ! currentDialog = d; ! } } ! void *roadmap_dialog_get_data (const char *frame, const char *name) { ! return currentDialog->getEntryValue(frame, name); } void roadmap_dialog_set_data (const char *frame, const char *name, const void *data) { ! currentDialog->setEntryValue(frame, name, data); } --- 83,122 ---- RoadMapDialogCallback callback) { ! currentDialog->addChoiceEntry (frame, name, count, current, labels, values, callback); } void roadmap_dialog_new_list (const char *frame, const char *name) { ! currentDialog->addListEntry(frame, name); } void roadmap_dialog_show_list (const char* frame, const char* name, int count, ! char **labels, void **values, RoadMapDialogCallback callback) { ! currentDialog->setListEntryValues(frame, name, count, labels, values, callback); } void roadmap_dialog_add_button (char *label, RoadMapDialogCallback callback) { ! currentDialog->addButton(label, callback); } void roadmap_dialog_complete (int use_keyboard) { ! currentDialog->complete(use_keyboard); } void roadmap_dialog_select(const char *dialog) { ! RMapDialog* d = dialogs[dialog]; ! if (d != 0) { ! currentDialog = d; ! } } ! void *roadmap_dialog_get_data (const char *frame, const char *name) { ! return currentDialog->getEntryValue(frame, name); } void roadmap_dialog_set_data (const char *frame, const char *name, const void *data) { ! currentDialog->setEntryValue(frame, name, data); } Index: qt_dialog.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/qt_dialog.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** qt_dialog.h 3 Dec 2005 03:25:48 -0000 1.4 --- qt_dialog.h 3 Nov 2006 14:42:15 -0000 1.5 *************** *** 42,51 **** struct Item { ! QString label; ! void* value; }; class RMapDialog; ! class Entry : public QObject { --- 42,51 ---- struct Item { ! QString label; ! void* value; }; class RMapDialog; ! class Entry : public QObject { *************** *** 53,95 **** protected: ! RMapDialog* dialog; ! int type; ! QString name; ! RoadMapDialogCallback callback; ! QVector<Item> items; int current; ! QWidget* widget; public: ! enum { ! TextEntry = 1, ! ColorEntry, ! ChoiceEntry, ! ListEntry, ! ButtonEntry, ! LabelEntry, ! }; ! Entry(RMapDialog* dialog, int type, QString name); ! Entry(RMapDialog* dialog, int type, QString name, QVector<Item>& items, ! int current, RoadMapDialogCallback callback); ! ~Entry(); ! QWidget* create(QWidget* parent); ! QString getName(); ! void* getValue(); ! void setValue(const void*); ! QWidget* getWidget() { ! return widget; ! } ! void setValues(QVector<Item>& items, ! RoadMapDialogCallback callback); protected slots: ! void run(); }; --- 53,95 ---- protected: ! RMapDialog* dialog; ! int type; ! QString name; ! RoadMapDialogCallback callback; ! QVector<Item> items; int current; ! QWidget* widget; public: ! enum { ! TextEntry = 1, ! ColorEntry, ! ChoiceEntry, ! ListEntry, ! ButtonEntry, ! LabelEntry, ! }; ! Entry(RMapDialog* dialog, int type, QString name); ! Entry(RMapDialog* dialog, int type, QString name, QVector<Item>& items, ! int current, RoadMapDialogCallback callback); ! ~Entry(); ! QWidget* create(QWidget* parent); ! QString getName(); ! void* getValue(); ! void setValue(const void*); ! QWidget* getWidget() { ! return widget; ! } ! void setValues(QVector<Item>& items, ! RoadMapDialogCallback callback); protected slots: ! void run(); }; *************** *** 98,108 **** public: ! RMapDialog(QWidget* parent, const char* name); ! virtual ~RMapDialog(); ! void addTextEntry(const char* frame, const char* name); ! void addLabelEntry(const char* frame, const char* name); ! void addColorEntry(const char* frame, const char* name); ! void addChoiceEntry(const char* frame, const char* name, int count, --- 98,108 ---- public: ! RMapDialog(QWidget* parent, const char* name); ! virtual ~RMapDialog(); ! void addTextEntry(const char* frame, const char* name); ! void addLabelEntry(const char* frame, const char* name); ! void addColorEntry(const char* frame, const char* name); ! void addChoiceEntry(const char* frame, const char* name, int count, *************** *** 112,139 **** RoadMapDialogCallback callback); ! void addListEntry(const char* frame, const char* name); ! void setListEntryValues(const char* frame, const char* name, int count, ! char** labels, void** values, RoadMapDialogCallback callback); ! void addButton(char* label, RoadMapDialogCallback callback); ! void complete(int use_keyboard); ! void* getEntryValue(const char* frame, const char* name); ! void setEntryValue(const char* frame, const char* name, const void* data); ! void setContext(void*); ! void* getContext() { ! return context; ! } protected: ! QMap<QString, QList<Entry> *> frames; ! QList<QString> frameNames; ! QList<Entry> buttons; ! void* context; ! QList<Entry>* getFrame(QString frameName); ! Entry* getEntry(QString frameName, QString entryName); ! void initTab(QWidget* w, QList<Entry>* entries); }; --- 112,139 ---- RoadMapDialogCallback callback); ! void addListEntry(const char* frame, const char* name); ! void setListEntryValues(const char* frame, const char* name, int count, ! char** labels, void** values, RoadMapDialogCallback callback); ! void addButton(char* label, RoadMapDialogCallback callback); ! void complete(int use_keyboard); ! void* getEntryValue(const char* frame, const char* name); ! void setEntryValue(const char* frame, const char* name, const void* data); ! void setContext(void*); ! void* getContext() { ! return context; ! } protected: ! QMap<QString, QList<Entry> *> frames; ! QList<QString> frameNames; ! QList<Entry> buttons; ! void* context; ! QList<Entry>* getFrame(QString frameName); ! Entry* getEntry(QString frameName, QString entryName); ! void initTab(QWidget* w, QList<Entry>* entries); }; Index: roadmap_canvas.cc =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/qt/roadmap_canvas.cc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** roadmap_canvas.cc 13 Jul 2006 15:47:53 -0000 1.10 --- roadmap_canvas.cc 3 Nov 2006 14:42:15 -0000 1.11 *************** *** 59,63 **** } else { mhandler = handler; ! } } --- 59,63 ---- } else { mhandler = handler; ! } } *************** *** 69,122 **** } else { whandler = handler; ! } } void roadmap_canvas_register_configure_handler( ! RoadMapCanvasConfigureHandler handler) { ! if (roadMapCanvas) { ! roadMapCanvas->registerConfigureHandler(handler); ! } else { ! chandler = handler; ! } } void roadmap_canvas_get_text_extents(const char *text, int size, ! int *width, int *ascent, int *descent, int *can_tilt) { ! roadMapCanvas->getTextExtents(text, width, ascent, descent, can_tilt); } RoadMapPen roadmap_canvas_create_pen (const char *name) { ! return roadMapCanvas->createPen(name); } RoadMapPen roadmap_canvas_select_pen (RoadMapPen pen) { ! static RoadMapPen CurrentPen; ! RoadMapPen old_pen = CurrentPen; ! CurrentPen = pen; ! roadMapCanvas->selectPen(pen); ! return old_pen; } void roadmap_canvas_set_foreground (const char *color) { ! roadMapCanvas->setPenColor(color); } void roadmap_canvas_set_thickness (int thickness) { ! roadMapCanvas->setPenThickness(thickness); } void roadmap_canvas_erase (void) { ! roadMapCanvas->erase(); } void roadmap_canvas_draw_string(RoadMapGuiPoint *position, int corner, ! const char *text) { ! roadMapCanvas->drawString(position, corner, text); } --- 69,122 ---- } else { whandler = handler; ! } } void roadmap_canvas_register_configure_handler( ! RoadMapCanvasConfigureHandler handler) { ! if (roadMapCanvas) { ! roadMapCanvas->registerConfigureHandler(handler); ! } else { ! chandler = handler; ! } } void roadmap_canvas_get_text_extents(const char *text, int size, ! int *width, int *ascent, int *descent, int *can_tilt) { ! roadMapCanvas->getTextExtents(text, width, ascent, descent, can_tilt); } RoadMapPen roadmap_canvas_create_pen (const char *name) { ! return roadMapCanvas->createPen(name); } RoadMapPen roadmap_canvas_select_pen (RoadMapPen pen) { ! static RoadMapPen CurrentPen; ! RoadMapPen old_pen = CurrentPen; ! CurrentPen = pen; ! roadMapCanvas->selectPen(pen); ! return old_pen; } void roadmap_canvas_set_foreground (const char *color) { ! roadMapCanvas->setPenColor(color); } void roadmap_canvas_set_thickness (int thickness) { ! roadMapCanvas->setPenThickness(thickness); } void roadmap_canvas_erase (void) { ! roadMapCanvas->erase(); } void roadmap_canvas_draw_string(RoadMapGuiPoint *position, int corner, ! const char *text) { ! roadMapCanvas->drawString(position, corner, text); } *************** *** 125,164 **** ... [truncated message content] |
From: Ehud S. <esh...@us...> - 2006-11-03 12:46:19
|
Update of /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/libssd In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13188 Added Files: libssd.vcp Log Message: SSD - small screen device. This is a framework for creating dialogs for ssd. This is just an initial implementation and currently does nothing. --- NEW FILE: libssd.vcp --- # Microsoft eMbedded Visual Tools Project File - Name="libssd" - Package Owner=<4> # Microsoft eMbedded Visual Tools Generated Build File, Format Version 6.02 # ** DO NOT EDIT ** # TARGTYPE "Win32 (WCE ARMV4) Static Library" 0xa304 CFG=libssd - Win32 (WCE ARMV4) Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "libssd.vcn". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "libssd.vcn" CFG="libssd - Win32 (WCE ARMV4) Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "libssd - Win32 (WCE ARMV4) Release" (based on "Win32 (WCE ARMV4) Static Library") !MESSAGE "libssd - Win32 (WCE ARMV4) Debug" (based on "Win32 (WCE ARMV4) Static Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" # PROP ATL_Project 2 CPP=clarm.exe !IF "$(CFG)" == "libssd - Win32 (WCE ARMV4) Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "ARMV4Rel" # PROP BASE Intermediate_Dir "ARMV4Rel" # PROP BASE CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}" # PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "ARMV4Rel" # PROP Intermediate_Dir "ARMV4Rel" # PROP CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}" # PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /O2 /M$(CECrtMT) /c # ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /O2 /M$(CECrtMT) /c LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo !ELSEIF "$(CFG)" == "libssd - Win32 (WCE ARMV4) Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "ARMV4Dbg" # PROP BASE Intermediate_Dir "ARMV4Dbg" # PROP BASE CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}" # PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "ARMV4Dbg" # PROP Intermediate_Dir "ARMV4Dbg" # PROP CPU_ID "{ECBEA43D-CD7B-4852-AD55-D4227B5D624B}" # PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c # ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D "ARMV4" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo !ENDIF # Begin Target # Name "libssd - Win32 (WCE ARMV4) Release" # Name "libssd - Win32 (WCE ARMV4) Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # End Group # End Target # End Project |
From: Ehud S. <esh...@us...> - 2006-11-03 12:45:36
|
Update of /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/libssd In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv12812/libssd Log Message: Directory /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/libssd added to the repository |
From: Ehud S. <esh...@us...> - 2006-11-03 12:45:18
|
Update of /cvsroot/roadmap/roadmap_editor/src/win32/wince_env In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv12749 Modified Files: Roadmap.vcw Log Message: Changes for SSD support. Index: Roadmap.vcw =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/Roadmap.vcw,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Roadmap.vcw 17 Sep 2006 20:46:45 -0000 1.11 --- Roadmap.vcw 3 Nov 2006 12:45:14 -0000 1.12 *************** *** 247,250 **** --- 247,262 ---- ############################################################################### + Project: "libssd"=.\libssd\libssd.vcp - Package Owner=<4> + + Package=<5> + {{{ + }}} + + Package=<4> + {{{ + }}} + + ############################################################################### + Project: "libwinceguiroadmap"=.\libwinceguiroadmap\libwinceguiroadmap.vcp - Package Owner=<4> *************** *** 304,308 **** ############################################################################### ! Project: "zlib"="C:\Projects\zlib-1.2.3\zlib.vcp" - Package Owner=<4> Package=<5> --- 316,320 ---- ############################################################################### ! Project: "zlib"=.\zlib\zlib.vcp - Package Owner=<4> Package=<5> |
From: Ehud S. <esh...@us...> - 2006-11-03 12:44:49
|
Update of /cvsroot/roadmap/roadmap_editor/src/win32 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv12395 Modified Files: roadmap_main.cpp roadmap_win32.c roadmap_win32.h Log Message: Changes for SSD support. Index: roadmap_win32.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/win32/roadmap_win32.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** roadmap_win32.h 14 Oct 2006 09:17:15 -0000 1.9 --- roadmap_win32.h 3 Nov 2006 12:44:45 -0000 1.10 *************** *** 28,32 **** LPWSTR ConvertToWideChar(LPCSTR string, UINT nCodePage); char* ConvertToMultiByte(const LPCWSTR s, UINT nCodePage); ! const char *roadmap_main_get_virtual_serial (void); time_t timegm(struct tm *_tm); --- 28,32 ---- LPWSTR ConvertToWideChar(LPCSTR string, UINT nCodePage); char* ConvertToMultiByte(const LPCWSTR s, UINT nCodePage); ! const char *roadmap_main_get_virtual_serial (void); time_t timegm(struct tm *_tm); Index: roadmap_win32.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/win32/roadmap_win32.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** roadmap_win32.c 13 Jul 2006 06:48:17 -0000 1.4 --- roadmap_win32.c 3 Nov 2006 12:44:45 -0000 1.5 *************** *** 61,63 **** --- 61,79 ---- } } + + + #ifdef UNDER_CE + + #include <wchar.h> + size_t __cdecl mbsrtowcs(wchar_t *wc, const char **s, size_t len, mbstate_t *ps) + { + return MultiByteToWideChar(CP_UTF8, 0, *s, strlen(*s), wc, len); + } + + size_t __cdecl wcrtomb(char *s, wchar_t wc, mbstate_t *ps) + { + return WideCharToMultiByte(CP_UTF8, 0, &wc, 1, s, 10, NULL, NULL); + } + + #endif Index: roadmap_main.cpp =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/win32/roadmap_main.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** roadmap_main.cpp 15 Oct 2006 11:00:17 -0000 1.22 --- roadmap_main.cpp 3 Nov 2006 12:44:45 -0000 1.23 *************** *** 1167,1171 **** } ! roadmap_canvas_draw_string_angle (&position, &position, 0, str); roadmap_canvas_refresh (); --- 1167,1171 ---- } ! roadmap_canvas_draw_string_angle (&position, &position, 0, -1, str); roadmap_canvas_refresh (); |
From: Ehud S. <esh...@us...> - 2006-11-03 12:43:46
|
Update of /cvsroot/roadmap/roadmap_editor/src/agg In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11979 Modified Files: roadmap_canvas.cpp Log Message: Changes for SSD support. Index: roadmap_canvas.cpp =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/agg/roadmap_canvas.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** roadmap_canvas.cpp 12 Aug 2006 16:58:52 -0000 1.7 --- roadmap_canvas.cpp 3 Nov 2006 12:43:42 -0000 1.8 *************** *** 153,156 **** --- 153,158 ---- if (size == -1) { /* Use the regular font */ + *descent = abs((int)m_feng.descender()) + 1; + *ascent = (int)m_feng.ascender() + 1; fman = &m_fman; } else { *************** *** 158,161 **** --- 160,165 ---- m_image_feng.height(size); m_image_feng.width(size); + *descent = abs((int)m_image_feng.descender()) + 1; + *ascent = (int)m_image_feng.ascender() + 1; fman = &m_image_fman; } *************** *** 167,171 **** x += glyph->advance_x; y += glyph->advance_y; ! if (-glyph->bounds.y1 > *descent) *descent=-glyph->bounds.y1 - 1; } ++p; --- 171,175 ---- x += glyph->advance_x; y += glyph->advance_y; ! //if (-glyph->bounds.y1 > *descent) *descent=-glyph->bounds.y1 - 1; } ++p; *************** *** 261,264 **** --- 265,276 ---- + void roadmap_canvas_erase_area (const RoadMapGuiRect *rect) { + + renderer_pr ren_pr(agg_renb); + ren_pr.fill_color (CurrentPen->color); + ren_pr.solid_rectangle(rect->minx, rect->miny, rect->maxx, rect->maxy); + } + + void roadmap_canvas_draw_string (RoadMapGuiPoint *position, int corner, *************** *** 308,312 **** RoadMapGuiPoint start = {x, y+text_height}; ! roadmap_canvas_draw_string_angle (&start, position, 0, text); } --- 320,324 ---- RoadMapGuiPoint start = {x, y+text_height}; ! roadmap_canvas_draw_string_angle (&start, position, 0, -1, text); } *************** *** 573,579 **** ! void roadmap_canvas_draw_string_angle (RoadMapGuiPoint *position, RoadMapGuiPoint *center, ! int angle, const char *text) { --- 585,592 ---- ! void roadmap_canvas_draw_string_angle (const RoadMapGuiPoint *position, RoadMapGuiPoint *center, ! int angle, int size, ! const char *text) { *************** *** 602,606 **** if ((angle > -5) && (angle < 5)) { ! int size = 15; /* Use faster drawing for text with no angle */ --- 615,619 ---- if ((angle > -5) && (angle < 5)) { ! if (size < 0) size = 15; /* Use faster drawing for text with no angle */ *************** *** 755,759 **** ! void roadmap_canvas_draw_image (RoadMapImage image, RoadMapGuiPoint *pos, int opacity, int mode) { --- 768,772 ---- ! void roadmap_canvas_draw_image (RoadMapImage image, const RoadMapGuiPoint *pos, int opacity, int mode) { |
From: Ehud S. <esh...@us...> - 2006-11-03 12:43:06
|
Update of /cvsroot/roadmap/roadmap_editor/src/editor In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11590 Modified Files: editor_main.c Log Message: Allow running without usdir (as it can be downloaded). Index: editor_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/editor/editor_main.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** editor_main.c 15 Oct 2006 10:48:16 -0000 1.19 --- editor_main.c 3 Nov 2006 12:43:02 -0000 1.20 *************** *** 47,51 **** int EditorPluginID = -1; ! const char *EDITOR_VERSION = "0.8.2"; void editor_main_check_map (void) { --- 47,51 ---- int EditorPluginID = -1; ! const char *EDITOR_VERSION = "0.9.0 pre1"; void editor_main_check_map (void) { *************** *** 61,66 **** } ! if (roadmap_locator_activate (fips) == -1) { roadmap_messagebox ("Error.", "Can't load map data."); } --- 61,67 ---- } ! if (roadmap_locator_activate (fips) != ROADMAP_US_OK) { roadmap_messagebox ("Error.", "Can't load map data."); + return; } |
From: Ehud S. <esh...@us...> - 2006-11-03 12:41:47
|
Update of /cvsroot/roadmap/roadmap_editor/src/editor/export In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11161 Modified Files: editor_sync.c Log Message: Allow running without usdir (as it can be downloaded). Index: editor_sync.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/editor/export/editor_sync.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** editor_sync.c 15 Oct 2006 10:51:05 -0000 1.4 --- editor_sync.c 3 Nov 2006 12:41:38 -0000 1.5 *************** *** 233,258 **** } ! if (roadmap_locator_activate (fips) == -1) { ! roadmap_messagebox ("Error", "Can't load map data."); ! goto end_sync; ! } ! ! now_t = time (NULL); ! map_time_t = atoi(roadmap_metadata_get_attribute ("Version", "UnixTime")); ! if ((map_time_t + 3600*24) > now_t) { ! /* Map is less than 24 hours old. ! * A new version may still be available. ! */ ! now_tm = *gmtime(&now_t); ! map_time_tm = *gmtime(&map_time_t); ! if (now_tm.tm_mday == map_time_tm.tm_mday) { ! goto end_sync; ! } else { ! /* new day - only download if new maps were already generated. */ ! if (now_tm.tm_hour < 2) goto end_sync; } } --- 233,255 ---- } ! if (roadmap_locator_activate (fips) == ROADMAP_US_OK) { ! now_t = time (NULL); ! map_time_t = atoi(roadmap_metadata_get_attribute ("Version", "UnixTime")); ! if ((map_time_t + 3600*24) > now_t) { ! /* Map is less than 24 hours old. ! * A new version may still be available. ! */ ! now_tm = *gmtime(&now_t); ! map_time_tm = *gmtime(&map_time_t); ! if (now_tm.tm_mday == map_time_tm.tm_mday) { ! goto end_sync; ! } else { ! /* new day - only download if new maps were already generated. */ ! if (now_tm.tm_hour < 2) goto end_sync; ! } } } |
From: Ehud S. <esh...@us...> - 2006-11-03 12:40:36
|
Update of /cvsroot/roadmap/roadmap_editor/src/gtk2 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10769 Modified Files: Makefile Log Message: SSD - small screen device. This is a framework for creating dialogs for ssd. This is just an initial implementation and currently does nothing. Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/gtk2/Makefile,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile 8 Oct 2006 20:04:42 -0000 1.9 --- Makefile 3 Nov 2006 12:40:32 -0000 1.10 *************** *** 17,23 **** WARNFLAGS = -W -Wall -Wno-unused-parameter - RDMLIBS= ../libroadmap.a libgtkroadmap.a ../unix/libosroadmap.a ../libroadmap.a libgtkroadmap.a - - ifeq ($(MODE),DEBUG) STDCFLAGS=-g $(WARNFLAGS) -DROADMAP_DEBUG_HEAP --- 17,20 ---- *************** *** 39,42 **** --- 36,46 ---- endif + ifeq ($(SSD),YES) + CFLAGS += -DSSD + SSDLIB=../libssd_widgets.a + endif + + RDMLIBS= ../libroadmap.a libgtkroadmap.a ../unix/libosroadmap.a ../libroadmap.a libgtkroadmap.a + HOST=`uname -s` *************** *** 76,80 **** # --- Conventional targets ---------------------------------------- ! .PHONY: all others build runtime clean cleanone install uninstall all: runtime --- 80,84 ---- # --- Conventional targets ---------------------------------------- ! .PHONY: all others build runtime clean cleanone install uninstall ../libssd_widgets.a all: runtime *************** *** 115,122 **** $(RANLIB) libgtkroadmap.a ! gtkroadmap: roadmap_main.o ../libguiroadmap.a $(RDMLIBS) ! $(CXX) $(LDFLAGS) roadmap_main.o -o gtkroadmap ../libguiroadmap.a $(LIBS) gtkroadgps: roadmap_main.o ../libguiroadgps.a $(RDMLIBS) $(CXX) $(LDFLAGS) roadmap_main.o -o gtkroadgps ../libguiroadgps.a $(LIBS) --- 119,128 ---- $(RANLIB) libgtkroadmap.a ! gtkroadmap: roadmap_main.o $(SSDLIB) ../libguiroadmap.a $(RDMLIBS) ! $(CXX) $(LDFLAGS) roadmap_main.o -o gtkroadmap $(SSDLIB) ../libguiroadmap.a $(LIBS) $(SSDLIB) ../libguiroadmap.a gtkroadgps: roadmap_main.o ../libguiroadgps.a $(RDMLIBS) $(CXX) $(LDFLAGS) roadmap_main.o -o gtkroadgps ../libguiroadgps.a $(LIBS) + ../libssd_widgets.a: + $(MAKE) -C .. libssd_widgets.a |
From: Ehud S. <esh...@us...> - 2006-11-03 12:40:16
|
Update of /cvsroot/roadmap/roadmap_editor/src/navigate In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10382 Modified Files: navigate_dglib.c Log Message: Add support for several speeds per road (according to the time) Index: navigate_dglib.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/navigate/navigate_dglib.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** navigate_dglib.c 14 Oct 2006 10:31:03 -0000 1.7 --- navigate_dglib.c 3 Nov 2006 12:40:11 -0000 1.8 *************** *** 66,69 **** --- 66,70 ---- int to_line = dglEdgeGet_Id(pgraph, pIn->pnEdge); int from_line; + int new_cost; if (pIn->pnPrevEdge != NULL) { *************** *** 78,81 **** --- 79,85 ---- if (from_line == -to_line) return 1; + new_cost = roadmap_line_route_get_cross_time (abs(to_line), (to_line < 0)); + if (new_cost) pOut->nEdgeCost = new_cost; + if (!info->turn_restrictions) return 0; |
From: Ehud S. <esh...@us...> - 2006-11-03 12:39:22
|
Update of /cvsroot/roadmap/roadmap_editor/src/ssd In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10296 Added Files: ssd_button.c ssd_button.h ssd_container.c ssd_container.h ssd_dialog.c ssd_dialog.h ssd_entry.c ssd_entry.h ssd_keyboard.c ssd_menu.c ssd_menu.h ssd_text.c ssd_text.h ssd_widget.c ssd_widget.h Log Message: SSD - small screen device. This is a framework for creating dialogs for ssd. This is just an initial implementation and currently does nothing. --- NEW FILE: ssd_button.c --- /* ssd_button.c - Bitmap button widget * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See ssd_button.h */ #include <string.h> #include <stdlib.h> #include "roadmap.h" #include "roadmap_res.h" #include "roadmap_canvas.h" #include "ssd_widget.h" #include "ssd_button.h" /* Buttons states */ #define BUTTON_STATE_NORMAL 0 #define BUTTON_STATE_SELECTED 1 #define BUTTON_STATE_DISABLED 2 #define MAX_STATES 3 struct ssd_button_data { int state; const char *bitmaps[MAX_STATES]; }; static void draw_button_text (SsdWidget widget, const RoadMapGuiPoint *point) { struct ssd_button_data *data = (struct ssd_button_data *) widget->data; char value[255]; char *key2 = NULL; RoadMapGuiPoint p = *point; int text_size; strncpy(value, widget->value, sizeof(value)); value[sizeof(value)-1] = '\0'; if (widget->flags & SSD_BUTTON_KEY) { p.x += 14; p.y += 18; text_size = 20; key2 = strchr(value, '|'); if (key2) { *key2 = '\0'; key2++; } } else { int text_width; int text_ascent; int text_descent; int text_height; text_size = 14; roadmap_canvas_get_text_extents (value, text_size, &text_width, &text_ascent, &text_descent, NULL); text_height = text_ascent + text_descent; p.x += (widget->size.width - text_width) / 2; p.y += (widget->size.height - text_height) / 2 + text_height / 2; } if (data->state == BUTTON_STATE_SELECTED) { p.x += 2; p.y += 2; } roadmap_canvas_draw_string_angle (&p, NULL, 0, text_size, value); if (widget->flags & SSD_BUTTON_KEY) { if (key2 && strcmp(value, key2)) { p.x += 13; p.y += 13; if (data->state == BUTTON_STATE_SELECTED) { p.x += 2; p.y += 2; } roadmap_canvas_draw_string_angle (&p, NULL, 0, text_size - 5, key2); } } } static void format_below_text (char *text, char **lines, int max_lines) { *lines = text; lines++; *lines = NULL; } static void draw_button_text_below (SsdWidget widget, const RoadMapGuiPoint *point) { char text[255]; char *lines[2]; char **line; RoadMapGuiPoint p = *point; int text_size; strncpy(text, widget->value, sizeof(text)); text[sizeof(text)-1] = '\0'; format_below_text (text, lines, 2); p.y += widget->size.height + 2; line = lines; while (*line) { int text_width; int text_ascent; int text_descent; int text_height; RoadMapGuiPoint text_p = p; text_size = 14; roadmap_canvas_get_text_extents (*line, text_size, &text_width, &text_ascent, &text_descent, NULL); text_height = text_ascent + text_descent; text_p.x += (widget->size.width - text_width) / 2; text_p.y += text_height; roadmap_canvas_draw_string_angle (&text_p, NULL, 0, text_size, *line); p.y += text_height + 2; line++; } } static void draw (SsdWidget widget, const RoadMapGuiPoint *point) { struct ssd_button_data *data = (struct ssd_button_data *) widget->data; RoadMapImage image; int i; for (i=data->state; i>=0; i--) { if (data->bitmaps[i] && (image = roadmap_res_get (RES_BITMAP, 0, data->bitmaps[i]))) { break; } } if (!image) { roadmap_log (ROADMAP_ERROR, "SSD - Can't get image for button widget: %s", widget->name); return; } switch (data->state) { case BUTTON_STATE_NORMAL: roadmap_canvas_draw_image (image, point, 0, IMAGE_NORMAL); break; case BUTTON_STATE_SELECTED: if (i == data->state) { roadmap_canvas_draw_image (image, point, 0, IMAGE_NORMAL); } else { roadmap_canvas_draw_image (image, point, 0, IMAGE_SELECTED); } break; } if ((widget->flags & SSD_BUTTON_KEY) || (widget->flags & SSD_BUTTON_TEXT)) { draw_button_text (widget, point); } if (widget->flags & SSD_BUTTON_TEXT_BELOW) { draw_button_text_below (widget, point); } } int ssd_button_pointer_down (SsdWidget widget, const RoadMapGuiPoint *point) { struct ssd_button_data *data = (struct ssd_button_data *) widget->data; data->state = BUTTON_STATE_SELECTED; return 0; } int ssd_button_short_click (SsdWidget widget, const RoadMapGuiPoint *point) { struct ssd_button_data *data = (struct ssd_button_data *) widget->data; if (widget->callback) { (*widget->callback) (widget->name, SSD_BUTTON_SHORT_CLICK, widget->context); } data->state = BUTTON_STATE_NORMAL; return 0; } int ssd_button_long_click (SsdWidget widget, const RoadMapGuiPoint *point) { struct ssd_button_data *data = (struct ssd_button_data *) widget->data; if (widget->callback) { (*widget->callback) (widget->name, SSD_BUTTON_LONG_CLICK, widget->context); } data->state = BUTTON_STATE_NORMAL; return 0; } static int set_value (SsdWidget widget, const char *value) { struct ssd_button_data *data = (struct ssd_button_data *) widget->data; RoadMapImage bmp; if (widget->value && *widget->value) free (widget->value); if (*value) widget->value = strdup(value); else widget->value = ""; bmp = roadmap_res_get (RES_BITMAP, 0, data->bitmaps[0]); if (!bmp) return -1; widget->size.height = roadmap_canvas_image_height(bmp); widget->size.width = roadmap_canvas_image_width(bmp); return 0; } SsdWidget ssd_button_new (const char *name, const char *value, const char **bitmaps, int num_bitmaps, int flags) { SsdWidget w; struct ssd_button_data *data = (struct ssd_button_data *)calloc (1, sizeof(*data)); int i; w = ssd_widget_new (name, flags); w->typeid = "Button"; w->draw = draw; w->flags = flags; data->state = BUTTON_STATE_NORMAL; for (i=0; i<num_bitmaps; i++) data->bitmaps[i] = bitmaps[i]; w->data = data; set_value (w, value); w->pointer_down = ssd_button_pointer_down; w->short_click = ssd_button_short_click; w->long_click = ssd_button_long_click; w->set_value = set_value; return w; } --- NEW FILE: ssd_keyboard.c --- /* ssd_keyboard.c - Full screen keyboard * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See ssd_keyboard.h. */ #include <wchar.h> #ifdef UNDER_CE size_t __cdecl mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *); size_t __cdecl wcrtomb(char *, wchar_t, mbstate_t *); #endif #include <string.h> #include <stdlib.h> #include "roadmap_lang.h" #include "roadmap_path.h" #include "ssd_dialog.h" #include "ssd_button.h" #define SSD_KEY_CHAR 1 #define SSD_KEY_WORD 2 #define SSD_KEY_CONFIRM 0x1 #define SSD_KEY_SPACE 0x2 #define SSD_KEY_BACKSPACE 0x4 typedef struct ssd_keyboard { const char *name; const char *keys; int special_keys; } SsdKeyboard; SsdKeyboard def_keyboards[] = { {"letters_kbd", "×1×2×3×4×5×6×7×8×9×0××××××× ×ססעעפףצץקקר:ש,ת.", SSD_KEY_CONFIRM | SSD_KEY_SPACE | SSD_KEY_BACKSPACE} }; static int button_callback (const char *name, const char *new_value, void *context) { wchar_t wkeys[3]; char key[20]; char text[255]; int count; int len; if (!strcmp (roadmap_lang_get ("Ok"), name)) { return 0; } else if (!strcmp (roadmap_lang_get ("Del"), name)) { wchar_t wtext[255]; const char *t = ssd_dialog_get_value ("input"); int value_len = strlen(t); if (!value_len) return 1; count = mbsrtowcs(wtext, &t, sizeof(wtext) / sizeof(wchar_t), NULL); len = wcrtomb(key, wtext[count-1], NULL); if ((len <= 0) || (len > value_len)) return 1; if (len == value_len) { ssd_dialog_set_value ("input", ""); return 0; } strncpy(text, ssd_dialog_get_value ("input"), sizeof(text)); text[sizeof(text)-1] = '\0'; text[strlen(text) - len] = '\0'; ssd_dialog_set_value ("input", text); return 0; } else if (!strcmp (roadmap_lang_get ("SPC"), name)) { len = 1; strcpy (key, " "); } else { const char *value = ssd_dialog_get_value (name); count = mbsrtowcs(wkeys, &value, sizeof(wkeys) / sizeof(wchar_t), NULL); if (count <= 0) return 1; if (!strcmp(new_value, SSD_BUTTON_SHORT_CLICK)) { if ((len = wcrtomb(key, wkeys[0], NULL)) <= 0) return 1; } else { if ((len = wcrtomb(key, wkeys[2], NULL)) <= 0) return 1; } key[len] = '\0'; } strncpy(text, ssd_dialog_get_value ("input"), sizeof(text)); text[sizeof(text)-1] = '\0'; if ((strlen(text) + len) >= sizeof(text)) return 1; strcat(text, key); ssd_dialog_set_value ("input", text); return 0; } static void add_key (const char *key1, const char *key2, int type) { char name[255]; char value[255]; const char *icons[] = { "key_button1.bmp", "key_button2.bmp" }; strcpy(name, key1); strcpy(value, key1); if (type == SSD_BUTTON_KEY) { strcat(value, "|"); strcat(value, key2); } ssd_dialog_new_button (name, value, icons, 2, type, button_callback); } static void ssd_keyboard_new (SsdKeyboard *keyboard) { wchar_t wkeys[100]; const char *keys = keyboard->keys; int count; int i; if (!ssd_dialog_activate (keyboard->name, NULL)) return; count = mbsrtowcs(wkeys, &keys, sizeof(wkeys) / sizeof(wchar_t), NULL); ssd_dialog_new (keyboard->name, "", 0); ssd_dialog_new_entry ("input", "", 0, NULL); for (i=0; i<count/2; i++) { char key1[20]; char key2[20]; int len; if ((len = wcrtomb(key1, wkeys[i*2], NULL)) <= 0) continue; key1[len] = '\0'; if ((len = wcrtomb(key2, wkeys[i*2+1], NULL)) <= 0) continue; key2[len] = '\0'; add_key (key1, key2, SSD_BUTTON_KEY); } ssd_dialog_new_line (); if (keyboard->special_keys & SSD_KEY_CONFIRM) { add_key (roadmap_lang_get ("Ok"), NULL, SSD_BUTTON_TEXT); } if (keyboard->special_keys & SSD_KEY_BACKSPACE) { add_key (roadmap_lang_get ("Del"), NULL, SSD_BUTTON_TEXT); } if (keyboard->special_keys & SSD_KEY_SPACE) { add_key (roadmap_lang_get ("SPC"), NULL, SSD_BUTTON_TEXT); } ssd_dialog_activate (keyboard->name, NULL); ssd_dialog_draw (); } void ssd_keyboard_show (void) { ssd_keyboard_new (&def_keyboards[0]); } --- NEW FILE: ssd_button.h --- /* ssd_button.h - Button widget * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SSD_WIDGET_BUTTON_H_ #define __SSD_WIDGET_BUTTON_H_ #include "roadmap_canvas.h" #include "ssd_widget.h" #define SSD_BUTTON_SHORT_CLICK "short_click" #define SSD_BUTTON_LONG_CLICK "long_click" SsdWidget ssd_button_new (const char *name, const char *value, const char **bitmaps, int num_bitmaps, int flags); #endif // __SSD_WIDGET_BUTTON_H_ --- NEW FILE: ssd_container.h --- /* ssd_text.h - Static text widget * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SSD_WIDGET_CONTAINER_H_ #define __SSD_WIDGET_CONTAINER_H_ #include "ssd_widget.h" SsdWidget ssd_container_new (const char *name, const char *title, int flags); #endif // __SSD_WIDGET_CONTAINER_H_ --- NEW FILE: ssd_text.h --- /* ssd_text.h - Static text widget * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SSD_WIDGET_TEXT_H_ #define __SSD_WIDGET_TEXT_H_ #include "ssd_widget.h" SsdWidget ssd_text_new (const char *name, const char *value, int flags); #endif // __SSD_WIDGET_TEXT_H_ --- NEW FILE: ssd_text.c --- /* ssd_text.c - Static text widget * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See ssd_text.h */ #include <stdlib.h> #include <string.h> #include "roadmap.h" #include "roadmap_canvas.h" #include "ssd_widget.h" #include "ssd_text.h" static int initialized; static RoadMapPen pen; static void init_containers (void) { pen = roadmap_canvas_create_pen ("ssd_text_pen"); roadmap_canvas_set_foreground ("#ffffff"); initialized = 1; } static void draw (SsdWidget widget, const RoadMapGuiPoint *point) { RoadMapGuiPoint p = *point; p.y += widget->size.height / 2 + 2; roadmap_canvas_draw_string_angle (&p, NULL, 0, -1, widget->value); } static int set_value (SsdWidget widget, const char *value) { int text_width; int text_ascent; int text_descent; int text_height; if (widget->value && *widget->value) free (widget->value); if (*value) widget->value = strdup(value); else widget->value = ""; roadmap_canvas_get_text_extents (value, -1, &text_width, &text_ascent, &text_descent, NULL); text_height = text_ascent + text_descent; widget->size.width = text_width; widget->size.height = text_height; return 0; } SsdWidget ssd_text_new (const char *name, const char *value, int flags) { SsdWidget w; if (!initialized) { init_containers(); } w = ssd_widget_new (name, flags); w->typeid = "Text"; w->draw = draw; w->set_value = set_value; w->flags = flags; set_value (w, value); return w; } --- NEW FILE: ssd_container.c --- /* ssd_container.c - Container widget * (requires agg) * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See ssd_widget.h */ #include <string.h> #include <stdlib.h> #include "roadmap_canvas.h" #include "ssd_widget.h" #include "ssd_text.h" #include "ssd_container.h" static int initialized; static RoadMapPen bg; static RoadMapPen border; static void init_containers (void) { bg = roadmap_canvas_create_pen ("container_bg"); roadmap_canvas_set_foreground ("#000000"); border = roadmap_canvas_create_pen ("container_border"); roadmap_canvas_set_foreground ("#ffffff"); roadmap_canvas_set_thickness (2); initialized = 1; } static void draw (SsdWidget widget, const RoadMapGuiPoint *point) { RoadMapGuiRect rect; RoadMapGuiPoint points[5]; int count = 5; rect.minx = point->x; rect.miny = point->y; rect.maxx = rect.minx + widget->size.width - 1; rect.maxy = rect.miny + widget->size.height - 1; roadmap_canvas_select_pen (bg); roadmap_canvas_erase_area (&rect); roadmap_canvas_select_pen (border); points[0].x = rect.minx; points[0].y = rect.miny; points[1].x = rect.maxx; points[1].y = rect.miny; points[2].x = rect.maxx; points[2].y = rect.maxy; points[3].x = rect.minx; points[3].y = rect.maxy; points[4].x = rect.minx; points[4].y = rect.miny; roadmap_canvas_draw_multiple_lines (1, &count, points, 0); rect.minx += 3; rect.miny += 3; rect.maxx -= 3; rect.maxy -= 3; ssd_widget_draw (widget->children, &rect); } static int set_value (SsdWidget widget, const char *value) { widget = ssd_widget_get (widget->children, "title"); if (widget) { return widget->set_value (widget, value); } else { return -1; } } SsdWidget ssd_container_new (const char *name, const char *title, int flags) { SsdWidget w; if (!initialized) { init_containers(); } w = ssd_widget_new (name, flags); w->typeid = "Container"; w->draw = draw; w->set_value = set_value; w->size.width = roadmap_canvas_width (); w->size.height = roadmap_canvas_height (); w->children = ssd_text_new ("title", title, SSD_ALIGN_CENTER|SSD_END_ROW); return w; } --- NEW FILE: ssd_entry.c --- /* ssd_entry.c - Text entry widget * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See ssd_entry.h */ #include <stdlib.h> #include <string.h> #include "roadmap.h" #include "roadmap_canvas.h" #include "ssd_widget.h" #include "ssd_entry.h" static int initialized; static RoadMapPen bg; static RoadMapPen text_pen; static void draw_text (SsdWidget widget, const RoadMapGuiRect *rect) { int text_width; int text_ascent; int text_descent; int text_height; RoadMapGuiPoint p; roadmap_canvas_get_text_extents (widget->value, -1, &text_width, &text_ascent, &text_descent, NULL); text_height = text_ascent + text_descent; if (ssd_widget_rtl()) { p.x = rect->maxx - text_width; } else { p.x = rect->minx; } p.y = rect->maxy - text_height / 2; roadmap_canvas_draw_string_angle (&p, NULL, 0, -1, widget->value); } static void init (void) { bg = roadmap_canvas_create_pen ("ssd_entry_bg"); roadmap_canvas_set_foreground ("#ffffff"); text_pen = roadmap_canvas_create_pen ("ssd_entry_txt"); roadmap_canvas_set_foreground ("#000000"); initialized = 1; } static void draw (SsdWidget widget, const RoadMapGuiPoint *point) { RoadMapGuiRect rect; RoadMapGuiPoint points[5]; int count = 5; rect.minx = point->x; rect.miny = point->y; rect.maxx = rect.minx + widget->size.width - 1; rect.maxy = rect.miny + widget->size.height - 1; roadmap_canvas_select_pen (bg); roadmap_canvas_erase_area (&rect); roadmap_canvas_select_pen (text_pen); points[0].x = rect.minx; points[0].y = rect.miny; points[1].x = rect.maxx; points[1].y = rect.miny; points[2].x = rect.maxx; points[2].y = rect.maxy; points[3].x = rect.minx; points[3].y = rect.maxy; points[4].x = rect.minx; points[4].y = rect.miny; roadmap_canvas_draw_multiple_lines (1, &count, points, 0); rect.minx += 2; rect.miny += 2; rect.maxx -= 2; rect.maxy -= 2; draw_text (widget, &rect); } static int set_value (SsdWidget widget, const char *value) { if (widget->value && *widget->value) free (widget->value); if (*value) widget->value = strdup(value); else widget->value = ""; return 0; } SsdWidget ssd_entry_new (const char *name, const char *value, int flags) { SsdWidget w; if (!initialized) { init (); } w = ssd_widget_new (name, flags); w->typeid = "Entry"; w->draw = draw; w->set_value = set_value; w->flags = flags; w->size.height = 20; w->size.width = roadmap_canvas_width() - 6; set_value (w, value); return w; } --- NEW FILE: ssd_widget.h --- /* ssd_widget.h - defines a generic widget * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SSD_WIDGET_H_ #define __SSD_WIDGET_H_ #include "roadmap_gui.h" #define SSD_ALIGN_CENTER 0x1 #define SSD_ALIGN_RIGHT 0x2 #define SSD_START_NEW_ROW 0x4 #define SSD_END_ROW 0x8 /* Buttons flags */ #define SSD_BUTTON_KEY 0x100 #define SSD_BUTTON_TEXT 0x200 #define SSD_BUTTON_TEXT_BELOW 0x400 typedef struct ssd_size { unsigned short width; unsigned short height; } SsdSize; struct ssd_widget; typedef struct ssd_widget *SsdWidget; /* Widget callback. If it returns non zero, the new_value should not be * applied. */ typedef int (*SsdCallback) (const char *name, const char *new_value, void *context); struct ssd_widget { char *typeid; struct ssd_widget *next; const char *name; char *value; struct ssd_widget *children; SsdSize size; int flags; SsdCallback callback; void *context; /* References a caller-specific context. */ RoadMapGuiPoint position; void *data; /* Widget specific data */ int (*set_value) (SsdWidget widget, const char *value); void (*draw) (SsdWidget widget, const RoadMapGuiPoint *point); int (*pointer_down) (SsdWidget widget, const RoadMapGuiPoint *point); int (*short_click) (SsdWidget widget, const RoadMapGuiPoint *point); int (*long_click) (SsdWidget widget, const RoadMapGuiPoint *point); }; SsdWidget ssd_widget_new (const char *name, int flags); SsdWidget ssd_widget_get (SsdWidget child, const char *name); void ssd_widget_draw (SsdWidget w, const RoadMapGuiRect *rect); void ssd_widget_set_callback (SsdWidget widget, SsdCallback callback); int ssd_widget_rtl (void); void ssd_widget_pointer_down (SsdWidget widget, RoadMapGuiPoint *point); void ssd_widget_short_click (SsdWidget widget, RoadMapGuiPoint *point); void ssd_widget_long_click (SsdWidget widget, RoadMapGuiPoint *point); const char *ssd_widget_get_value (const SsdWidget widget, const char *name); int ssd_widget_set_value (const SsdWidget widget, const char *name, const char *value); #endif // __SSD_WIDGET_H_ --- NEW FILE: ssd_dialog.c --- /* ssd_dialog.c - small screen devices Widgets (designed for touchscreens) * (requires agg) * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See ssd_dialog.h */ #include <string.h> #include <stdlib.h> #include "roadmap.h" #include "roadmap_types.h" #include "roadmap_start.h" #include "roadmap_lang.h" #include "roadmap_pointer.h" #include "ssd_widget.h" #include "ssd_container.h" #include "ssd_entry.h" #include "ssd_button.h" #include "ssd_dialog.h" struct ssd_dialog_item; typedef struct ssd_dialog_item *SsdDialog; struct ssd_dialog_item { struct ssd_dialog_item *next; struct ssd_dialog_item *activated_prev; char *name; void *context; /* References a caller-specific context. */ SsdWidget container; }; static SsdDialog RoadMapDialogWindows = NULL; static SsdDialog RoadMapDialogCurrent = NULL; static RoadMapPointerClickHandler PrevPressedClickHandler; static RoadMapPointerHandler PrevShortClickHandler; static RoadMapPointerHandler PrevLongClickHandler; static RoadMapGuiPoint LastPointerPoint; static SsdDialog ssd_dialog_get (const char *name) { SsdDialog child; child = RoadMapDialogWindows; while (child != NULL) { if (strcmp (child->name, name) == 0) { return child; } child = child->next; } return NULL; } #if 0 int ssd_dialog_activate (const char *name, void *context) { SsdDialog dialog = ssd_dialog_get (NULL, name); dialog->context = context; if (dialog->w != NULL) { /* The dialog exists already: show it on top. */ RoadMapDialogCurrent = dialog; gdk_window_show (dialog->w->window); gdk_window_raise (dialog->w->window); gtk_widget_show_all (GTK_WIDGET(dialog->w)); return 0; /* Tell the caller the dialog already exists. */ } /* Create the dialog's window. */ dialog->w = gtk_dialog_new(); #ifdef ROADMAP_USES_GPE displaymigration_mark_window (dialog->w); #endif gtk_window_set_title (GTK_WINDOW(dialog->w), ssd_start_get_title(name)); gtk_button_box_set_layout (GTK_BUTTON_BOX(GTK_DIALOG(dialog->w)->action_area), GTK_BUTTONBOX_SPREAD); return 1; /* Tell the caller this is a new, undefined, dialog. */ } void ssd_dialog_hide (const char *name) { ssd_dialog_hide_window (ssd_dialog_get (NULL, name)); } void ssd_dialog_new_entry (const char *frame, const char *name, RoadMapDialogCallback callback) { GtkWidget *w = gtk_entry_new (); SsdDialog child = ssd_dialog_new_item (frame, name, w, 0); child->callback = callback; child->widget_type = SSD_WIDGET_ENTRY; g_signal_connect (w, "activate", (GCallback) ssd_dialog_action, child); } void ssd_dialog_new_mul_entry (const char *frame, const char *name, RoadMapDialogCallback callback) { GtkWidget *w = gtk_text_view_new (); SsdDialog child = ssd_dialog_new_item (frame, name, w, 0); child->callback = callback; child->widget_type = SSD_WIDGET_MUL_ENTRY; } void ssd_dialog_new_progress (const char *frame, const char *name) { name = "Progress"; GtkWidget *w = gtk_label_new (name); SsdDialog child = ssd_dialog_new_item (frame, name, w, 0); child->widget_type = SSD_WIDGET_LABEL; } void ssd_dialog_new_image (const char *frame, const char *name) {} void ssd_dialog_new_password (const char *frame, const char *name) { GtkWidget *w = gtk_entry_new (); gtk_entry_set_visibility(GTK_ENTRY(w), FALSE); SsdDialog child = ssd_dialog_new_item (frame, name, w, 0); child->widget_type = SSD_WIDGET_PASSWORD; } void ssd_dialog_new_label (const char *frame, const char *name) { GtkWidget *w = gtk_label_new (name); SsdDialog child = ssd_dialog_new_item (frame, name, w, 0); child->widget_type = SSD_WIDGET_LABEL; } void ssd_dialog_new_color (const char *frame, const char *name) { ssd_dialog_new_entry (frame, name, NULL); } void ssd_dialog_new_choice (const char *frame, const char *name, int count, const char **labels, void **values, RoadMapDialogCallback callback) { int i; GtkWidget *w = gtk_option_menu_new (); SsdDialog child = ssd_dialog_new_item (frame, name, w, 0); GtkWidget *menu; GtkWidget *menu_item; RoadMapDialogSelection *choice; child->widget_type = SSD_WIDGET_CHOICE; if (labels == values) { child->data_is_string = 1; } menu = gtk_menu_new (); choice = (RoadMapDialogSelection *) calloc (count, sizeof(*choice)); roadmap_check_allocated(choice); for (i = 0; i < count; ++i) { choice[i].typeid = "RoadMapDialogSelection"; choice[i].item = child; choice[i].value = values[i]; choice[i].callback = callback; menu_item = gtk_menu_item_new_with_label (labels[i]); if (child->data_is_string) { GtkWidget *menu_label = gtk_bin_get_child(GTK_BIN(menu_item)); choice[i].value = gtk_label_get_text(GTK_LABEL(menu_label)); } gtk_menu_shell_append (GTK_MENU_SHELL(menu), menu_item); g_signal_connect_swapped (menu_item, "activate", (GCallback) ssd_dialog_chosen, (gpointer) (choice+i)); gtk_widget_show (menu_item); } gtk_option_menu_set_menu (GTK_OPTION_MENU(w), menu); if (child->choice != NULL) { free(child->choice); } child->choice = choice; child->num_choices = count; child->value = choice[0].value; } void ssd_dialog_new_list (const char *frame, const char *name) { GtkWidget *listbox; GtkListStore *store; GtkTreeViewColumn *column; GtkWidget *scrollbox = gtk_scrolled_window_new (NULL, NULL); SsdDialog child = ssd_dialog_new_item (frame, name, scrollbox, 1); store = gtk_list_store_new (RM_LIST_WAYPOINT_COLUMNS, G_TYPE_STRING); listbox = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); g_object_unref (G_OBJECT (store)); // gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(listbox), 0); gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(scrollbox), listbox); child->w = listbox; child->widget_type = SSD_WIDGET_LIST; if (name[0] == '.') name += 1; column = gtk_tree_view_column_new_with_attributes (name, gtk_cell_renderer_text_new (), "text", RM_LIST_WAYPOINT_NAME, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (listbox), column); gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (listbox)), GTK_SELECTION_SINGLE); } static int listview_sort_cmp (const void *a, const void *b) { RoadMapDialogSelection *c1 = (RoadMapDialogSelection *)a; RoadMapDialogSelection *c2 = (RoadMapDialogSelection *)b; return strcmp (c1->value, c2->value); } void ssd_dialog_show_list (const char *frame, const char *name, int count, char **labels, void **values, RoadMapDialogCallback callback) { int i; SsdDialog parent; SsdDialog child; RoadMapDialogSelection *choice; char *empty_list[1] = {""}; GtkTreeModel *model; GtkTreeIter iterator; parent = ssd_dialog_get (RoadMapDialogCurrent, frame); if (parent->w == NULL) { roadmap_log (ROADMAP_ERROR, "list %s in dialog %s filled before built", name, frame); return; } child = ssd_dialog_get (parent, name); if (child->w == NULL) { roadmap_log (ROADMAP_ERROR, "list %s in dialog %s filled before finished", name, frame); return; } model = gtk_tree_view_get_model (GTK_TREE_VIEW(child->w)); if (child->choice != NULL) { gtk_list_store_clear (GTK_LIST_STORE(model)); free (child->choice); child->choice = NULL; } if (!count) { count = 1; labels = values = empty_list; } choice = (RoadMapDialogSelection *) calloc (count, sizeof(*choice)); roadmap_check_allocated(choice); for (i = 0; i < count; ++i) { choice[i].typeid = "RoadMapDialogSelection"; choice[i].item = child; choice[i].value = values[i]; choice[i].callback = callback; } qsort(choice, count, sizeof(*choice), listview_sort_cmp); gtk_tree_selection_set_select_function (gtk_tree_view_get_selection (GTK_TREE_VIEW (child->w)), ssd_dialog_list_selected, (gpointer)choice, NULL); for (i = 0; i < count; ++i) { gtk_list_store_append (GTK_LIST_STORE(model), &iterator); gtk_list_store_set (GTK_LIST_STORE(model), &iterator, RM_LIST_WAYPOINT_NAME, choice[i].value, -1); if (i == 0) { gtk_tree_selection_select_iter (gtk_tree_view_get_selection(GTK_TREE_VIEW (child->w)), &iterator); } } child->choice = choice; child->num_choices = count; child->value = choice[0].value; gtk_widget_show (parent->w); } void ssd_dialog_add_button (const char *label, RoadMapDialogCallback callback) { SsdDialog dialog = RoadMapDialogCurrent; SsdDialog child; GtkWidget *button = gtk_button_new_with_label (label); child = ssd_dialog_get (dialog, label); child->w = button; child->callback = callback; child->widget_type = SSD_WIDGET_BUTTON; g_signal_connect (button, "clicked", (GCallback) ssd_dialog_action, child); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog->w)->action_area), button, TRUE, FALSE, 0); gtk_widget_grab_default (button); } void ssd_dialog_complete (int use_keyboard) { int count; SsdDialog dialog = RoadMapDialogCurrent; SsdDialog frame; count = 0; for (frame = dialog->children; frame != NULL; frame = frame->next) { if (frame->widget_type == SSD_WIDGET_CONTAINER) { count += 1; } } if (count > 1) { /* There are several frames in that dialog: use a notebook widget * to let the user access all of them. */ GtkWidget *notebook = gtk_notebook_new(); gtk_notebook_set_scrollable (GTK_NOTEBOOK(notebook), TRUE); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog->w)->vbox), notebook, TRUE, TRUE, 0); for (frame = dialog->children; frame != NULL; frame = frame->next) { if (frame->widget_type == SSD_WIDGET_CONTAINER) { GtkWidget *label = gtk_label_new (frame->name); gtk_notebook_append_page (GTK_NOTEBOOK(notebook), frame->w, label); } } } else if (count == 1) { /* There is only one frame in that dialog: show it straight. */ for (frame = dialog->children; frame != NULL; frame = frame->next) { if (frame->widget_type == SSD_WIDGET_CONTAINER) { gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog->w)->vbox), frame->w, TRUE, TRUE, 0); break; } } } else { roadmap_log (ROADMAP_FATAL, "no frame defined for dialog %s", dialog->name); } if (use_keyboard) { SsdDialog last_item = NULL; RoadMapKeyboard keyboard = ssd_keyboard_new (); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog->w)->vbox), ssd_keyboard_widget(keyboard), TRUE, TRUE, 0); for (frame = dialog->children; frame != NULL; frame = frame->next) { if (frame->widget_type == SSD_WIDGET_CONTAINER) { SsdDialog item; for (item = frame->children; item != NULL; item = item->next) { if (item->widget_type == SSD_WIDGET_ENTRY) { g_signal_connect (item->w, "button_press_event", (GCallback) ssd_dialog_selected, keyboard); last_item = item; } } } } if (last_item != NULL) { ssd_keyboard_set_focus (keyboard, last_item->w); } } gtk_container_set_border_width (GTK_CONTAINER(GTK_BOX(GTK_DIALOG(dialog->w)->vbox)), 4); g_signal_connect (dialog->w, "destroy", (GCallback) ssd_dialog_destroyed, dialog); gtk_grab_add (dialog->w); ssd_main_set_window_size (dialog->w, ssd_option_width(dialog->name), ssd_option_height(dialog->name)); gtk_widget_show_all (GTK_WIDGET(dialog->w)); } void ssd_dialog_select (const char *dialog) { RoadMapDialogCurrent = ssd_dialog_get (NULL, dialog); } void ssd_dialog_set_focus (const char *frame, const char *name) { } void *ssd_dialog_get_data (const char *frame, const char *name) { SsdDialog this_frame; SsdDialog this_item; this_frame = ssd_dialog_get (RoadMapDialogCurrent, frame); this_item = ssd_dialog_get (this_frame, name); switch (this_item->widget_type) { case SSD_WIDGET_PASSWORD: case SSD_WIDGET_ENTRY: return (void *)gtk_entry_get_text (GTK_ENTRY(this_item->w)); case SSD_WIDGET_LABEL: return (void *)gtk_label_get_text (GTK_LABEL(this_item->w)); case SSD_WIDGET_MUL_ENTRY: { GtkTextIter start, end; gtk_text_buffer_get_bounds (gtk_text_view_get_buffer (GTK_TEXT_VIEW(this_item->w)), &start, &end ); return gtk_text_buffer_get_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW(this_item->w)), &start, &end, TRUE); } break; } return this_item->value; } void ssd_dialog_set_data (const char *frame, const char *name, const void *data) { SsdDialog this_frame; SsdDialog this_item; int i; this_frame = ssd_dialog_get (RoadMapDialogCurrent, frame); this_item = ssd_dialog_get (this_frame, name); switch (this_item->widget_type) { case SSD_WIDGET_PASSWORD: case SSD_WIDGET_ENTRY: gtk_entry_set_text (GTK_ENTRY(this_item->w), (const char *)data); break; case SSD_WIDGET_MUL_ENTRY: { GtkTextBuffer *buffer = gtk_text_buffer_new (NULL); gtk_text_buffer_set_text (buffer, (const char *)data, strlen(data)); gtk_text_view_set_buffer (GTK_TEXT_VIEW(this_item->w), buffer); g_object_unref (buffer); } break; case SSD_WIDGET_LABEL: gtk_label_set_text (GTK_LABEL(this_item->w), (const char *)data); break; case SSD_WIDGET_CHOICE: for (i=0; i < this_item->num_choices; i++) { if ((data == this_item->choice[i].value) || (this_item->data_is_string && !strcmp (this_item->choice[i].value, data))) { gtk_option_menu_set_history (GTK_OPTION_MENU(this_item->w), i); break; } } if ((i == this_item->num_choices) && this_item->data_is_string) { RoadMapDialogSelection *choice; GtkMenuItem *item; GtkWidget *menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(this_item->w)); GList *glist = gtk_container_get_children (GTK_CONTAINER(menu)); int count = this_item->num_choices + 1; choice = (RoadMapDialogSelection *) realloc (this_item->choice, count * sizeof(*choice)); roadmap_check_allocated(choice); for (i = 0; i < count-1; ++i) { item = g_list_nth_data (glist, i); g_signal_handlers_disconnect_by_func (item, (GCallback) ssd_dialog_chosen, this_item->choice + i); g_signal_connect_swapped (item, "activate", (GCallback) ssd_dialog_chosen, (gpointer) (choice+i)); } this_item->choice = choice; g_list_free (glist); item = gtk_menu_item_new_with_label ((const char *)data); gtk_menu_shell_append (GTK_MENU_SHELL(menu), item); g_signal_connect_swapped (item, "activate", (GCallback) ssd_dialog_chosen, (gpointer) (choice+i)); memcpy (this_item->choice + this_item->num_choices, this_item->choice + this_item->num_choices - 1, sizeof(RoadMapDialogSelection)); menu = gtk_bin_get_child(GTK_BIN(item)); this_item->choice[this_item->num_choices].value = gtk_label_get_text(GTK_LABEL(menu)); this_item->num_choices++; gtk_widget_show (item); gtk_option_menu_set_history (GTK_OPTION_MENU(this_item->w), i); } break; } this_item->value = (char *)data; } void ssd_dialog_set_progress (const char *frame, const char *name, int progress) { SsdDialog this_frame; SsdDialog this_item; int i; char data[100]; this_frame = ssd_dialog_get (RoadMapDialogCurrent, frame); this_item = ssd_dialog_get (this_frame, name); if (this_item->widget_type != SSD_WIDGET_LABEL) return; snprintf(data, sizeof(data), "%d", progress); gtk_label_set_text (GTK_LABEL(this_item->w), (const char *)data); } /***********************************************************************/ #endif static int ssd_dialog_pressed (RoadMapGuiPoint *point) { LastPointerPoint = *point; ssd_widget_pointer_down (RoadMapDialogCurrent->container, point); ssd_dialog_draw (); return 1; } static void ssd_dialog_short_click (RoadMapGuiPoint *point) { ssd_widget_short_click (RoadMapDialogCurrent->container, &LastPointerPoint); ssd_dialog_draw (); } static void ssd_dialog_long_click (RoadMapGuiPoint *point) { ssd_widget_long_click (RoadMapDialogCurrent->container, &LastPointerPoint); ssd_dialog_draw (); } static void append_child (SsdWidget child) { SsdWidget last = RoadMapDialogWindows->container->children; while (last->next) last=last->next; last->next = child; } void ssd_dialog_new (const char *name, const char *title, int flags) { SsdDialog child; child = (SsdDialog) malloc (sizeof (*child)); roadmap_check_allocated(child); child->name = strdup(name); child->container = ssd_container_new (name, title, flags); child->next = RoadMapDialogWindows; RoadMapDialogWindows = child; } void ssd_dialog_draw (void) { if (!RoadMapDialogCurrent) { return; } else { RoadMapGuiRect rect = {0, 0, roadmap_canvas_width() - 1, roadmap_canvas_height() - 1}; ssd_widget_draw (RoadMapDialogCurrent->container, &rect); roadmap_canvas_refresh (); } } void ssd_dialog_new_entry (const char *name, const char *value, int flags, SsdCallback callback) { SsdWidget child = ssd_entry_new (name, value, flags); append_child (child); ssd_widget_set_callback (child, callback); } void ssd_dialog_new_button (const char *name, const char *value, const char **bitmaps, int num_bitmaps, int flags, SsdCallback callback) { SsdWidget child = ssd_button_new (name, value, bitmaps, num_bitmaps, flags); append_child (child); ssd_widget_set_callback (child, callback); } void ssd_dialog_new_line (void) { SsdWidget last = RoadMapDialogWindows->container->children; while (last->next) last=last->next; last->flags |= SSD_END_ROW; } int ssd_dialog_activate (const char *name, void *context) { SsdDialog dialog = ssd_dialog_get (name); if (!dialog) { return 1; /* Tell the caller this is a new, undefined, dialog. */ } dialog->context = context; dialog->activated_prev = RoadMapDialogCurrent; if (!RoadMapDialogCurrent) { /* Grab pointer hooks */ PrevPressedClickHandler = roadmap_pointer_register_pressed (ssd_dialog_pressed); PrevShortClickHandler = roadmap_pointer_register_short_click (ssd_dialog_short_click); PrevLongClickHandler = roadmap_pointer_register_long_click (ssd_dialog_long_click); } RoadMapDialogCurrent = dialog; return 0; /* Tell the caller the dialog already exists. */ } void ssd_dialog_hide (const char *name) { if (!RoadMapDialogCurrent) { roadmap_log (ROADMAP_FATAL, "Trying to hide a dialog, but no active dialogs exist"); } RoadMapDialogCurrent = RoadMapDialogCurrent->activated_prev; if (!RoadMapDialogCurrent) { roadmap_pointer_register_pressed (PrevPressedClickHandler); roadmap_pointer_register_short_click (PrevShortClickHandler); roadmap_pointer_register_long_click (PrevLongClickHandler); } } const char *ssd_dialog_get_value (const char *name) { return ssd_widget_get_value (RoadMapDialogCurrent->container, name); } int ssd_dialog_set_value (const char *name, const char *value) { return ssd_widget_set_value (RoadMapDialogCurrent->container, name, value); } --- NEW FILE: ssd_menu.c --- /* ssd_menu.c - Icons menu * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See ssd_menu.h. */ #include <string.h> #include <stdlib.h> #include "roadmap_lang.h" #include "roadmap_path.h" #include "roadmap_factory.h" #include "ssd_dialog.h" #include "ssd_button.h" #include "ssd_menu.h" static int button_callback (const char *name, const char *new_value, void *context) { #if 0 wchar_t wkeys[3]; char key[20]; char text[255]; int count; int len; if (!strcmp (roadmap_lang_get ("Ok"), name)) { return 0; } else if (!strcmp (roadmap_lang_get ("Del"), name)) { wchar_t wtext[255]; const char *t = ssd_dialog_get_value ("input"); int value_len = strlen(t); if (!value_len) return 1; count = mbsrtowcs(wtext, &t, sizeof(wtext) / sizeof(wchar_t), NULL); len = wcrtomb(key, wtext[count-1], NULL); if ((len <= 0) || (len > value_len)) return 1; if (len == value_len) { ssd_dialog_set_value ("input", ""); return 0; } strncpy(text, ssd_dialog_get_value ("input"), sizeof(text)); text[sizeof(text)-1] = '\0'; text[strlen(text) - len] = '\0'; ssd_dialog_set_value ("input", text); return 0; } else if (!strcmp (roadmap_lang_get ("SPC"), name)) { len = 1; strcpy (key, " "); } else { count = mbsrtowcs(wkeys, &name, sizeof(wkeys) / sizeof(wchar_t), NULL); if (count <= 0) return 1; if (!strcmp(new_value, SSD_BUTTON_SHORT_CLICK)) { if ((len = wcrtomb(key, wkeys[0], NULL)) <= 0) return 1; } else { if ((len = wcrtomb(key, wkeys[1], NULL)) <= 0) return 1; } key[len] = '\0'; } strncpy(text, ssd_dialog_get_value ("input"), sizeof(text)); text[sizeof(text)-1] = '\0'; if ((strlen(text) + len) >= sizeof(text)) return 1; strcat(text, key); ssd_dialog_set_value ("input", text); #endif return 0; } static void ssd_menu_new (const char *name, const char *items[], const RoadMapAction *actions) { int i; const char **menu_items; const char *icons[] = { "sync.bmp" }; ssd_dialog_new (name, "", 0); menu_items = items; for (i = 0; menu_items[i] != NULL; ++i) { const char *item = menu_items[i]; if (item == RoadMapFactorySeparator) { } else { ssd_dialog_new_button (item, "test", icons, 1, SSD_ALIGN_CENTER | SSD_BUTTON_TEXT_BELOW, button_callback); } } ssd_dialog_activate (name, NULL); } void ssd_menu_activate (const char *name, const char *items[], const RoadMapAction *actions) { if (!ssd_dialog_activate (name, NULL)) return; ssd_menu_new (name, items, actions); } --- NEW FILE: ssd_widget.c --- /* ssd_widget.c - small screen devices Widgets (designed for touchscreens) * (requires agg) * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See ssd_widget.h */ #include <string.h> #include <stdlib.h> #include "roadmap.h" #include "roadmap_lang.h" #include "ssd_widget.h" #define SSD_WIDGET_SEP 2 SsdWidget ssd_widget_get (SsdWidget child, const char *name) { while (child != NULL) { if (strcmp (child->name, name) == 0) { return child; } if (child->children != NULL) { SsdWidget w = ssd_widget_get (child->children, name); if (w) return w; } child = child->next; } return NULL; } static void ssd_widget_draw_one (SsdWidget w, int x, int y, int height) { w->position.x = x; w->position.y = y; w->position.y += (height - w->size.height) / 2; w->draw(w, &w->position); } static int ssd_widget_draw_row (SsdWidget *w, int count, int width, int x, int y) { int height = 0; int cur_x; int total_width; int space; int i; if (ssd_widget_rtl ()) cur_x = x; else cur_x = x + width; for (i=0; i<count; i++) { if (w[i]->size.height > height) height = w[i]->size.height; } for (i=count-1; i>0; i--) { if (w[i]->flags & SSD_ALIGN_RIGHT) { if (ssd_widget_rtl ()) { ssd_widget_draw_one (w[i], cur_x, y, height); cur_x += w[i]->size.width + SSD_WIDGET_SEP; } else { cur_x -= w[i]->size.width; ssd_widget_draw_one (w[i], cur_x, y, height); cur_x -= SSD_WIDGET_SEP; } width -= w[i]->size.width + SSD_WIDGET_SEP; count--; } else { break; } } if (ssd_widget_rtl ()) cur_x = x + width; else cur_x = x; while (count > 0) { if (w[0]->flags & SSD_ALIGN_CENTER) { break; } if (ssd_widget_rtl ()) { cur_x -= w[0]->size.width; ssd_widget_draw_one (w[0], cur_x, y, height); cur_x -= SSD_WIDGET_SEP; } else { ssd_widget_draw_one (w[0], cur_x, y, height); cur_x += w[0]->size.width + SSD_WIDGET_SEP; } width -= w[0]->size.width + SSD_WIDGET_SEP; w++; count--; } if (count == 0) return height + SSD_WIDGET_SEP; /* align center */ total_width = 0; for (i=0; i<count; i++) { total_width += w[i]->size.width; } space = (width - total_width) / (count + 1); for (i=0; i<count; i++) { if (ssd_widget_rtl ()) { cur_x -= space; cur_x -= w[i]->size.width; ssd_widget_draw_one (w[i], cur_x, y, height); } else { cur_x += space; ssd_widget_draw_one (w[i], cur_x, y, height); cur_x += w[i]->size.width; } } return height + SSD_WIDGET_SEP; } static SsdWidget ssd_widget_find_by_pos (SsdWidget widget, const RoadMapGuiPoint *point) { while (widget != NULL) { if ((widget->position.x <= point->x) && ((widget->position.x + widget->size.width) >= point->x) && (widget->position.y <= point->y) && ((widget->position.y + widget->size.height) >= point->y)) { return widget; } widget = widget->next; } return NULL; } void ssd_widget_draw (SsdWidget w, const RoadMapGuiRect *rect) { SsdWidget row[100]; int width = rect->maxx - rect->minx + 1; //int height = rect->maxy - rect->miny + 1; int cur_y = rect->miny; int cur_width = 0; int count = 0; while (w != NULL) { if ((count == sizeof(row)/sizeof(SsdWidget)) || ((count > 0) && ((cur_width + w->size.width) >= width))) { cur_y += ssd_widget_draw_row (row, count, width, rect->minx, cur_y); count = 0; cur_width = 0; } else if (count && (w->flags & SSD_START_NEW_ROW)) { cur_y += ssd_widget_draw_row (row, count, width, rect->minx, cur_y); count = 0; cur_width = 0; } row[count++] = w; cur_width += w->size.width + SSD_WIDGET_SEP; if (w->flags & SSD_END_ROW) { cur_y += ssd_widget_draw_row (row, count, width, rect->minx, cur_y); count = 0; cur_width = 0; } w = w->next; } if (count) ssd_widget_draw_row (row, count, width, rect->minx, cur_y); } SsdWidget ssd_widget_new (const char *name, int flags) { SsdWidget w; w = (SsdWidget) calloc (1, sizeof (*w)); roadmap_check_allocated(w); w->name = strdup(name); return w; } void ssd_widget_set_callback (SsdWidget widget, SsdCallback callback) { widget->callback = callback; } int ssd_widget_rtl (void) { return roadmap_lang_rtl (); } void ssd_widget_pointer_down (SsdWidget widget, RoadMapGuiPoint *point) { widget = ssd_widget_find_by_pos (widget, point); if (!widget) return; if (widget->pointer_down && !widget->pointer_down(widget, point)) { return; } else if (widget->children != NULL) { ssd_widget_pointer_down (widget->children, point); } } void ssd_widget_short_click (SsdWidget widget, RoadMapGuiPoint *point) { widget = ssd_widget_find_by_pos (widget, point); if (!widget) return; if (widget->short_click && !widget->short_click(widget, point)) { return; } else if (widget->children != NULL) { ssd_widget_short_click (widget->children, point); } } void ssd_widget_long_click (SsdWidget widget, RoadMapGuiPoint *point) { widget = ssd_widget_find_by_pos (widget, point); if (!widget) return; if (widget->long_click && !widget->long_click(widget, point)) { return; } else if (widget->children != NULL) { ssd_widget_long_click (widget->children, point); } } const char *ssd_widget_get_value (const SsdWidget widget, const char *name) { SsdWidget w = ssd_widget_get (widget, name); if (!w) return ""; return w->value; } int ssd_widget_set_value (const SsdWidget widget, const char *name, const char *value) { SsdWi... [truncated message content] |
From: Ehud S. <esh...@us...> - 2006-11-03 12:37:47
|
Update of /cvsroot/roadmap/roadmap_editor/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv9554 Modified Files: Makefile Log Message: SSD - small screen device. Add a framework for creating dialogs for ssd. This is just an initial implementation and currently does nothing. Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/Makefile,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Makefile 18 Aug 2006 17:16:57 -0000 1.21 --- Makefile 3 Nov 2006 12:37:43 -0000 1.22 *************** *** 40,43 **** --- 40,50 ---- endif + ifeq ($(SSD),YES) + # Small screen devices + SSDCFLAGS=-DSSD + else + SSDCFLAGS= + endif + ifeq ($(SQL),SQLITE) SQLCFLAGS=-DROADMAP_USES_SQLITE *************** *** 88,92 **** ! CFLAGS=$(MODECFLAGS) $(SQLCFLAGS) $(ROADMAP_USE_SHAPEFILES) -I/usr/local/include -I$(PWD) -I./dglib -DROADMAP_USE_POSTGRES LDFLAGS=$(MODELDFLAGS) $(SQLLDFLAGS) $(SHAPELDFLAGS) -lpq -L ./dglib --- 95,99 ---- ! CFLAGS=$(MODECFLAGS) $(SQLCFLAGS) $(ROADMAP_USE_SHAPEFILES) $(SSDCFLAGS) -I/usr/local/include -I$(PWD) -I./dglib -DROADMAP_USE_POSTGRES LDFLAGS=$(MODELDFLAGS) $(SQLLDFLAGS) $(SHAPELDFLAGS) -lpq -L ./dglib *************** *** 115,118 **** --- 122,126 ---- roadmap_line.c \ roadmap_line_route.c \ + roadmap_line_speed.c \ roadmap_shape.c \ roadmap_turns.c \ *************** *** 156,159 **** --- 164,168 ---- roadmap_help.c \ roadmap_label.c \ + roadmap_res.c \ roadmap_start.c *************** *** 227,230 **** --- 236,240 ---- buildmap_line.c \ buildmap_line_route.c \ + buildmap_line_speed.c \ buildmap_dglib.c \ buildmap_shape.c \ *************** *** 263,266 **** --- 273,286 ---- BUOBJS=$(BUSRCS:.c=.o) + SSD_WIDGETS_SRCS=ssd/ssd_dialog.c \ + ssd/ssd_widget.c \ + ssd/ssd_container.c \ + ssd/ssd_text.c \ + ssd/ssd_entry.c \ + ssd/ssd_button.c \ + ssd/ssd_keyboard.c \ + ssd/ssd_menu.c \ + + SSD_WIDGETS_OBJS=$(SSD_WIDGETS_SRCS:.c=.o) PKGDATAFILES=sprites preferences schema session drivers *************** *** 405,406 **** --- 425,429 ---- $(CC) $(LDFLAGS) $(BPOBJS) -o buildplace $(LIBS) + libssd_widgets.a: $(SSD_WIDGETS_OBJS) + $(AR) $(ARFLAGS) libssd_widgets.a $(SSD_WIDGETS_OBJS) + $(RANLIB) libssd_widgets.a |
From: Ehud S. <esh...@us...> - 2006-11-03 12:35:41
|
Update of /cvsroot/roadmap/roadmap_editor/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8797 Modified Files: roadmap_canvas.h roadmap_label.c Log Message: Changes for SSD support. Index: roadmap_label.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_label.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** roadmap_label.c 3 Sep 2006 18:59:16 -0000 1.7 --- roadmap_label.c 3 Nov 2006 12:35:37 -0000 1.8 *************** *** 267,271 **** #else if (doing_angles) { ! roadmap_canvas_draw_string_angle (start, center, angle, text); } else { roadmap_canvas_draw_string (center, ROADMAP_CANVAS_CENTER, text); --- 267,271 ---- #else if (doing_angles) { ! roadmap_canvas_draw_string_angle (start, center, angle, -1, text); } else { roadmap_canvas_draw_string (center, ROADMAP_CANVAS_CENTER, text); Index: roadmap_canvas.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_canvas.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** roadmap_canvas.h 9 Aug 2006 07:04:16 -0000 1.9 --- roadmap_canvas.h 3 Nov 2006 12:35:37 -0000 1.10 *************** *** 95,98 **** --- 95,99 ---- void roadmap_canvas_erase (void); + void roadmap_canvas_erase_area (const RoadMapGuiRect *rect); /* Draw text on the screen at a given position. *************** *** 124,129 **** const char *text); ! void roadmap_canvas_draw_string_angle (RoadMapGuiPoint *position, ! RoadMapGuiPoint *center, int angle, const char *text); --- 125,131 ---- const char *text); ! void roadmap_canvas_draw_string_angle (const RoadMapGuiPoint *position, ! RoadMapGuiPoint *center, ! int angle, int size, const char *text); *************** *** 158,162 **** const char* file_name); ! void roadmap_canvas_draw_image (RoadMapImage image, RoadMapGuiPoint *pos, int opacity, int mode); --- 160,164 ---- const char* file_name); ! void roadmap_canvas_draw_image (RoadMapImage image, const RoadMapGuiPoint *pos, int opacity, int mode); |
From: Ehud S. <esh...@us...> - 2006-11-03 12:34:29
|
Update of /cvsroot/roadmap/roadmap_editor/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8401 Modified Files: roadmap_pointer.c roadmap_pointer.h roadmap_screen_obj.c roadmap_screen_obj.h Log Message: Add 'pressed' event to the pointer callbacks. Index: roadmap_screen_obj.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_screen_obj.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** roadmap_screen_obj.c 3 Sep 2006 18:05:04 -0000 1.6 --- roadmap_screen_obj.c 3 Nov 2006 12:34:22 -0000 1.7 *************** *** 43,46 **** --- 43,47 ---- #include "roadmap_start.h" #include "roadmap_state.h" + #include "roadmap_pointer.h" #include "roadmap_screen_obj.h" *************** *** 88,91 **** --- 89,96 ---- static int OffsetY = 0; + static RoadMapPointerClickHandler PrevPressedHandler; + static RoadMapPointerHandler PrevShortClick; + static RoadMapPointerHandler PrevLongClick; + static char *roadmap_object_string (const char *data, int length) { *************** *** 416,419 **** --- 421,436 ---- + static RoadMapScreenObj roadmap_screen_obj_search (const char *name) { + + RoadMapScreenObj cursor; + + for (cursor = RoadMapObjectList; cursor != NULL; cursor = cursor->next) { + if (!strcmp(cursor->name, name)) return cursor; + } + + return NULL; + } + + static void roadmap_screen_obj_pos (RoadMapScreenObj object, RoadMapGuiPoint *pos) { *************** *** 436,445 **** ! RoadMapScreenObj roadmap_screen_obj_search (const char *name) { RoadMapScreenObj cursor; for (cursor = RoadMapObjectList; cursor != NULL; cursor = cursor->next) { ! if (!strcmp(cursor->name, name)) return cursor; } --- 453,472 ---- ! static RoadMapScreenObj roadmap_screen_obj_by_pos (RoadMapGuiPoint *point) { RoadMapScreenObj cursor; for (cursor = RoadMapObjectList; cursor != NULL; cursor = cursor->next) { ! ! RoadMapGuiPoint pos; ! roadmap_screen_obj_pos (cursor, &pos); ! ! if ((point->x >= (pos.x + cursor->bbox.minx)) && ! (point->x <= (pos.x + cursor->bbox.maxx)) && ! (point->y >= (pos.y + cursor->bbox.miny)) && ! (point->y <= (pos.y + cursor->bbox.maxy))) { ! ! return cursor; ! } } *************** *** 448,451 **** --- 475,537 ---- + static int roadmap_screen_obj_pressed (RoadMapGuiPoint *point) { + int state = 0; + + RoadMapScreenObjSelected = roadmap_screen_obj_by_pos (point); + + if (!RoadMapScreenObjSelected) return (*PrevPressedHandler)(point); + + if (RoadMapScreenObjSelected->state_fn) { + state = (*RoadMapScreenObjSelected->state_fn) (); + if ((state < 0) || (state >= MAX_STATES)) return 1; + } + + if (RoadMapScreenObjSelected->images[state]) { + RoadMapGuiPoint pos; + roadmap_screen_obj_pos (RoadMapScreenObjSelected, &pos); + + roadmap_canvas_draw_image (RoadMapScreenObjSelected->images[state], &pos, + RoadMapScreenObjSelected->opacity, IMAGE_SELECTED); + } + + roadmap_canvas_refresh (); + + return 1; + } + + + static void roadmap_screen_obj_short_click (RoadMapGuiPoint *point) { + + RoadMapScreenObj object = RoadMapScreenObjSelected; + + if (!RoadMapScreenObjSelected) { + (*PrevShortClick)(point); + return; + } + + RoadMapScreenObjSelected = NULL; + + if (object->action) { + (*(object->action->callback)) (); + } + } + + + static void roadmap_screen_obj_long_click (RoadMapGuiPoint *point) { + + RoadMapScreenObj object = RoadMapScreenObjSelected; + + if (!RoadMapScreenObjSelected) { + (*PrevLongClick)(point); + return; + } + + RoadMapScreenObjSelected = NULL; + + if (object->action) { + (*(object->action->callback)) (); + } + } + void roadmap_screen_obj_move (const char *name, const RoadMapGuiPoint *position) { *************** *** 491,494 **** --- 577,587 ---- const char *object_name = NULL; + PrevPressedHandler = + roadmap_pointer_register_pressed (roadmap_screen_obj_pressed); + PrevShortClick = + roadmap_pointer_register_short_click (roadmap_screen_obj_short_click); + PrevLongClick = + roadmap_pointer_register_long_click (roadmap_screen_obj_long_click); + for (i=0; i<sizeof(RoadMapObjFiles)/sizeof(RoadMapObjFiles[0]); i++) { *************** *** 568,637 **** - RoadMapScreenObj roadmap_screen_obj_by_pos (RoadMapGuiPoint *point) { - - RoadMapScreenObj cursor; - - for (cursor = RoadMapObjectList; cursor != NULL; cursor = cursor->next) { - - RoadMapGuiPoint pos; - roadmap_screen_obj_pos (cursor, &pos); - - if ((point->x >= (pos.x + cursor->bbox.minx)) && - (point->x <= (pos.x + cursor->bbox.maxx)) && - (point->y >= (pos.y + cursor->bbox.miny)) && - (point->y <= (pos.y + cursor->bbox.maxy))) { - - return cursor; - } - } - - return NULL; - } - - - int roadmap_screen_obj_short_click (RoadMapScreenObj object) { - - RoadMapScreenObjSelected = NULL; - - if (object->action) { - (*(object->action->callback)) (); - return 1; - } - - return 0; - } - - - void roadmap_screen_obj_pressed (RoadMapScreenObj object) { - int state = 0; - - RoadMapScreenObjSelected = object; - - if (object->state_fn) { - state = (*object->state_fn) (); - if ((state < 0) || (state >= MAX_STATES)) return; - } - - if (object->images[state]) { - RoadMapGuiPoint pos; - roadmap_screen_obj_pos (object, &pos); - - roadmap_canvas_draw_image (object->images[state], &pos, - object->opacity, IMAGE_SELECTED); - } - - roadmap_canvas_refresh (); - } - - int roadmap_screen_obj_long_click (RoadMapScreenObj object) { - - RoadMapScreenObjSelected = NULL; - - if (object->action) { - (*(object->action->callback)) (); - return 1; - } - - return 0; - } --- 661,663 ---- Index: roadmap_pointer.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_pointer.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** roadmap_pointer.h 9 Aug 2006 07:11:50 -0000 1.2 --- roadmap_pointer.h 3 Nov 2006 12:34:22 -0000 1.3 *************** *** 32,35 **** --- 32,36 ---- typedef void (*RoadMapPointerHandler) (RoadMapGuiPoint *point); + typedef int (*RoadMapPointerClickHandler) (RoadMapGuiPoint *point); void roadmap_pointer_initialize (void); *************** *** 47,50 **** --- 48,54 ---- (RoadMapPointerHandler handler); + RoadMapPointerClickHandler roadmap_pointer_register_pressed + (RoadMapPointerClickHandler handler); + #endif // INCLUDE__ROADMAP_POINTER__H Index: roadmap_pointer.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_pointer.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** roadmap_pointer.c 9 Aug 2006 07:11:50 -0000 1.5 --- roadmap_pointer.c 3 Nov 2006 12:34:22 -0000 1.6 *************** *** 33,37 **** #include "roadmap_gui.h" #include "roadmap_canvas.h" - #include "roadmap_screen_obj.h" #include "roadmap_main.h" --- 33,36 ---- *************** *** 40,46 **** static int is_button_down = 0; static int is_dragging = 0; static int is_drag_flow_control_on = 0; - static RoadMapScreenObj screen_object; static RoadMapGuiPoint last_pointer_point; --- 39,45 ---- static int is_button_down = 0; + static int cancel_dragging = 0; static int is_dragging = 0; static int is_drag_flow_control_on = 0; static RoadMapGuiPoint last_pointer_point; *************** *** 50,53 **** --- 49,55 ---- */ static void roadmap_pointer_ignore_event (RoadMapGuiPoint *point) {} + static int roadmap_pointer_ignore_click_event (RoadMapGuiPoint *point) { + return 0; + } static RoadMapPointerHandler RoadMapPointerShortClick = *************** *** 57,60 **** --- 59,68 ---- roadmap_pointer_ignore_event; + static RoadMapPointerClickHandler RoadMapPointerPressed = + roadmap_pointer_ignore_click_event; + + static RoadMapPointerHandler RoadMapPointerReleased = + roadmap_pointer_ignore_event; + static RoadMapPointerHandler RoadMapPointerDragStart = roadmap_pointer_ignore_event; *************** *** 71,79 **** roadmap_main_remove_periodic(roadmap_pointer_button_timeout); ! if (screen_object != NULL) { ! roadmap_screen_obj_long_click (screen_object); ! } else { ! RoadMapPointerLongClick(&last_pointer_point); ! } is_button_down = 0; } --- 79,83 ---- roadmap_main_remove_periodic(roadmap_pointer_button_timeout); ! RoadMapPointerLongClick(&last_pointer_point); is_button_down = 0; } *************** *** 88,94 **** roadmap_main_remove_periodic(roadmap_pointer_drag_flow_control); ! if (screen_object == NULL) { ! RoadMapPointerDragMotion(&last_pointer_point); ! } is_drag_flow_control_on = 0; } --- 92,96 ---- roadmap_main_remove_periodic(roadmap_pointer_drag_flow_control); ! RoadMapPointerDragMotion(&last_pointer_point); is_drag_flow_control_on = 0; } *************** *** 96,107 **** static void roadmap_pointer_button_pressed (RoadMapGuiPoint *point) { - is_button_down = 1; last_pointer_point = *point; - screen_object = roadmap_screen_obj_by_pos (point); ! if (screen_object) { ! roadmap_screen_obj_pressed (screen_object); } roadmap_main_set_periodic (LONG_CLICK_TIMEOUT, roadmap_pointer_button_timeout); --- 98,112 ---- static void roadmap_pointer_button_pressed (RoadMapGuiPoint *point) { last_pointer_point = *point; ! if (RoadMapPointerPressed (point)) { ! /* If a handler returns true dragging event is off. ! */ ! cancel_dragging = 1; ! } else { ! cancel_dragging = 0; } + is_button_down = 1; roadmap_main_set_periodic (LONG_CLICK_TIMEOUT, roadmap_pointer_button_timeout); *************** *** 117,125 **** } ! if (screen_object) { ! roadmap_screen_obj_short_click (screen_object); ! } else { ! RoadMapPointerDragEnd(point); ! } is_dragging = 0; is_button_down = 0; --- 122,126 ---- } ! RoadMapPointerDragEnd(point); is_dragging = 0; is_button_down = 0; *************** *** 127,135 **** roadmap_main_remove_periodic(roadmap_pointer_button_timeout); ! if (screen_object) { ! roadmap_screen_obj_short_click (screen_object); ! } else { ! RoadMapPointerShortClick(point); ! } is_button_down = 0; } --- 128,132 ---- roadmap_main_remove_periodic(roadmap_pointer_button_timeout); ! RoadMapPointerShortClick(point); is_button_down = 0; } *************** *** 137,141 **** static void roadmap_pointer_moved (RoadMapGuiPoint *point) { ! if (!is_button_down && !is_dragging) return; if (!is_dragging) { --- 134,138 ---- static void roadmap_pointer_moved (RoadMapGuiPoint *point) { ! if (cancel_dragging || (!is_button_down && !is_dragging)) return; if (!is_dragging) { *************** *** 147,153 **** roadmap_main_remove_periodic(roadmap_pointer_button_timeout); ! if (!screen_object) { ! RoadMapPointerDragStart(&last_pointer_point); ! } last_pointer_point = *point; --- 144,148 ---- roadmap_main_remove_periodic(roadmap_pointer_button_timeout); ! RoadMapPointerDragStart(&last_pointer_point); last_pointer_point = *point; *************** *** 205,208 **** --- 200,223 ---- + RoadMapPointerClickHandler roadmap_pointer_register_pressed + (RoadMapPointerClickHandler handler) { + + RoadMapPointerClickHandler old = RoadMapPointerPressed; + RoadMapPointerPressed = handler; + + return old; + } + + + RoadMapPointerHandler roadmap_pointer_register_released + (RoadMapPointerHandler handler) { + + RoadMapPointerHandler old = RoadMapPointerReleased; + RoadMapPointerReleased = handler; + + return old; + } + + RoadMapPointerHandler roadmap_pointer_register_drag_start (RoadMapPointerHandler handler) { Index: roadmap_screen_obj.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_screen_obj.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** roadmap_screen_obj.h 11 Jun 2006 10:58:58 -0000 1.3 --- roadmap_screen_obj.h 3 Nov 2006 12:34:22 -0000 1.4 *************** *** 35,44 **** void roadmap_screen_obj_draw (void); - RoadMapScreenObj roadmap_screen_obj_by_pos (RoadMapGuiPoint *point); - - int roadmap_screen_obj_short_click (RoadMapScreenObj object); - int roadmap_screen_obj_long_click (RoadMapScreenObj object); - void roadmap_screen_obj_pressed (RoadMapScreenObj object); - #endif // INCLUDE__ROADMAP_SCREEN_OBJECT__H --- 35,38 ---- |
From: Ehud S. <esh...@us...> - 2006-11-03 12:33:01
|
Update of /cvsroot/roadmap/roadmap_editor/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv7647 Modified Files: roadmap_locator.c Log Message: Allow running without usdir (as it can be downloaded). Index: roadmap_locator.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_locator.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** roadmap_locator.c 3 Sep 2006 18:03:01 -0000 1.11 --- roadmap_locator.c 3 Nov 2006 12:32:56 -0000 1.12 *************** *** 44,47 **** --- 44,48 ---- #include "roadmap_line.h" #include "roadmap_line_route.h" + #include "roadmap_line_speed.h" #include "roadmap_street.h" #include "roadmap_polygon.h" *************** *** 110,113 **** --- 111,117 ---- RoadMapCountyModel = roadmap_db_register + (RoadMapCountyModel, "line_speed", &RoadMapLineSpeedHandler); + RoadMapCountyModel = + roadmap_db_register (RoadMapCountyModel, "line_route", &RoadMapLineRouteHandler); RoadMapCountyModel = *************** *** 139,143 **** if (!RoadMapUsdirActive) { if (! roadmap_db_open ("usdir", RoadMapUsModel, "r")) { ! roadmap_log (ROADMAP_FATAL, "cannot open directory database (usdir)"); } --- 143,148 ---- if (!RoadMapUsdirActive) { if (! roadmap_db_open ("usdir", RoadMapUsModel, "r")) { ! roadmap_log (ROADMAP_ERROR, "cannot open directory database (usdir)"); ! return; } |
From: Ehud S. <esh...@us...> - 2006-11-03 12:31:22
|
Update of /cvsroot/roadmap/roadmap_editor/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv7231 Modified Files: roadmap_hash.c roadmap_hash.h roadmap_lang.c Log Message: Add string key generator. Index: roadmap_hash.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_hash.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** roadmap_hash.c 15 Oct 2005 22:19:05 -0000 1.1.1.1 --- roadmap_hash.c 3 Nov 2006 12:31:19 -0000 1.2 *************** *** 49,53 **** ! RoadMapHash *roadmap_hash_new (char *name, int size) { int i; --- 49,53 ---- ! RoadMapHash *roadmap_hash_new (const char *name, int size) { int i; *************** *** 232,233 **** --- 232,246 ---- } + + int roadmap_hash_string (const char *str) { + + int hash = 0; + unsigned int i; + + for (i=0; i<strlen(str); i++) { + hash += str[i]*(i+1); + } + + return hash; + } + Index: roadmap_hash.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_hash.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** roadmap_hash.h 15 Oct 2005 22:19:05 -0000 1.1.1.1 --- roadmap_hash.h 3 Nov 2006 12:31:19 -0000 1.2 *************** *** 29,33 **** struct roadmap_hash_struct { ! char *name; struct roadmap_hash_struct *next_hash; --- 29,33 ---- struct roadmap_hash_struct { ! const char *name; struct roadmap_hash_struct *next_hash; *************** *** 50,54 **** ! RoadMapHash *roadmap_hash_new (char *name, int size); void roadmap_hash_add (RoadMapHash *hash, int key, int index); --- 50,54 ---- ! RoadMapHash *roadmap_hash_new (const char *name, int size); void roadmap_hash_add (RoadMapHash *hash, int key, int index); *************** *** 65,68 **** --- 65,70 ---- void roadmap_hash_reset (void); + int roadmap_hash_string (const char *str); + #endif // _ROADMAP_HASH__H_ Index: roadmap_lang.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_lang.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** roadmap_lang.c 18 Aug 2006 17:21:26 -0000 1.2 --- roadmap_lang.c 3 Nov 2006 12:31:19 -0000 1.3 *************** *** 53,69 **** - static int roadmap_lang_hash_str (const char *str) { - - int hash = 0; - unsigned int i; - - for (i=0; i<strlen(str); i++) { - hash += str[i]; - } - - return hash; - } - - static void roadmap_lang_allocate (void) { --- 53,56 ---- *************** *** 88,92 **** static void roadmap_lang_new_item (const char *name, const char *value) { ! int hash = roadmap_lang_hash_str (name); if (RoadMapLangCount == RoadMapLangSize) { --- 75,79 ---- static void roadmap_lang_new_item (const char *name, const char *value) { ! int hash = roadmap_hash_string (name); if (RoadMapLangCount == RoadMapLangSize) { *************** *** 169,173 **** if (!RoadMapLangLoaded) return name; ! hash = roadmap_lang_hash_str (name); for (i = roadmap_hash_get_first (RoadMapLangHash, hash); --- 156,160 ---- if (!RoadMapLangLoaded) return name; ! hash = roadmap_hash_string (name); for (i = roadmap_hash_get_first (RoadMapLangHash, hash); |
From: Ehud S. <esh...@us...> - 2006-11-03 12:30:34
|
Update of /cvsroot/roadmap/roadmap_editor/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6851 Added Files: roadmap_res.c roadmap_res.h Log Message: Resource manager (bitmaps, voice, etc') --- NEW FILE: roadmap_res.h --- /* roadmap_res.h - Resources manager * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _ROADMAP_RES__H_ #define _ROADMAP_RES__H_ #define RES_BITMAP 0 #define MAX_RESOURCES 1 void *roadmap_res_get (unsigned int type, unsigned int flags, const char *name); #endif // _ROADMAP_RES__H_ --- NEW FILE: roadmap_res.c --- /* roadmap_res.c - Resources manager (Bitmap, voices, etc') * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See roadmap_res.h */ #include <string.h> #include <stdlib.h> #include "roadmap_canvas.h" #include "roadmap_hash.h" #include "roadmap_list.h" #include "roadmap_path.h" #include "roadmap_res.h" #define BLOCK_SIZE 100 const char *ResourceName[] = { "bitmap_res" }; struct resource_slot { const char *name; void *data; }; typedef struct roadmap_resource { RoadMapHash *hash; struct resource_slot *slots; int count; int max; int used_mem; int max_mem; } RoadMapResource; static RoadMapResource Resources[MAX_RESOURCES]; static void allocate_resource (unsigned int type) { RoadMapResource *res = &Resources[type]; res->hash = roadmap_hash_new (ResourceName[type], BLOCK_SIZE); res->slots = malloc (BLOCK_SIZE * sizeof (*res->slots)); res->max = BLOCK_SIZE; } static void *load_resource (unsigned int type, unsigned int flags, const char *name, int *mem) { char *path; switch (type) { case RES_BITMAP: path = roadmap_path_join (roadmap_path_user(), "icons"); *mem = 0; return roadmap_canvas_load_image (path, name); } return NULL; } static void *find_resource (unsigned int type, const char *name) { int hash; int i; RoadMapResource *res = &Resources[type]; if (!res->count) return NULL; hash = roadmap_hash_string (name); for (i = roadmap_hash_get_first (res->hash, hash); i >= 0; i = roadmap_hash_get_next (res->hash, i)) { if (!strcmp(name, res->slots[i].name)) { return res->slots[i].data; } } return NULL; } void *roadmap_res_get (unsigned int type, unsigned int flags, const char *name) { void *data; int mem; RoadMapResource *res = &Resources[type]; data = find_resource (type, name); if (data) return data; if (!Resources[type].count) allocate_resource (type); //TODO implement grow (or old deletion) if (Resources[type].count == Resources[type].max) return NULL; data = load_resource (type, flags, name, &mem); if (!data) return NULL; res->slots[res->count].data = data; res->slots[res->count].name = name; res->used_mem += mem; roadmap_hash_add (res->hash, roadmap_hash_string (name), res->count); res->count++; return data; } |
From: Ehud S. <esh...@us...> - 2006-11-03 12:29:57
|
Update of /cvsroot/roadmap/roadmap_editor/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6439 Modified Files: buildmap_line_route.c buildmap_line_route.h buildmap_main.c buildmap_postgres.c roadmap_db_line_route.h roadmap_line_route.c roadmap_line_route.h Added Files: buildmap_line_speed.c buildmap_line_speed.h roadmap_db_line_speed.h roadmap_line_speed.c roadmap_line_speed.h Log Message: Add support for several speeds per road (according to the time) Index: buildmap_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/buildmap_main.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** buildmap_main.c 12 May 2006 13:04:35 -0000 1.7 --- buildmap_main.c 3 Nov 2006 12:29:48 -0000 1.8 *************** *** 44,47 **** --- 44,48 ---- #include "buildmap_line.h" #include "buildmap_line_route.h" + #include "buildmap_line_speed.h" #include "buildmap_dglib.h" #include "buildmap_point.h" *************** *** 166,169 **** --- 167,171 ---- buildmap_line_initialize(); buildmap_line_route_initialize(); + buildmap_line_speed_initialize(); buildmap_dglib_initialize(creation_time); buildmap_polygon_initialize(); *************** *** 180,183 **** --- 182,186 ---- buildmap_line_sort (); buildmap_line_route_sort (); + buildmap_line_speed_sort (); buildmap_dglib_sort (); buildmap_street_sort (); *************** *** 210,213 **** --- 213,217 ---- buildmap_line_save (); buildmap_line_route_save (); + buildmap_line_speed_save (); buildmap_dglib_save (BuildMapResult, db_name); buildmap_point_save (); *************** *** 230,233 **** --- 234,238 ---- buildmap_line_reset (); buildmap_line_route_reset (); + buildmap_line_speed_reset (); buildmap_dglib_reset (creation_time); buildmap_point_reset (); *************** *** 292,295 **** --- 297,301 ---- buildmap_line_summary (); buildmap_line_route_summary (); + buildmap_line_speed_summary (); buildmap_dglib_summary (); buildmap_range_summary (); --- NEW FILE: roadmap_line_speed.c --- /* roadmap_line_speed.c - Manage line speed data * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "roadmap.h" #include "roadmap_dbread.h" #include "roadmap_line_speed.h" static char *RoadMapLineSpeedType = "RoadMapLineSpeedContext"; typedef struct { char *type; RoadMapLineSpeed *LineSpeedSlots; int LineSpeedSlotsCount; int *LineSpeedIndex; int LineSpeedIndexCount; } RoadMapLineSpeedContext; static RoadMapLineSpeedContext *RoadMapLineSpeedActive = NULL; static void *roadmap_line_speed_map (roadmap_db *root) { RoadMapLineSpeedContext *context; roadmap_db *index_table; roadmap_db *data_table; context = (RoadMapLineSpeedContext *) malloc (sizeof(RoadMapLineSpeedContext)); if (context == NULL) { roadmap_log (ROADMAP_ERROR, "no more memory"); return NULL; } context->type = RoadMapLineSpeedType; index_table = roadmap_db_get_subsection (root, "index"); data_table = roadmap_db_get_subsection (root, "data"); context->LineSpeedIndex = (int *) roadmap_db_get_data (index_table); context->LineSpeedIndexCount = roadmap_db_get_count (index_table); context->LineSpeedSlots = (RoadMapLineSpeed *) roadmap_db_get_data (data_table); context->LineSpeedSlotsCount = roadmap_db_get_count (data_table); if (roadmap_db_get_size (data_table) != context->LineSpeedSlotsCount * sizeof(RoadMapLineSpeed)) { roadmap_log (ROADMAP_ERROR, "invalid line speed data structure"); free(context); return NULL; } return context; } static void roadmap_line_speed_activate (void *context) { RoadMapLineSpeedContext *line_speed_context = (RoadMapLineSpeedContext *) context; if ((line_speed_context != NULL) && (line_speed_context->type != RoadMapLineSpeedType)) { roadmap_log (ROADMAP_FATAL, "invalid line speed context activated"); } RoadMapLineSpeedActive = line_speed_context; } static void roadmap_line_speed_unmap (void *context) { RoadMapLineSpeedContext *line_speed_context = (RoadMapLineSpeedContext *) context; if (line_speed_context->type != RoadMapLineSpeedType) { roadmap_log (ROADMAP_FATAL, "unmapping invalid line speed context"); } free (line_speed_context); } roadmap_db_handler RoadMapLineSpeedHandler = { "line_speed", roadmap_line_speed_map, roadmap_line_speed_activate, roadmap_line_speed_unmap }; int roadmap_line_speed_get_avg (int speed_ref) { RoadMapLineSpeed *speed; int index; int count = 0; int total = 0; if (RoadMapLineSpeedActive == NULL) return 0; /* No data. */ if (RoadMapLineSpeedActive->LineSpeedIndexCount <= speed_ref) { roadmap_log (ROADMAP_ERROR, "Invalid speed_ref index:%d", speed_ref); return 0; } index = RoadMapLineSpeedActive->LineSpeedIndex[speed_ref]; speed = &RoadMapLineSpeedActive->LineSpeedSlots[index]; while (1) { total += speed->speed; count++; if (speed->time_slot & SPEED_EOL) break; speed++; } return total / count; } int roadmap_line_speed_get (int speed_ref, int time_slot) { RoadMapLineSpeed *speed; int index; if (RoadMapLineSpeedActive == NULL) return 0; /* No data. */ if (RoadMapLineSpeedActive->LineSpeedIndexCount <= speed_ref) { roadmap_log (ROADMAP_ERROR, "Invalid speed_ref index:%d", speed_ref); return 0; } index = RoadMapLineSpeedActive->LineSpeedIndex[speed_ref]; speed = &RoadMapLineSpeedActive->LineSpeedSlots[index]; while (!(speed->time_slot & SPEED_EOL) && (((speed+1)->time_slot & ~SPEED_EOL) <= time_slot)) { speed++; } return speed->speed; } --- NEW FILE: roadmap_line_speed.h --- /* roadmap_line_speed.h - Manage the line speed data. * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _ROADMAP_LINE_SPEED__H_ #define _ROADMAP_LINE_SPEED__H_ #include <time.h> #include "roadmap_types.h" #include "roadmap_dbread.h" #include "roadmap_db_line_speed.h" extern roadmap_db_handler RoadMapLineSpeedHandler; int roadmap_line_speed_get_avg (int speed_ref); int roadmap_line_speed_get (int speed_ref, int time_slot); #endif // _ROADMAP_LINE_SPEED__H_ Index: roadmap_db_line_route.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_db_line_route.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_db_line_route.h 12 Dec 2005 20:35:41 -0000 1.1 --- roadmap_db_line_route.h 3 Nov 2006 12:29:48 -0000 1.2 *************** *** 41,46 **** unsigned char from_max_speed; unsigned char to_max_speed; ! unsigned short from_cross_time; ! unsigned short to_cross_time; } RoadMapLineRoute; --- 41,46 ---- unsigned char from_max_speed; unsigned char to_max_speed; ! unsigned short from_speed_ref; ! unsigned short to_speed_ref; } RoadMapLineRoute; Index: buildmap_line_route.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/buildmap_line_route.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** buildmap_line_route.h 12 Dec 2005 20:35:41 -0000 1.1 --- buildmap_line_route.h 3 Nov 2006 12:29:48 -0000 1.2 *************** *** 33,38 **** unsigned char from_max_speed, unsigned char to_max_speed, ! unsigned short from_cross_time, ! unsigned short to_cross_time, int line); --- 33,38 ---- unsigned char from_max_speed, unsigned char to_max_speed, ! unsigned short from_speed_ref, ! unsigned short to_speed_ref, int line); --- NEW FILE: buildmap_line_speed.h --- /* buildmap_line_speed.h - Build a line speed table * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _BUILDMAP_LINE_SPEED__H_ #define _BUILDMAP_LINE_SPEED__H_ #include "roadmap_db_line_speed.h" struct buildmap_line_speeds_struct { RoadMapLineSpeed *speeds; int count; }; typedef struct buildmap_line_speeds_struct BuildMapSpeed; BuildMapSpeed *buildmap_line_speed_new (void); void buildmap_line_speed_free (BuildMapSpeed *speed); void buildmap_line_speed_add_slot (BuildMapSpeed *speeds, int time_slot, int speed); unsigned short buildmap_line_speed_get_ref (int line, int against_dir); void buildmap_line_speed_initialize (void); int buildmap_line_speed_add (BuildMapSpeed *speeds, int line, int opposite); void buildmap_line_speed_sort (void); int buildmap_line_speed_count (void); void buildmap_line_speed_save (void); void buildmap_line_speed_summary (void); void buildmap_line_speed_reset (void); #endif // _BUILDMAP_LINE_SPEED__H_ Index: roadmap_line_route.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_line_route.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** roadmap_line_route.c 8 May 2006 13:58:36 -0000 1.2 --- roadmap_line_route.c 3 Nov 2006 12:29:48 -0000 1.3 *************** *** 27,36 **** #include <stdlib.h> #include <string.h> ! #include <ctype.h> #include "roadmap.h" #include "roadmap_dbread.h" #include "roadmap_line_route.h" static char *RoadMapLineRouteType = "RoadMapLineRouteContext"; --- 27,40 ---- #include <stdlib.h> #include <string.h> ! #include <time.h> #include "roadmap.h" #include "roadmap_dbread.h" + #include "roadmap_line.h" + #include "roadmap_line_speed.h" #include "roadmap_line_route.h" + #define MAX_ROUTE_TIME (LineRouteTime) 0xFFFF + static char *RoadMapLineRouteType = "RoadMapLineRouteContext"; *************** *** 110,113 **** --- 114,164 ---- + static int roadmap_line_route_time_slot (time_t when) { + + int time_slot; + struct tm *t = localtime (&when); + + time_slot = t->tm_hour * 2; + + if (t->tm_min >= 30) time_slot++; + + //time_slot = 18; + return time_slot; + } + + + static LineRouteTime calc_cross_time (int line, int speed_ref, int time_slot) { + + int speed; + int length; + + if (speed_ref == INVALID_SPEED) return 0; + + speed = roadmap_line_speed_get (speed_ref, time_slot); + + if (!speed) return 0; + + length = roadmap_line_length (line); + + return (LineRouteTime)(length * 3.6 / speed) + 1; + } + + + static LineRouteTime calc_avg_cross_time (int line, int speed_ref) { + + int speed; + int length; + + if (speed_ref == INVALID_SPEED) return 0; + + speed = roadmap_line_speed_get_avg (speed_ref); + + if (!speed) return 0; + length = roadmap_line_length (line); + + return (LineRouteTime)(length * 3.6 / speed) + 1; + } + + int roadmap_line_route_get_direction (int line, int who) { *************** *** 168,175 **** int roadmap_line_route_get_cross_times (int line, ! LineRouteTime *from, ! LineRouteTime *to) { RoadMapLineRoute *route; if (RoadMapLineRouteActive == NULL) return -1; /* No data. */ if (RoadMapLineRouteActive->LineRouteCount <= line) return -1; --- 219,228 ---- int roadmap_line_route_get_cross_times (int line, ! LineRouteTime *from, ! LineRouteTime *to) { RoadMapLineRoute *route; + int time_slot; + if (RoadMapLineRouteActive == NULL) return -1; /* No data. */ if (RoadMapLineRouteActive->LineRouteCount <= line) return -1; *************** *** 177,184 **** route = &RoadMapLineRouteActive->LineRoute[line]; ! *from = route->from_cross_time; ! *to = route->to_cross_time; return 0; } --- 230,287 ---- route = &RoadMapLineRouteActive->LineRoute[line]; ! // *from = calc_avg_cross_time (line, route->from_speed_ref); ! // *to = calc_avg_cross_time (line, route->to_speed_ref); ! ! time_slot = roadmap_line_route_time_slot (time(NULL)); ! // ! *from = calc_cross_time (line, route->from_speed_ref, time_slot); ! *to = calc_cross_time (line, route->to_speed_ref, time_slot); return 0; } + + int roadmap_line_route_get_cross_time (int line, int against_dir) { + + RoadMapLineRoute *route; + int time_slot; + + if (RoadMapLineRouteActive == NULL) return -1; /* No data. */ + if (RoadMapLineRouteActive->LineRouteCount <= line) return -1; + + route = &RoadMapLineRouteActive->LineRoute[line]; + + time_slot = roadmap_line_route_time_slot (time(NULL)); + + if (!against_dir) { + return calc_cross_time (line, route->from_speed_ref, time_slot); + } else { + return calc_cross_time (line, route->to_speed_ref, time_slot); + } + } + + + int roadmap_line_route_get_speed (int line, int against_dir) { + + RoadMapLineRoute *route; + int time_slot; + int speed_ref; + + if (RoadMapLineRouteActive == NULL) return -1; /* No data. */ + if (RoadMapLineRouteActive->LineRouteCount <= line) return -1; + + route = &RoadMapLineRouteActive->LineRoute[line]; + + time_slot = roadmap_line_route_time_slot (time(NULL)); + + if (!against_dir) { + speed_ref = route->from_speed_ref; + } else { + speed_ref = route->to_speed_ref; + } + + if (speed_ref == INVALID_SPEED) return 0; + + return roadmap_line_speed_get (speed_ref, time_slot); + } + --- NEW FILE: roadmap_db_line_speed.h --- /* roadmap_db_line_speed.h - the format of a line's speed data * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * RoadMap's lines speed data is described by the following table: * */ #ifndef _ROADMAP_DB_LINE_SPEED__H_ #define _ROADMAP_DB_LINE_SPEED__H_ #define INVALID_SPEED 0xFFFF #define SPEED_EOL 0x40 //#define SPPED_ 0x80 typedef struct { unsigned char speed; unsigned char time_slot; } RoadMapLineSpeed; #endif // _ROADMAP_DB_LINE_SPEED__H_ Index: buildmap_line_route.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/buildmap_line_route.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** buildmap_line_route.c 12 Dec 2005 20:35:41 -0000 1.1 --- buildmap_line_route.c 3 Nov 2006 12:29:48 -0000 1.2 *************** *** 29,34 **** * unsigned char from_max_speed, * unsigned char to_max_speed, ! * unsigned short from_cross_time, ! * unsigned short to_cross_time, * int line); * void buildmap_line_route_sort (void); --- 29,34 ---- * unsigned char from_max_speed, * unsigned char to_max_speed, ! * unsigned short from_speed_ref, ! * unsigned short to_speed_ref, * int line); * void buildmap_line_route_sort (void); *************** *** 78,83 **** unsigned char from_max_speed, unsigned char to_max_speed, ! unsigned short from_cross_time, ! unsigned short to_cross_time, int line) { --- 78,83 ---- unsigned char from_max_speed, unsigned char to_max_speed, ! unsigned short from_speed_ref, ! unsigned short to_speed_ref, int line) { *************** *** 107,112 **** this_route->record.from_max_speed = from_max_speed; this_route->record.to_max_speed = to_max_speed; ! this_route->record.to_cross_time = to_cross_time; ! this_route->record.from_cross_time = from_cross_time; this_route->line = line; --- 107,112 ---- this_route->record.from_max_speed = from_max_speed; this_route->record.to_max_speed = to_max_speed; ! this_route->record.to_speed_ref = to_speed_ref; ! this_route->record.from_speed_ref = from_speed_ref; this_route->line = line; Index: buildmap_postgres.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/buildmap_postgres.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** buildmap_postgres.c 12 Oct 2006 17:58:31 -0000 1.13 --- buildmap_postgres.c 3 Nov 2006 12:29:48 -0000 1.14 *************** *** 54,57 **** --- 54,58 ---- #include "buildmap_line.h" #include "buildmap_line_route.h" + #include "buildmap_line_speed.h" #include "buildmap_dglib.h" #include "buildmap_street.h" *************** *** 68,72 **** /* ROADS */ ! static const char *roads_sql = "SELECT segments.id AS id, AsText(simplify(segments.the_geom, 0.00002)) AS the_geom, segments.road_type AS layer, segments.from_node AS from_node_id, segments.to_node AS to_node_id, streets.name AS street_name, streets.text2speech as text2speech, cities.name as city_name, fraddl, toaddl, fraddr, toaddr FROM segments LEFT JOIN streets ON segments.street_id = streets.id LEFT JOIN cities ON streets.city_id = cities.id WHERE segments.the_geom @ SetSRID ('BOX3D(34 29.2, 36.2 33.6)'::box3d, 4326);"; static const char *roads_route_sql = "SELECT segments.id AS id, segments.from_car_allowed AS from_car_allowed, segments.to_car_allowed AS to_car_allowed, segments.from_max_speed AS from_max_speed, segments.to_max_speed AS to_max_speed, segments.from_cross_time AS from_cross_time, segments.to_cross_time AS to_cross_time, segments.road_type AS layer FROM segments WHERE segments.the_geom @ SetSRID ('BOX3D(34 29.2, 36.2 33.6)'::box3d, 4326);"; static const char *country_borders_sql = "SELECT id AS id, AsText(simplify(the_geom, 0.00002)) AS the_geom FROM borders;"; --- 69,73 ---- /* ROADS */ ! static const char *roads_sql = "SELECT segments.id AS id, AsText(simplify(segments.the_geom, 0.00002)) AS the_geom, segments.road_type AS layer, segments.from_node AS from_node_id, segments.to_node AS to_node_id, streets.name AS street_name, streets.text2speech as text2speech, cities.name as city_name, fraddl, toaddl, fraddr, toaddr, from_travel_ref, to_travel_ref FROM segments LEFT JOIN streets ON segments.street_id = streets.id LEFT JOIN cities ON streets.city_id = cities.id WHERE segments.the_geom @ SetSRID ('BOX3D(34 29.2, 36.2 33.6)'::box3d, 4326);"; static const char *roads_route_sql = "SELECT segments.id AS id, segments.from_car_allowed AS from_car_allowed, segments.to_car_allowed AS to_car_allowed, segments.from_max_speed AS from_max_speed, segments.to_max_speed AS to_max_speed, segments.from_cross_time AS from_cross_time, segments.to_cross_time AS to_cross_time, segments.road_type AS layer FROM segments WHERE segments.the_geom @ SetSRID ('BOX3D(34 29.2, 36.2 33.6)'::box3d, 4326);"; static const char *country_borders_sql = "SELECT id AS id, AsText(simplify(the_geom, 0.00002)) AS the_geom FROM borders;"; *************** *** 216,219 **** --- 217,278 ---- + static void buildmap_postgres_read_speeds (int tlid, int speed_ref, + int opposite) { + + int irec; + int record_count; + + BuildMapSpeed *this_speed; + PGresult *db_result; + + char speeds_sql[200]; + + sprintf(speeds_sql, + "SELECT time, speed FROM today_cross_times WHERE seg_ref_id=%d ORDER BY time;", + speed_ref); + + db_result = PQexec(hPGConn, speeds_sql); + + if (!db_result_ok (db_result)) { + + fprintf + (stderr, "Can't query database: %s\n", PQerrorMessage(hPGConn)); + PQfinish(hPGConn); + exit(-1); + } + + record_count = PQntuples(db_result); + + if (!record_count) return; + + this_speed = buildmap_line_speed_new (); + + for (irec=0; irec<record_count; irec++) { + + int speed; + int db_time; + int time_slot; + int column = 0; + + buildmap_set_line (irec); + + db_time = atoi(PQgetvalue(db_result, irec, column++)); + speed = atoi(PQgetvalue(db_result, irec, column++)); + + speed = (speed / 5) * 5; + time_slot = (db_time / 100) * 2; + if ((db_time % 100) >= 30) time_slot++; + + buildmap_line_speed_add_slot (this_speed, time_slot, speed); + } + + buildmap_line_speed_add (this_speed, tlid, opposite); + + buildmap_line_speed_free (this_speed); + + PQclear(db_result); + } + + static void buildmap_postgres_read_roads_lines (int verbose) { *************** *** 268,271 **** --- 327,331 ---- int layer; int column = 0; + int speed_ref; buildmap_set_line (irec); *************** *** 312,315 **** --- 372,376 ---- buildmap_range_add_no_address (line, street); + column += 4; } else { *************** *** 341,344 **** --- 402,415 ---- free (lat_arr); + /* from speed ref */ + if (!PQgetisnull(db_result, irec, column++)) { + speed_ref = atoi(PQgetvalue(db_result, irec, column-1)); + buildmap_postgres_read_speeds (tlid, speed_ref, 0); + } + + if (!PQgetisnull(db_result, irec, column++)) { + speed_ref = atoi(PQgetvalue(db_result, irec, column-1)); + buildmap_postgres_read_speeds (tlid, speed_ref, 1); + } } *************** *** 364,367 **** --- 435,440 ---- unsigned short to_cross_time; unsigned char layer; + unsigned short from_speed_ref; + unsigned short to_speed_ref; PGresult *db_result; *************** *** 402,408 **** line = buildmap_line_find_sorted(tlid); buildmap_line_route_add (from_car_allowed, to_car_allowed, from_max_speed, to_max_speed, ! from_cross_time, to_cross_time, line); --- 475,483 ---- line = buildmap_line_find_sorted(tlid); + from_speed_ref = buildmap_line_speed_get_ref (tlid, 0); + to_speed_ref = buildmap_line_speed_get_ref (tlid, 1); buildmap_line_route_add (from_car_allowed, to_car_allowed, from_max_speed, to_max_speed, ! from_speed_ref, to_speed_ref, line); Index: roadmap_line_route.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_line_route.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_line_route.h 12 Dec 2005 20:35:41 -0000 1.1 --- roadmap_line_route.h 3 Nov 2006 12:29:48 -0000 1.2 *************** *** 45,48 **** --- 45,52 ---- (int line, LineRouteTime *from, LineRouteTime *to); + int roadmap_line_route_get_cross_time (int line, int against_dir); + + int roadmap_line_route_get_speed (int line, int against_dir); + extern roadmap_db_handler RoadMapLineRouteHandler; --- NEW FILE: buildmap_line_speed.c --- /* buildmap_line_speed.c - Build line speeds table * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "roadmap_db_line_speed.h" #include "roadmap_hash.h" #include "buildmap.h" #include "buildmap_line_speed.h" #define MAX_SPEED_SLOTS 48 struct buildmap_line_speeds_line_struct { int tlid; int against_dir; int speed_ref; }; typedef struct buildmap_line_speeds_line_struct BuildMapSpeedLine; static int MaxSlotsPerLine = 0; static int SpeedsCount = 0; static int SpeedSlotsCount = 0; static int LinesCount = 0; static BuildMapSpeed *Speeds[BUILDMAP_BLOCK] = {NULL}; static BuildMapSpeedLine *Lines[BUILDMAP_BLOCK] = {NULL}; static RoadMapHash *SpeedByLine = NULL; static RoadMapHash *SpeedsHash = NULL; static int hash_speeds (const BuildMapSpeed *speeds) { int hash = 0; int i; for (i=0; i<speeds->count; i++) { hash += speeds->speeds[i].time_slot * speeds->speeds[i].speed; } return hash; } static RoadMapLineSpeed *dup_speeds(RoadMapLineSpeed *speeds, int count) { int i; RoadMapLineSpeed *dup = calloc (count, sizeof(RoadMapLineSpeed)); for (i=0; i<count; i++) { dup[i] = speeds[i]; } return dup; } BuildMapSpeed *buildmap_line_speed_new (void) { static BuildMapSpeed speed; if (speed.speeds == NULL) { speed.speeds = calloc (MAX_SPEED_SLOTS, sizeof(RoadMapLineSpeed)); } speed.count = 0; return &speed; } void buildmap_line_speed_free (BuildMapSpeed *speed) { speed->count = 0; } void buildmap_line_speed_add_slot (BuildMapSpeed *speeds, int time_slot, int speed) { if (speeds->count == MAX_SPEED_SLOTS) { buildmap_fatal (0, "buildmap_line_speed_add_slot: Too many slots."); } if (speeds->count == 0) { /* set first time slot to 0 */ time_slot = 0; } else if (speeds->speeds[speeds->count - 1].time_slot >= time_slot) { buildmap_fatal (0, "buildmap_line_speed_add_slot: inconsistent time slots"); } else if (speeds->speeds[speeds->count - 1].speed == speed) { /* The speed has not changed from the previous time slot */ return; } speeds->speeds[speeds->count].time_slot = time_slot; speeds->speeds[speeds->count].speed = speed; speeds->count++; } void buildmap_line_speed_initialize (void) { SpeedByLine = roadmap_hash_new ("SpeedByLine", BUILDMAP_BLOCK); SpeedsHash = roadmap_hash_new ("SpeedsHash", BUILDMAP_BLOCK); SpeedsCount = 0; SpeedSlotsCount = 0; LinesCount = 0; } int buildmap_line_speed_add (BuildMapSpeed *speeds, int tlid, int opposite) { int index; int block; int offset; int hash; int speed_ref = -1; BuildMapSpeedLine *this_line; BuildMapSpeed *this_speed; hash = hash_speeds (speeds); for (index = roadmap_hash_get_first (SpeedsHash, hash); index >= 0; index = roadmap_hash_get_next (SpeedsHash, index)) { this_speed = Speeds[index / BUILDMAP_BLOCK] + (index % BUILDMAP_BLOCK); if (this_speed->count == speeds->count) { int i; for (i=0; i<this_speed->count; i++) { if ((this_speed->speeds[i].speed != speeds->speeds[i].speed) || (this_speed->speeds[i].time_slot != speeds->speeds[i].time_slot)) { break; } } if (i == this_speed->count) { /* Found an equal speed series */ speed_ref = index; break; } } } if (speed_ref == -1) { /* We need to create a new speed series */ if (SpeedsCount == INVALID_SPEED) { buildmap_fatal (0, "Too many speed series."); } block = SpeedsCount / BUILDMAP_BLOCK; offset = SpeedsCount % BUILDMAP_BLOCK; if (Speeds[block] == NULL) { /* We need to add a new block to the table. */ Speeds[block] = calloc (BUILDMAP_BLOCK, sizeof(BuildMapSpeed)); if (Speeds[block] == NULL) { buildmap_fatal (0, "no more memory"); } roadmap_hash_resize (SpeedsHash, (block+1) * BUILDMAP_BLOCK); } this_speed = Speeds[block] + offset; this_speed->speeds = dup_speeds(speeds->speeds, speeds->count); this_speed->count = speeds->count; roadmap_hash_add (SpeedsHash, hash, SpeedsCount); speed_ref = SpeedsCount; SpeedSlotsCount += speeds->count; if (speeds->count > MaxSlotsPerLine) MaxSlotsPerLine = speeds->count; SpeedsCount += 1; } /* Lines storage */ block = LinesCount / BUILDMAP_BLOCK; offset = LinesCount % BUILDMAP_BLOCK; if (Lines[block] == NULL) { /* We need to add a new block to the table. */ Lines[block] = calloc (BUILDMAP_BLOCK, sizeof(BuildMapSpeedLine)); if (Lines[block] == NULL) { buildmap_fatal (0, "no more memory"); } roadmap_hash_resize (SpeedByLine, (block+1) * BUILDMAP_BLOCK); } this_line = Lines[block] + offset; this_line->tlid = tlid; this_line->speed_ref = speed_ref; this_line->against_dir = opposite; roadmap_hash_add (SpeedByLine, tlid, LinesCount); LinesCount += 1; return speed_ref; } unsigned short buildmap_line_speed_get_ref (int tlid, int against_dir) { int index; BuildMapSpeedLine *this_line; for (index = roadmap_hash_get_first (SpeedByLine, tlid); index >= 0; index = roadmap_hash_get_next (SpeedByLine, index)) { this_line = Lines[index / BUILDMAP_BLOCK] + (index % BUILDMAP_BLOCK); if ((this_line->tlid == tlid) && (this_line->against_dir == against_dir)) { return this_line->speed_ref; } } return INVALID_SPEED; } void buildmap_line_speed_sort (void) {} void buildmap_line_speed_save (void) { int i; int slot; int slot_count = 0; BuildMapSpeed *one_speed; RoadMapLineSpeed *db_speed; int *db_index; buildmap_db *root; buildmap_db *table_index; buildmap_db *table_data; buildmap_info ("saving line speed..."); root = buildmap_db_add_section (NULL, "line_speed"); if (root == NULL) buildmap_fatal (0, "Can't add a new section"); table_index = buildmap_db_add_child (root, "index", SpeedsCount, sizeof(int)); table_data = buildmap_db_add_child (root, "data", SpeedSlotsCount, sizeof(RoadMapLineSpeed)); db_index = (int *) buildmap_db_get_data (table_index); db_speed = (RoadMapLineSpeed *) buildmap_db_get_data (table_data); for (i = 0; i < SpeedsCount; i++) { one_speed = Speeds[i/BUILDMAP_BLOCK] + (i % BUILDMAP_BLOCK); db_index[i] = slot_count; for (slot = 0; slot < one_speed->count; slot++) { db_speed[slot_count++] = one_speed->speeds[slot]; } db_speed[slot_count-1].time_slot |= SPEED_EOL; } } void buildmap_line_speed_summary (void) { } void buildmap_line_speed_reset (void) { int i; for (i = 0; i < SpeedsCount; i++) { BuildMapSpeed *this_speed; this_speed = Speeds[i / BUILDMAP_BLOCK] + (i % BUILDMAP_BLOCK); free (this_speed->speeds); } for (i = 0; i < BUILDMAP_BLOCK; i++) { if (Speeds[i] != NULL) { free (Speeds[i]); Speeds[i] = NULL; } } for (i = 0; i < BUILDMAP_BLOCK; i++) { if (Lines[i] != NULL) { free (Lines[i]); Lines[i] = NULL; } } SpeedsCount = 0; SpeedSlotsCount = 0; LinesCount = 0; } |
From: Ehud S. <esh...@us...> - 2006-11-03 12:27:49
|
Update of /cvsroot/roadmap/roadmap_editor/src/ssd In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv5658/ssd Log Message: Directory /cvsroot/roadmap/roadmap_editor/src/ssd added to the repository |
From: Ehud S. <esh...@us...> - 2006-11-03 12:25:53
|
Update of /cvsroot/roadmap/roadmap_editor/src/unix In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv4898 Modified Files: roadmap_path.c Log Message: Fix directory leak. Index: roadmap_path.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/unix/roadmap_path.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** roadmap_path.c 31 Dec 2005 09:57:42 -0000 1.3 --- roadmap_path.c 3 Nov 2006 12:25:48 -0000 1.4 *************** *** 523,526 **** --- 523,527 ---- } *cursor = NULL; + closedir(directory); return result; |
From: Paul F. <pg...@us...> - 2006-11-03 02:42:23
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv31467 Modified Files: roadmap_start.c Log Message: add a couple of terse action names for tool buttons Index: roadmap_start.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_start.c,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** roadmap_start.c 2 Nov 2006 01:48:09 -0000 1.109 --- roadmap_start.c 3 Nov 2006 02:42:16 -0000 1.110 *************** *** 579,587 **** roadmap_trip_move_last_place }, ! {"routepointahead", "Reorder, move ahead", NULL, NULL, "Reorder the route, moving this point later in the route", roadmap_trip_move_routepoint_ahead }, ! {"routepointback", "Reorder, move back", NULL, NULL, "Reorder the route, moving this point earlier in the route", roadmap_trip_move_routepoint_back }, --- 579,587 ---- roadmap_trip_move_last_place }, ! {"routepointahead", "Reorder, move ahead", "Ahead", NULL, "Reorder the route, moving this point later in the route", roadmap_trip_move_routepoint_ahead }, ! {"routepointback", "Reorder, move back", "Back", NULL, "Reorder the route, moving this point earlier in the route", roadmap_trip_move_routepoint_back }, |
From: Paul F. <pg...@us...> - 2006-11-02 01:53:15
|
Update of /cvsroot/roadmap/roadmap In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv30220 Modified Files: README Log Message: update for new %R and %P escapes in sign formatting (routename and placename). add tip on how to get expat and popt on ubuntu/debian. Index: README =================================================================== RCS file: /cvsroot/roadmap/roadmap/README,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** README 27 Oct 2006 16:18:12 -0000 1.103 --- README 2 Nov 2006 01:53:12 -0000 1.104 *************** *** 11,15 **** RoadMap is an open source program for UNIX that displays street maps. When a GPS receiver is available RoadMap can track the current location ! of the vehicule on the screen, continuously adjusting the position of the map; it can also identify the name of the current street as well as the name of the next intersection. RoadMap can be used without a GPS receiver, --- 11,15 ---- RoadMap is an open source program for UNIX that displays street maps. When a GPS receiver is available RoadMap can track the current location ! of the vehicle on the screen, continuously adjusting the position of the map; it can also identify the name of the current street as well as the name of the next intersection. RoadMap can be used without a GPS receiver, *************** *** 129,133 **** RoadMap uses the expat library to load GPX trip and landmark files. RoadMap can be built without expat, with some loss of functionality, by ! changing config.mk to say: EXPAT = NO. Likewise, RoadMap can sometimes use the agg library to render anti- --- 129,135 ---- RoadMap uses the expat library to load GPX trip and landmark files. RoadMap can be built without expat, with some loss of functionality, by ! changing config.mk to say: EXPAT = NO. (On Debian or Ubuntu linux ! systems, use "apt-get install libexpat1-dev" to install the expat ! development library.) Likewise, RoadMap can sometimes use the agg library to render anti- *************** *** 663,667 **** produces one RoadMap .rdm map file. The tool uses the popt library for parsing the command line arguments: the option --help gives more ! information about the available options. Here is an example: --- 665,671 ---- produces one RoadMap .rdm map file. The tool uses the popt library for parsing the command line arguments: the option --help gives more ! information about the available options. (On Debian or Ubuntu linux ! systems, use "apt-get install libpopt-dev" to install the popt development ! library.) Here is an example: *************** *** 792,796 **** using the RGB syntax ('#' followed by an hexadecimal RGB value). ! * Waypoints, the compass and the vehicule's location all appear as small black squares. This is typical of a missing "sprites" file. The "sprite" file must be located in one of these directories:/urs/local/share/roadmap, --- 796,800 ---- using the RGB syntax ('#' followed by an hexadecimal RGB value). ! * Waypoints, the compass and the vehicle's location all appear as small black squares. This is typical of a missing "sprites" file. The "sprite" file must be located in one of these directories:/urs/local/share/roadmap, *************** *** 941,945 **** to the street (the closest the better, not more than the value set with Accuracy.Street), the direction of the street compare to the direction of ! the vehicule or if the street is connected to the current "locked" street. RoadMap uses fuzzy logic to combine these criteria into one single value. None of the fuzzyfied values for the distance and direction may be below --- 945,949 ---- to the street (the closest the better, not more than the value set with Accuracy.Street), the direction of the street compare to the direction of ! the vehicle or if the street is connected to the current "locked" street. RoadMap uses fuzzy logic to combine these criteria into one single value. None of the fuzzyfied values for the distance and direction may be below *************** *** 960,964 **** This is because RoadMap is designed for a PDA, where pens are used. ! A short mouse Click or pen tap on the map screen displays the name of the closest street (with the selected street block's range of address), road or freeway (if any). This display is shown for a limited amount of time --- 964,968 ---- This is because RoadMap is designed for a PDA, where pens are used. ! A short mouse click or pen tap on the map screen displays the name of the closest street (with the selected street block's range of address), road or freeway (if any). This display is shown for a limited amount of time *************** *** 1691,1695 **** * rdmghost is the driver test program. It is a silly small application that echoes back a previous position of RoadMap. ! It shows a green ghost vehicule that seems to chase the RoadMap position. The rdmghost driver uses the Ghost.Delay preferences items, which sets the delay for echoing the RoadMap --- 1695,1699 ---- * rdmghost is the driver test program. It is a silly small application that echoes back a previous position of RoadMap. ! It shows a green ghost vehicle that seems to chase the RoadMap position. The rdmghost driver uses the Ghost.Delay preferences items, which sets the delay for echoing the RoadMap *************** *** 1699,1703 **** It can connect to a friends server (gpsdrive 2.0.9), advertise the RoadMap location and provide RoadMap with the list and ! location of all vehicules known to the friends server. The rdmfriends driver use the Friends.Name and Friend.Server preferences items. The first item provides the name that --- 1703,1707 ---- It can connect to a friends server (gpsdrive 2.0.9), advertise the RoadMap location and provide RoadMap with the list and ! location of all vehicles known to the friends server. The rdmfriends driver use the Friends.Name and Friend.Server preferences items. The first item provides the name that *************** *** 1868,1871 **** --- 1872,1879 ---- | N: | the name of the selected or current street. *-----+-----------------------------------------------------------------+ + | P: | the name of the selected or current place. + *-----+-----------------------------------------------------------------+ + | R: | the name of the route or list containing the selected place. + *-----+-----------------------------------------------------------------+ | S: | Speed (set only when a trip is active). *-----+-----------------------------------------------------------------+ *************** *** 2370,2374 **** <<Comment:>> RoadMap uses fuzzy logic to identify what street ! the vehicule is on. This value if a minimum fuzzy result for RoadMap to select any street. This helps not selecting whatever street is near by when off-road. This also speeds --- 2378,2382 ---- <<Comment:>> RoadMap uses fuzzy logic to identify what street ! the vehicle is on. This value if a minimum fuzzy result for RoadMap to select any street. This helps not selecting whatever street is near by when off-road. This also speeds *************** *** 2420,2424 **** navigation logic. If a street is at a distance greater than this value, then RoadMap will never consider this street ! when searching which street the vehicule is on. [History.Depth] The maximum number of items in the <<find>> history. --- 2428,2432 ---- navigation logic. If a street is at a distance greater than this value, then RoadMap will never consider this street ! when searching which street the vehicle is on. [History.Depth] The maximum number of items in the <<find>> history. |
From: Paul F. <pg...@us...> - 2006-11-02 01:48:13
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv27537 Modified Files: roadmap.popup roadmap_screen.c roadmap_start.c roadmap_trip.c roadmap_trip.h Log Message: implement the ability to select places (landmarks, routepoints) with the mouse, and then edit/delete/move them with a menu. moving takes one more mouseclick (i.e. select, choose "move", click new location) which introduces a new callback on the mouse click routines. it feels like there should be a better way to chain on those routines, but this will do for now. add the route editing menu that i'm currently using to "long click popup" in roadmap.popup Index: roadmap_trip.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_trip.c,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** roadmap_trip.c 27 Oct 2006 02:33:14 -0000 1.70 --- roadmap_trip.c 2 Nov 2006 01:48:09 -0000 1.71 *************** *** 83,87 **** * try and put the trip name in the window title */ ! #define TRIP_TITLE_FMT " - trip %s" /* Default location is: 1 Market St, San Francisco, California, --- 83,87 ---- * try and put the trip name in the window title */ ! #define TRIP_TITLE_FMT " - %s" /* Default location is: 1 Market St, San Francisco, California, *************** *** 646,651 **** #define WAYPOINT_ACTION_DELETE 0 ! #define WAYPOINT_ACTION_MOVE_UP 1 ! #define WAYPOINT_ACTION_MOVE_DOWN 2 static void roadmap_trip_waypoint_manage_dialog_populate --- 646,651 ---- #define WAYPOINT_ACTION_DELETE 0 ! #define WAYPOINT_ACTION_MOVE_BACK 1 ! #define WAYPOINT_ACTION_MOVE_AHEAD 2 static void roadmap_trip_waypoint_manage_dialog_populate *************** *** 653,662 **** static void roadmap_trip_waypoint_manage_dialog_action ! (const char *name, void *data, int action) { int count; ! waypoint *waypointp, *neighbor; ! waypointp = (waypoint *) roadmap_dialog_get_data ("Names", ".Waypoints"); if (waypointp == NULL) { --- 653,665 ---- static void roadmap_trip_waypoint_manage_dialog_action ! (waypoint *waypointp, const char *name, void *data, int action) { int count; ! waypoint *neighbor; ! if (waypointp == NULL) { ! waypointp = (waypoint *) roadmap_dialog_get_data ! ("Names", ".Waypoints"); ! } if (waypointp == NULL) { *************** *** 666,670 **** switch(action) { ! case WAYPOINT_ACTION_MOVE_UP: if (waypointp == RoadMapTripStart) return; --- 669,675 ---- switch(action) { ! case WAYPOINT_ACTION_MOVE_BACK: ! if (data != ROUTE_WAYPOINTS) ! return; if (waypointp == RoadMapTripStart) return; *************** *** 674,678 **** break; ! case WAYPOINT_ACTION_MOVE_DOWN: if (waypointp == RoadMapTripDest) return; --- 679,685 ---- break; ! case WAYPOINT_ACTION_MOVE_AHEAD: ! if (data != ROUTE_WAYPOINTS) ! return; if (waypointp == RoadMapTripDest) return; *************** *** 698,702 **** RoadMapTripRefresh = 1; roadmap_screen_refresh (); ! roadmap_dialog_hide (name); return; } --- 705,710 ---- RoadMapTripRefresh = 1; roadmap_screen_refresh (); ! if (name != NULL) ! roadmap_dialog_hide (name); return; } *************** *** 732,739 **** count = roadmap_landmark_count(); } ! if (count > 0) { ! roadmap_trip_waypoint_manage_dialog_populate (count, data); ! } else { ! roadmap_dialog_hide (name); } } --- 740,749 ---- count = roadmap_landmark_count(); } ! if (name != NULL) { ! if (count > 0) { ! roadmap_trip_waypoint_manage_dialog_populate (count, data); ! } else { ! roadmap_dialog_hide (name); ! } } } *************** *** 742,746 **** (const char *name, void *data) { roadmap_trip_waypoint_manage_dialog_action ! (name, data, WAYPOINT_ACTION_DELETE); } --- 752,756 ---- (const char *name, void *data) { roadmap_trip_waypoint_manage_dialog_action ! (NULL, name, data, WAYPOINT_ACTION_DELETE); } *************** *** 748,752 **** (const char *name, void *data) { roadmap_trip_waypoint_manage_dialog_action ! (name, data, WAYPOINT_ACTION_MOVE_UP); } --- 758,762 ---- (const char *name, void *data) { roadmap_trip_waypoint_manage_dialog_action ! (NULL, name, data, WAYPOINT_ACTION_MOVE_BACK); } *************** *** 754,758 **** (const char *name, void *data) { roadmap_trip_waypoint_manage_dialog_action ! (name, data, WAYPOINT_ACTION_MOVE_DOWN); } --- 764,768 ---- (const char *name, void *data) { roadmap_trip_waypoint_manage_dialog_action ! (NULL, name, data, WAYPOINT_ACTION_MOVE_AHEAD); } *************** *** 1225,1229 **** } ! void roadmap_trip_insert_routepoint_best(void) { const char *name; --- 1235,1239 ---- } ! static void roadmap_trip_insert_routepoint_worker(int where) { const char *name; *************** *** 1238,1244 **** roadmap_trip_add_waypoint ! (name, &RoadMapTripLastSetPoint->map, PLACE_ROUTE_MARK_INSERT); } static waypoint * roadmap_trip_choose_best_next (const RoadMapPosition *pos); --- 1248,1280 ---- roadmap_trip_add_waypoint ! (name, &RoadMapTripLastSetPoint->map, where); } + void roadmap_trip_insert_routepoint_best(void) { + + roadmap_trip_insert_routepoint_worker(PLACE_ROUTE_MARK_INSERT); + } + + void roadmap_trip_insert_routepoint_dest(void) { + + roadmap_trip_insert_routepoint_worker(PLACE_ROUTE_MARK_DEST); + } + + void roadmap_trip_insert_routepoint_start(void) { + + roadmap_trip_insert_routepoint_worker(PLACE_ROUTE_MARK_START); + } + + void roadmap_trip_insert_trip_point(void) { + + roadmap_trip_insert_routepoint_worker(PLACE_TRIP_MARK); + } + + void roadmap_trip_insert_personal_point(void) { + + roadmap_trip_insert_routepoint_worker(PLACE_PERSONAL_MARK); + } + + static waypoint * roadmap_trip_choose_best_next (const RoadMapPosition *pos); *************** *** 2004,2054 **** - void roadmap_trip_initialize (void) { - - RoadMapTripFocal *focal; - - ROADMAP_LIST_INIT(&RoadMapTripWaypointHead); - ROADMAP_LIST_INIT(&RoadMapTripRouteHead); - ROADMAP_LIST_INIT(&RoadMapTripTrackHead); - - ROADMAP_LIST_INIT(&RoadMapTripQuickRoute.waypoint_list); - - for (focal = RoadMapTripFocalPoints; - focal->id != NULL; focal++) { - - roadmap_config_declare ("session", - &focal->config_position, "0,0"); - - if (focal->mobile) { - roadmap_config_declare ("session", &focal->config_direction, "0"); - } - - } - roadmap_config_declare - ("session", &RoadMapConfigTripName, ""); - roadmap_config_declare - ("session", &RoadMapConfigFocusName, "GPS"); - roadmap_config_declare - ("session", &RoadMapConfigFocusRotate, "1"); - - roadmap_config_declare_distance - ("preferences", &RoadMapConfigWaypointSize, "125 ft"); - - roadmap_config_declare_enumeration - ("preferences", &RoadMapConfigTripRotate, "yes", "no", NULL); - - roadmap_config_declare_enumeration - ("preferences", &RoadMapConfigTripShowInactiveRoutes, "yes", "no", NULL); - - roadmap_config_declare_enumeration - ("preferences", &RoadMapConfigTripShowRouteLines, "yes", "no", NULL); - roadmap_config_declare - ("preferences", &RoadMapConfigTripRouteLineColor, "red"); - - RoadMapTripShowInactiveRoutes = - roadmap_config_match (&RoadMapConfigTripShowInactiveRoutes, "yes"); - - } - const char *roadmap_trip_path_relative_to_trips(const char *filename) { const char *p; --- 2040,2043 ---- *************** *** 2384,2387 **** --- 2373,2377 ---- } + static void roadmap_trip_route_convert_worker (route_head *orig_route, char *new_name, *************** *** 2430,2433 **** --- 2420,2424 ---- } + void roadmap_trip_track_to_route (void) { *************** *** 2499,2502 **** --- 2490,2758 ---- + /* ---- support for finding the clicked-on waypoint ---- */ + + void roadmap_landmark_iterate(waypt_cb cb) { + waypt_iterator (roadmap_landmark_list(), cb); + } + + const char *RoadMapAreaCurListName; + void *RoadMapAreaCurListType; + int RoadMapTripPlaceMoving; + + typedef struct { + RoadMapListItem link; + waypoint *wpt; + const char *list; + void *type; + } roadmap_point_pointer; + + RoadMapList RoadMapTripAreaPoints; + roadmap_point_pointer *RoadMapTripLastPlace; + + void roadmap_trip_landmark_iterate (waypt_cb cb) { + waypt_iterator (&RoadMapTripWaypointHead, cb); + } + + void roadmap_trip_routepoint_iterate (waypt_cb cb) { + + RoadMapListItem *relem, *rtmp; + RoadMapListItem *elem, *tmp; + waypoint *w; + + ROADMAP_LIST_FOR_EACH (&RoadMapTripRouteHead, relem, rtmp) { + route_head *rh = (route_head *) relem; + RoadMapAreaCurListName = rh->rte_name; + RoadMapAreaCurListType = ROUTE_WAYPOINTS; + QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { + w = (waypoint *) elem; + (*cb)(w); + } + } + ROADMAP_LIST_FOR_EACH (&RoadMapTripTrackHead, relem, rtmp) { + route_head *rh = (route_head *) relem; + RoadMapAreaCurListName = rh->rte_name; + RoadMapAreaCurListType = ROUTE_WAYPOINTS; + QUEUE_FOR_EACH(&rh->waypoint_list, elem, tmp) { + w = (waypoint *) elem; + (*cb)(w); + } + } + } + + void + roadmap_trip_area_waypoint(const waypoint *waypointp) { + + roadmap_point_pointer *point_ptr; + + if (roadmap_math_point_is_visible (&waypointp->pos)) { + point_ptr = malloc(sizeof(*point_ptr)); + roadmap_check_allocated (point_ptr); + point_ptr->wpt = (waypoint *)waypointp; + point_ptr->list = RoadMapAreaCurListName; + point_ptr->type = RoadMapAreaCurListType; + roadmap_list_insert(&RoadMapTripAreaPoints, &point_ptr->link); + } + } + + + int roadmap_trip_retrieve_area_points + (RoadMapArea *area, RoadMapPosition *position) { + + RoadMapListItem *element, *tmp; + int count; + + /* clear old contents */ + ROADMAP_LIST_FOR_EACH(&RoadMapTripAreaPoints, element, tmp) { + free (roadmap_list_remove(element)); + } + RoadMapTripLastPlace = NULL; + + roadmap_math_set_focus (area); + + RoadMapAreaCurListName = "Personal landmark"; + RoadMapAreaCurListType = PERSONAL_WAYPOINTS; + roadmap_landmark_iterate (roadmap_trip_area_waypoint); + + RoadMapAreaCurListName = "Trip landmark"; + RoadMapAreaCurListType = TRIP_WAYPOINTS; + roadmap_trip_landmark_iterate (roadmap_trip_area_waypoint); + + roadmap_trip_routepoint_iterate (roadmap_trip_area_waypoint); + + roadmap_math_release_focus (); + + count = roadmap_list_count(&RoadMapTripAreaPoints); + + if (!count) { + roadmap_display_hide("Place"); + roadmap_screen_redraw (); + return 0; + } + + if (count) { + + roadmap_point_pointer *pp; + waypoint *wpt; + + while (count > 1) { /* find the closest point(s) */ + int dist, mindist = 999999999; + roadmap_point_pointer *minpp = NULL; + int ocount = count; + ROADMAP_LIST_FOR_EACH(&RoadMapTripAreaPoints, element, tmp) { + pp = (roadmap_point_pointer *)element; + wpt = pp->wpt; + dist = roadmap_math_distance (&wpt->pos, position); + if (dist < mindist) { + mindist = dist; + if (minpp) { + free (roadmap_list_remove(&minpp->link)); + count--; + } + minpp = pp; + } else if (dist > mindist) { + free (roadmap_list_remove(&pp->link)); + count--; + } /* else they're equal, keep both */ + } + /* the loop is in case we have two or more coincident points + * that are farther than the one we're searching for. we + * can only remove one point each time through the loop, so + * if they're both the same distance, we need to go through + * twice. + */ + if (ocount == count) break; + } + + pp = (roadmap_point_pointer *) + ROADMAP_LIST_FIRST(&RoadMapTripAreaPoints); + + wpt = pp->wpt; + + roadmap_message_set ('R', pp->list ? pp->list : ""); + roadmap_message_set ('P', wpt->shortname); + + roadmap_display_text("Place", "%s%s%s%s%s%s", + pp->list ? pp->list : "", + pp->list ? " / " : "", + wpt->shortname, + wpt->description ? " - " : "", + wpt->description ? wpt->description : "", + count > 1 ? " (more)" : ""); + roadmap_screen_redraw (); + + RoadMapTripLastPlace = pp; + } + + return 1; + } + + void roadmap_trip_delete_last_place(void) + { + if (RoadMapTripLastPlace == NULL) + return; + + roadmap_trip_waypoint_manage_dialog_action + (RoadMapTripLastPlace->wpt, NULL, RoadMapTripLastPlace->type, WAYPOINT_ACTION_DELETE); + + roadmap_list_remove(&RoadMapTripLastPlace->link); + RoadMapTripLastPlace = NULL; + roadmap_trip_set_modified(1); + } + + void roadmap_trip_edit_last_place(void) + { + if (RoadMapTripLastPlace == NULL) + return; + + roadmap_trip_dialog_waypoint_edit + ( RoadMapTripLastPlace->wpt, roadmap_preferences_use_keyboard ()); + + roadmap_trip_set_modified(1); + } + + /* intended to be called from popup menu -- uses popup location as move dest */ + void roadmap_trip_move_last_place(void) + { + waypoint *w; + roadmap_point_pointer *pp; + + if (RoadMapTripLastPlace == NULL) + return; + + pp = RoadMapTripLastPlace; + w = pp->wpt; + + roadmap_display_hide("Place"); + roadmap_display_text + ("Moving", "Moving %s%s%s%s%s (Long or Right Click to Cancel)", + pp->list ? pp->list : "", + pp->list ? " / " : "", + w->shortname, + w->description ? " - " : "", + w->description ? w->description : ""); + + roadmap_screen_redraw (); + + RoadMapTripPlaceMoving = 1; + } + + int roadmap_trip_move_last_place_callback + (int action, const RoadMapGuiPoint *point) { + + int ret; + + if (!RoadMapTripPlaceMoving) + return 0; + + if (action) { + waypoint *w; + roadmap_point_pointer *pp; + + if (RoadMapTripLastPlace == NULL) + return 0; + + pp = RoadMapTripLastPlace; + w = pp->wpt; + roadmap_math_to_position (point, &w->pos, 1); + roadmap_trip_set_modified(1); + RoadMapTripRefresh = 1; + roadmap_screen_refresh (); + ret = 1; + } else { + ret = RoadMapTripPlaceMoving; + } + + RoadMapTripPlaceMoving = 0; + + roadmap_display_hide("Moving"); + roadmap_screen_redraw (); + + return ret; + } + + void roadmap_trip_move_routepoint_ahead (void) { + + if (RoadMapTripLastPlace == NULL) + return; + + roadmap_trip_waypoint_manage_dialog_action + (RoadMapTripLastPlace->wpt, NULL, + RoadMapTripLastPlace->type, WAYPOINT_ACTION_MOVE_AHEAD); + + roadmap_trip_set_modified(1); + } + + void roadmap_trip_move_routepoint_back (void) { + + if (RoadMapTripLastPlace == NULL) + return; + + roadmap_trip_waypoint_manage_dialog_action + (RoadMapTripLastPlace->wpt, NULL, + RoadMapTripLastPlace->type, WAYPOINT_ACTION_MOVE_BACK); + + roadmap_trip_set_modified(1); + } + #if WGET_GOOGLE_ROUTE /* for fun -- should be cleaned up. given a route with just *************** *** 2537,2538 **** --- 2793,2844 ---- } #endif + + void roadmap_trip_initialize (void) { + + RoadMapTripFocal *focal; + + ROADMAP_LIST_INIT(&RoadMapTripWaypointHead); + ROADMAP_LIST_INIT(&RoadMapTripRouteHead); + ROADMAP_LIST_INIT(&RoadMapTripTrackHead); + + ROADMAP_LIST_INIT(&RoadMapTripAreaPoints); + + ROADMAP_LIST_INIT(&RoadMapTripQuickRoute.waypoint_list); + + for (focal = RoadMapTripFocalPoints; + focal->id != NULL; focal++) { + + roadmap_config_declare ("session", + &focal->config_position, "0,0"); + + if (focal->mobile) { + roadmap_config_declare ("session", &focal->config_direction, "0"); + } + + } + roadmap_config_declare + ("session", &RoadMapConfigTripName, ""); + roadmap_config_declare + ("session", &RoadMapConfigFocusName, "GPS"); + roadmap_config_declare + ("session", &RoadMapConfigFocusRotate, "1"); + + roadmap_config_declare_distance + ("preferences", &RoadMapConfigWaypointSize, "125 ft"); + + roadmap_config_declare_enumeration + ("preferences", &RoadMapConfigTripRotate, "yes", "no", NULL); + + roadmap_config_declare_enumeration + ("preferences", &RoadMapConfigTripShowInactiveRoutes, "yes", "no", NULL); + + roadmap_config_declare_enumeration + ("preferences", &RoadMapConfigTripShowRouteLines, "yes", "no", NULL); + roadmap_config_declare + ("preferences", &RoadMapConfigTripRouteLineColor, "red"); + + RoadMapTripShowInactiveRoutes = + roadmap_config_match (&RoadMapConfigTripShowInactiveRoutes, "yes"); + + } + Index: roadmap_trip.h =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_trip.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** roadmap_trip.h 27 Oct 2006 02:33:14 -0000 1.28 --- roadmap_trip.h 2 Nov 2006 01:48:09 -0000 1.29 *************** *** 26,29 **** --- 26,30 ---- #include "roadmap_types.h" + #include "roadmap_gui.h" #include "roadmap_gps.h" *************** *** 93,96 **** --- 94,113 ---- void roadmap_trip_insert_routepoint_best(void); + void roadmap_trip_insert_routepoint_dest(void); + void roadmap_trip_insert_routepoint_start(void); + void roadmap_trip_insert_trip_point(void); + void roadmap_trip_insert_personal_point(void); + + int roadmap_trip_retrieve_area_points + (RoadMapArea *area, RoadMapPosition *position); + + void roadmap_trip_delete_last_place(void); + void roadmap_trip_edit_last_place(void); + void roadmap_trip_move_last_place(void); + void roadmap_trip_move_routepoint_ahead (void); + void roadmap_trip_move_routepoint_back (void); + + int roadmap_trip_move_last_place_callback + (int action, const RoadMapGuiPoint *point); #if WGET_GOOGLE_ROUTE Index: roadmap.popup =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap.popup,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** roadmap.popup 27 Oct 2006 17:36:24 -0000 1.2 --- roadmap.popup 2 Nov 2006 01:48:08 -0000 1.3 *************** *** 10,11 **** --- 10,28 ---- gps + /Long Click Popup + cancel + - + lastplacedelete + lastplaceedit + lastplacemove + - + addroutepointnear + addroutepointstart + addroutepointend + - + addpersonallandmark + addtriplandmark + - + routepointahead + routepointback + Index: roadmap_screen.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_screen.c,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** roadmap_screen.c 27 Oct 2006 16:18:12 -0000 1.75 --- roadmap_screen.c 2 Nov 2006 01:48:08 -0000 1.76 *************** *** 991,995 **** int zoom; roadmap_math_get_context (&pos, &zoom); ! roadmap_display_text("Info", "No map available: %d %d", pos.longitude, pos.latitude); } --- 991,996 ---- int zoom; roadmap_math_get_context (&pos, &zoom); ! roadmap_display_text("Info", "No map available: " FLT_FMT ", " FLT_FMT, ! to_float(pos.longitude), to_float(pos.latitude)); } *************** *** 1095,1115 **** PluginLine line; int distance; RoadMapPosition position; roadmap_math_to_position (point, &position, 1); ! ! if (roadmap_navigate_retrieve_line ! (&position, ! roadmap_config_get_integer (&RoadMapConfigAccuracyMouse), ! &line, ! &distance) != -1) { PluginStreet street; - roadmap_trip_set_point ("Selection", &position); roadmap_display_activate ("Selected Street", &line, &position, &street); roadmap_screen_repaint (); } } --- 1096,1125 ---- PluginLine line; int distance; + int accuracy; RoadMapPosition position; + RoadMapArea area; + + if (roadmap_trip_move_last_place_callback(1, point)) { + return; + } + accuracy = roadmap_config_get_integer (&RoadMapConfigAccuracyMouse); roadmap_math_to_position (point, &position, 1); ! roadmap_math_focus_area (&area, &position, accuracy); ! ! if (roadmap_trip_retrieve_area_points(&area, &position)) { ! ; ! } else if (roadmap_navigate_retrieve_line ! (&area, &position, &line, &distance) != -1) { PluginStreet street; roadmap_display_activate ("Selected Street", &line, &position, &street); roadmap_screen_repaint (); } + + roadmap_trip_set_point ("Selection", &position); + } *************** *** 1117,1120 **** --- 1127,1134 ---- static void roadmap_screen_right_click (RoadMapGuiPoint *point) { + if (roadmap_trip_move_last_place_callback(0, point)) { + return; + } + roadmap_factory_popup (&RoadMapConfigEventRightClick, point); } *************** *** 1122,1125 **** --- 1136,1143 ---- static void roadmap_screen_long_click (RoadMapGuiPoint *point) { + if (roadmap_trip_move_last_place_callback(0, point)) { + return; + } + roadmap_factory_popup (&RoadMapConfigEventLongClick, point); } Index: roadmap_start.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_start.c,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** roadmap_start.c 27 Oct 2006 02:33:14 -0000 1.108 --- roadmap_start.c 2 Nov 2006 01:48:09 -0000 1.109 *************** *** 111,114 **** --- 111,121 ---- /* The menu and toolbar callbacks: --------------------------------------- */ + static void roadmap_start_cancel (void) { + /* for menus, mainly popups, where the mouse can easily cause + * an unwanted action -- putting this at the top of the menu + * helps prevent that */; + } + + static void roadmap_start_periodic (void); *************** *** 317,320 **** --- 324,330 ---- static RoadMapAction RoadMapStartActions[] = { + {"cancel", "", NULL, NULL, + "Do nothing", roadmap_start_cancel}, + {"preferences", "Preferences", "Preferences", "P", "Open the preferences editor", roadmap_preferences_edit}, *************** *** 525,544 **** roadmap_start_create_waypoint}, ! {"editroutewaypoints", "Route Waypoints...", NULL, NULL, "Edit current route's waypoints", roadmap_trip_route_waypoint_manage_dialog }, ! {"addroutewaypoint", "Add Route Waypoint", NULL, NULL, ! "Add selection to the current route's waypoints", roadmap_trip_insert_routepoint_best }, ! {"edittripwaypoints", "Trip Landmarks...", NULL, NULL, ! "Edit landmarks associated with this trip", roadmap_trip_trip_waypoint_manage_dialog }, ! {"editpersonalwaypoints", "Personal Landmarks...", NULL, NULL, ! "Edit personal landmarks", roadmap_trip_personal_waypoint_manage_dialog }, ! {"mergepersonalwaypoints", "Load more Personal Landmarks...", NULL, NULL, "Merge personal landmarks from file", roadmap_start_merge_landmark }, {"full", "Full Screen", "Full", "F", "Toggle the window full screen mode (depends on the window manager)", --- 535,590 ---- roadmap_start_create_waypoint}, ! {"editroutepoints", "Route Waypoints...", NULL, NULL, "Edit current route's waypoints", roadmap_trip_route_waypoint_manage_dialog }, ! {"addroutepointnear", "Insert Route Waypoint", NULL, NULL, ! "Insert routepoint into nearest leg of the current route", roadmap_trip_insert_routepoint_best }, ! {"addroutepointend", "Append Past Route Destination", NULL, NULL, ! "Add routepoint past the end of current route", ! roadmap_trip_insert_routepoint_dest }, ! {"addroutepointstart", "Prepend Before Route Start", NULL, NULL, ! "Add routepoint before the start of current route", ! roadmap_trip_insert_routepoint_start }, ! {"addtriplandmark", "Add Trip Landmark", NULL, NULL, ! "Add selection to list of trip landmarks", ! roadmap_trip_insert_trip_point }, ! ! {"addpersonallandmark", "Add Personal Landmark", NULL, NULL, ! "Add selection to list of personal landmarks", ! roadmap_trip_insert_personal_point }, ! ! {"edittriplandmarks", "Trip Landmarks...", NULL, NULL, ! "Edit landmarks associated with this trip", ! roadmap_trip_trip_waypoint_manage_dialog }, ! ! {"editpersonallandmarks", "Personal Landmarks...", NULL, NULL, ! "Edit personal landmarks", ! roadmap_trip_personal_waypoint_manage_dialog }, ! ! {"mergepersonallandmarks", "Load more Personal Landmarks...", NULL, NULL, "Merge personal landmarks from file", roadmap_start_merge_landmark }, + {"lastplacedelete", "Delete place", "Delete Selected Place", NULL, + "Delete the last selected place", roadmap_trip_delete_last_place }, + + {"lastplaceedit", "Edit place", "Edit Selected Place", NULL, + "Edit the last selected place", roadmap_trip_edit_last_place }, + + {"lastplacemove", "Move place", NULL, NULL, + "Relocate the last selected place to the popup location", + roadmap_trip_move_last_place }, + + {"routepointahead", "Reorder, move ahead", NULL, NULL, + "Reorder the route, moving this point later in the route", + roadmap_trip_move_routepoint_ahead }, + + {"routepointback", "Reorder, move back", NULL, NULL, + "Reorder the route, moving this point earlier in the route", + roadmap_trip_move_routepoint_back }, + {"full", "Full Screen", "Full", "F", "Toggle the window full screen mode (depends on the window manager)", *************** *** 655,663 **** "addaswaypoint", "gpsaswaypoint", ! "addroutewaypoint", ! "editroutewaypoints", ! "edittripwaypoints", ! "editpersonalwaypoints", ! "mergepersonalwaypoints", RoadMapFactorySeparator, --- 701,709 ---- "addaswaypoint", "gpsaswaypoint", ! "addroutepointnear", ! "editroutepoints", ! "edittriplandmarks", ! "editpersonallandmarks", ! "mergepersonallandmarks", RoadMapFactorySeparator, |
From: Paul F. <pg...@us...> - 2006-11-02 01:42:02
|
Update of /cvsroot/roadmap/roadmap/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv25971 Modified Files: roadmap_display.c Log Message: add new "Place" and "Moving" signs (identical, except for inverted colors), used when selecting (and moving) waypoints Index: roadmap_display.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_display.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** roadmap_display.c 12 Oct 2006 13:05:06 -0000 1.28 --- roadmap_display.c 2 Nov 2006 01:41:59 -0000 1.29 *************** *** 130,133 **** --- 130,135 ---- ROADMAP_SIGN("GPS", "Approach", SIGN_TOP, "Approaching %N, %C|Approaching %N", "DarkSeaGreen4", "white"), ROADMAP_SIGN(NULL, "Selected Street", SIGN_BOTTOM, "%F", "yellow", "black"), + ROADMAP_SIGN(NULL, "Place", SIGN_BOTTOM, NULL, "yellow", "black"), + ROADMAP_SIGN(NULL, "Moving", SIGN_BOTTOM, NULL, "black", "yellow"), ROADMAP_SIGN(NULL, "Info", SIGN_CENTER, NULL, "yellow", "black"), ROADMAP_SIGN(NULL, "Error", SIGN_CENTER, NULL, "red", "white"), *************** *** 701,711 **** roadmap_display_console_box - (ROADMAP_CANVAS_TOP|ROADMAP_CANVAS_RIGHT, - &RoadMapConfigDisplayTopRight); - - roadmap_display_console_box (ROADMAP_CANVAS_TOP|ROADMAP_CANVAS_LEFT, &RoadMapConfigDisplayTopLeft); for (sign = RoadMapStreetSign; sign->title != NULL; ++sign) { --- 703,713 ---- roadmap_display_console_box (ROADMAP_CANVAS_TOP|ROADMAP_CANVAS_LEFT, &RoadMapConfigDisplayTopLeft); + roadmap_display_console_box + (ROADMAP_CANVAS_TOP|ROADMAP_CANVAS_RIGHT, + &RoadMapConfigDisplayTopRight); + for (sign = RoadMapStreetSign; sign->title != NULL; ++sign) { |