|
From: Adam B. <ab...@us...> - 2005-04-04 03:00:29
|
Update of /cvsroot/hipgmap/gmap/com/trileet/gmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9883/com/trileet/gmap Modified Files: GMap.java Hit.java ImageCache.java MapWindow.java SearchWindow.java TileSet.java Log Message: Summary of yesterday and today's edits: * Messed with the menus some more. Events are now handled a bit better. * Directions and Hits are now kept statically in the GMap object. * You can hold down the scrollwheel on a hit to access its context menu. * Saved hits now fully functional * Reduced redundant datastore-saving of image tiles * Added direction-reversing * Make the ImageCache thread stop on quit (still needs work.) Index: MapWindow.java =================================================================== RCS file: /cvsroot/hipgmap/gmap/com/trileet/gmap/MapWindow.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** MapWindow.java 3 Apr 2005 11:21:53 -0000 1.13 --- MapWindow.java 4 Apr 2005 03:00:19 -0000 1.14 *************** *** 157,161 **** m_tileSet.debug(); } ! // Our tile set private TileSet m_tileSet; --- 157,161 ---- m_tileSet.debug(); } ! public void quit() {m_tileSet.quit();} // Our tile set private TileSet m_tileSet; Index: ImageCache.java =================================================================== RCS file: /cvsroot/hipgmap/gmap/com/trileet/gmap/ImageCache.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ImageCache.java 3 Apr 2005 11:21:53 -0000 1.7 --- ImageCache.java 4 Apr 2005 03:00:19 -0000 1.8 *************** *** 200,204 **** */ public void run(){ ! while(1 == 1){ try{ // our process is like so: --- 200,204 ---- */ public void run(){ ! while(s_running){ try{ // our process is like so: *************** *** 285,289 **** loadFromDataStore(); // start our thread ! new Thread(this).start(); } --- 285,290 ---- loadFromDataStore(); // start our thread ! s_thread = new Thread(this); ! s_thread.start(); } *************** *** 395,398 **** --- 396,404 ---- } + public static void quit() { + s_running=false; + //TODO: interrupt here? + + } public static void main(String[] argv) { *************** *** 426,428 **** --- 432,437 ---- private static DataStore mDataStore; + /** Our thread. */ + private static Thread s_thread; + private static boolean s_running=true; } Index: TileSet.java =================================================================== RCS file: /cvsroot/hipgmap/gmap/com/trileet/gmap/TileSet.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** TileSet.java 3 Apr 2005 11:21:53 -0000 1.19 --- TileSet.java 4 Apr 2005 03:00:20 -0000 1.20 *************** *** 98,102 **** } public void adjustContextMenu(Menu menu) { ! MenuItem contextItem = menu.getItemWithID(kID_hitsSubMenu); if (m_currentHit <0) { contextItem.disable(); --- 98,102 ---- } public void adjustContextMenu(Menu menu) { ! MenuItem contextItem = menu.getItemWithIDOrNull(kID_hitsSubMenuMap); if (m_currentHit <0) { contextItem.disable(); *************** *** 504,508 **** } } ! public void debug() { // m_polyline.debug(); --- 504,510 ---- } } ! public void quit() { ! ImageCache.quit(); ! } public void debug() { // m_polyline.debug(); Index: GMap.java =================================================================== RCS file: /cvsroot/hipgmap/gmap/com/trileet/gmap/GMap.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** GMap.java 3 Apr 2005 11:21:52 -0000 1.22 --- GMap.java 4 Apr 2005 03:00:18 -0000 1.23 *************** *** 57,60 **** --- 57,64 ---- s_searchWindow.show(); return true; + case REV_DIRS: + s_searchWindow.indicateSearching(); + e.argument = s_dirs.reverseQuery(); + // fall through to NEW_SEARCH case NEW_SEARCH: String search = (String) e.argument; *************** *** 114,118 **** m_networkUp=true; break; ! //TODO: these last two should be handled by searchwindow itself. case GET_CONTACT: --- 118,123 ---- m_networkUp=true; break; ! case SystemEventIds.APPLICATION_QUIT: ! quit(); //TODO: these last two should be handled by searchwindow itself. case GET_CONTACT: *************** *** 127,132 **** return true; } ! return (super.receiveEvent(e)); } --- 132,138 ---- return true; + } ! System.out.println("Event: " + String.valueOf(e.type)); return (super.receiveEvent(e)); } *************** *** 281,284 **** --- 287,294 ---- m_lastWindow = getFrontScreenWindow(); } + public void quit() { + s_mapWindow.quit(); + super.quit(); + } public static void invalidateMap(){ Index: Hit.java =================================================================== RCS file: /cvsroot/hipgmap/gmap/com/trileet/gmap/Hit.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Hit.java 3 Apr 2005 11:21:52 -0000 1.13 --- Hit.java 4 Apr 2005 03:00:19 -0000 1.14 *************** *** 42,45 **** --- 42,48 ---- // our pin bitmap private static Bitmap s_pinBitmap; + static { + loadBitmaps(); + } private static Bitmap s_topLeft; *************** *** 151,155 **** public void paint(Pen p, int offsetX, int offsetY, int mapX, int mapY, int zoom, boolean drawInfo) { ! // Figure out where this hit would get drawn int tileX = m_point.getPaintX(offsetX, mapX, zoom); --- 154,164 ---- public void paint(Pen p, int offsetX, int offsetY, int mapX, int mapY, int zoom, boolean drawInfo) { ! if (m_point == null) { ! System.out.println("mpoint is null!"); ! return; ! } ! if (s_pinBitmap == null) { ! System.out.println("No bitmap!"); ! } // Figure out where this hit would get drawn int tileX = m_point.getPaintX(offsetX, mapX, zoom); *************** *** 161,165 **** p.drawBitmap(tileX - (s_pinBitmap.getWidth() / 2), tileY - s_pinBitmap.getHeight(), s_pinBitmap); - if (drawInfo) { int width = Math.max(Math.max(Math.max(Math.max(bf.getWidth(title), --- 170,173 ---- *************** *** 369,372 **** --- 377,381 ---- /** Unflatten. **/ public Hit (byte[] abyte) { + loadBitmaps(); DataRecord dr = new DataRecord(abyte,1); //type = (short) dr.getShort(0,0); Index: SearchWindow.java =================================================================== RCS file: /cvsroot/hipgmap/gmap/com/trileet/gmap/SearchWindow.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** SearchWindow.java 3 Apr 2005 11:21:53 -0000 1.15 --- SearchWindow.java 4 Apr 2005 03:00:19 -0000 1.16 *************** *** 142,149 **** } ! // Say we are searching ! clearResultsView(); ! addRow(" ... searching ...", Font ! .findItalicSystemFont()); // Send the event up to our app --- 142,146 ---- } ! indicateSearching(); // Send the event up to our app *************** *** 158,164 **** return super.receiveEvent(e); } ! public void adjustActionMenuState(Menu menu) { ! MenuItem contextItem = menu.getItemWithID(kID_hitsSubMenu); if (m_results.getFocusedChild() instanceof HitBox) { contextItem.enable(); --- 155,169 ---- return super.receiveEvent(e); } ! public void indicateSearching() { ! // Say we are searching ! clearResultsView(); ! addRow(" ... searching ...", Font ! .findItalicSystemFont()); ! } public void adjustActionMenuState(Menu menu) { ! MenuItem contextItem = menu.getItemWithIDOrNull(kID_hitsSubMenuSearch); ! if (contextItem == null) { ! return; ! } if (m_results.getFocusedChild() instanceof HitBox) { contextItem.enable(); *************** *** 246,249 **** --- 251,270 ---- return super.eventWidgetDown(widget, event); } + public boolean eventWidgetHeld(int widget, Event event) { + /** If the scrollwheel is held, display the context menu. + * Hacked out by analogy to the ContactBrowser. + **/ + if (widget == Event.DEVICE_WHEEL_BUTTON && + m_results.getFocusedChild() instanceof HitBox) { + Menu m = new Menu(""); + ((HitBox)m_results.getFocusedChild()).adjustContextMenuState(m); + m.setWindow(this); + //m.setPosition(0,0); + m.enterMenu(true); + return true; + } + return super.eventWidgetHeld(widget,event); + } + /** *************** *** 335,338 **** --- 356,360 ---- public void handleVCard( IPCMessage ipcm) { String vcard = ipcm.findString("vcard"); + StringBuffer munged = new StringBuffer(); /** Parse the VCard content and get the searchable address. * TODO: This needs a lot of improvement... *************** *** 343,355 **** } i = vcard.indexOf(":",i); ! int j = vcard.indexOf("\r\n",i); ! vcard = vcard.substring(i+1,j); //TODO: should support spanning multiple lines... something like the below while loop vcard = vcard.replace(';',','); m_searchField.insert(vcard); ! /** ! while (vcard.subString(j+2,j+3).equals(" ")) { ! ! } ! **/ } /** Our search field */ --- 365,378 ---- } i = vcard.indexOf(":",i); ! int j; ! do { ! j = vcard.indexOf("\r\n",i); ! munged.append(vcard.substring(i+1,j)); ! i = j+2; ! } while (vcard.substring(j+2,j+3).equals(" ")); ! vcard = munged.toString(); vcard = vcard.replace(';',','); m_searchField.insert(vcard); ! } /** Our search field */ |