Changeset 2562
- Timestamp:
- 07/30/07 12:46:34 (6 years ago)
- Location:
- trunk/src/target/OM-2007.2
- Files:
-
- 1 added
- 3 edited
- 10 copied
-
applications/openmoko-calculator (copied) (copied from trunk/src/target/OM-2007/applications/openmoko-calculator)
-
applications/openmoko-calculator/AUTHORS (copied) (copied from trunk/src/target/OM-2007/applications/openmoko-calculator/AUTHORS)
-
applications/openmoko-calculator/Makefile.am (copied) (copied from trunk/src/target/OM-2007/applications/openmoko-calculator/Makefile.am)
-
applications/openmoko-calculator/README (copied) (copied from trunk/src/target/OM-2007/applications/openmoko-calculator/README)
-
applications/openmoko-calculator/autogen.sh (copied) (copied from trunk/src/target/OM-2007/applications/openmoko-calculator/autogen.sh)
-
applications/openmoko-calculator/configure.ac (copied) (copied from trunk/src/target/OM-2007/applications/openmoko-calculator/configure.ac) (1 diff)
-
applications/openmoko-calculator/data (copied) (copied from trunk/src/target/OM-2007/applications/openmoko-calculator/data)
-
applications/openmoko-calculator/openmoko-calculator.pro (copied) (copied from trunk/src/target/OM-2007/applications/openmoko-calculator/openmoko-calculator.pro)
-
applications/openmoko-calculator/po (copied) (copied from trunk/src/target/OM-2007/applications/openmoko-calculator/po)
-
applications/openmoko-calculator/po/Makefile.in.in (modified) (3 diffs)
-
applications/openmoko-calculator/src (copied) (copied from trunk/src/target/OM-2007/applications/openmoko-calculator/src)
-
applications/openmoko-calculator/src/calc-main.c (modified) (9 diffs)
-
artwork/themes/openmoko-standard-2/gtk-2.0/gtkrc (modified) (1 diff)
-
artwork/themes/openmoko-standard-2/gtk-2.0/openmoko-calculator (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/OM-2007.2/applications/openmoko-calculator/configure.ac
r2561 r2562 19 19 20 20 # base deps 21 PKG_CHECK_MODULES(OPENMOKO, openmoko-libs >= 0.0.1,, 22 AC_MSG_ERROR([*** Required OpenMoko Libraries >= 0.0.1 not installed ***])) 21 PKG_CHECK_MODULES(OPENMOKO, libmokoui2) 23 22 LIBS="$LIBS $GTK_LIBS $OPENMOKO_LIBS" 24 23 CFLAGS="$CFLAGS $OPENMOKO_CFLAGS" -
trunk/src/target/OM-2007.2/applications/openmoko-calculator/po/Makefile.in.in
r1632 r2562 26 26 prefix = @prefix@ 27 27 exec_prefix = @exec_prefix@ 28 datarootdir = @datarootdir@ 28 29 datadir = @datadir@ 29 30 libdir = @libdir@ … … 41 42 GMSGFMT = @GMSGFMT@ 42 43 MSGFMT = @MSGFMT@ 44 MSGFMT_OPTS = @MSGFMT_OPTS@ 43 45 XGETTEXT = @XGETTEXT@ 44 46 MSGMERGE = msgmerge … … 79 81 .po.gmo: 80 82 file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ 81 && rm -f $$file && $(GMSGFMT) -c-o $$file $<83 && rm -f $$file && $(GMSGFMT) $(MSGFMT_OPTS) -o $$file $< 82 84 83 85 .po.cat: -
trunk/src/target/OM-2007.2/applications/openmoko-calculator/src/calc-main.c
r2404 r2562 24 24 #include <string.h> 25 25 26 #include <libmokoui/moko-application.h>27 #include <libmokoui/moko-finger-tool-box.h>28 #include <libmokoui/moko-finger-window.h>29 #include <libmokoui/moko-finger-wheel.h>30 31 #include <gtk/gtkalignment.h>32 #include <gtk/gtkbutton.h>33 #include <gtk/gtklabel.h>34 #include <gtk/gtkmain.h>35 #include <gtk/gtkmenu.h>36 #include <gtk/gtkvbox.h>37 26 #include <gtk/gtk.h> 38 39 27 #include <glib.h> 40 28 #include <glib/gi18n.h> … … 81 69 #define CALC_COLS 4 82 70 static const gchar *label[CALC_ROWS][CALC_COLS] = { 83 {N_("Clear All"), N_("Clear"), " <big><b>/</b></big>", "<big><b>*</b></big>" },84 {" <big><b>7</b></big>", "<big><b>8</b></big>", "<big><b>9</b></big>", "<big><b>+</b></big>"},85 {" <big><b>4</b></big>", "<big><b>5</b></big>", "<big><b>6</b></big>", "<big><b>-</b></big>"},86 {" <big><b>1</b></big>", "<big><b>2</b></big>", "<big><b>3</b></big>", "<big><b>=</b></big>"},87 {" <big><b>0</b></big>", N_("<big><b>.</b></big>"), "<big><b>+</b></big>/<big><b>-</b></big>", "none"},71 {N_("Clear All"), N_("Clear"), "/", "*" }, 72 {"7", "8", "9", "+"}, 73 {"4", "5", "6", "-"}, 74 {"1", "2", "3", "="}, 75 {"0", N_("."), "+/-", "none"}, 88 76 }; 89 77 static enum operation ops[CALC_ROWS][CALC_COLS] = { … … 130 118 if ((the_state.func != &noop_func) || (++toomany % 7)) 131 119 gtk_label_set_markup(GTK_LABEL(displayed_label), 132 _("<big>Not a Number</big> <span font_desc=\"48\" > <b>NaN</b></span>"));120 _("<big>Not a Number</big>")); 133 121 else 134 122 /* ok, let's have some fun too... */ 135 123 gtk_label_set_markup(GTK_LABEL(displayed_label), 136 _("<big>Not a Number</big> <span font_desc=\"48\" ><b>NaN</b></span>\n"124 _("<big>Not a Number</big>\n" 137 125 "<span foreground=\"darkgrey\" size=\"smaller\">covert_channel/ack</span>\n" 138 126 "<span foreground=\"orange\" style=\"italic\">Beam request transmitted...</span>")); 139 } else if (isinf(v)>0) { 140 /* positive infinity */ 141 gtk_label_set_markup(GTK_LABEL(displayed_label),"<span font_desc=\"48\" >∞</span>"); 142 } else { 143 /* only negative infinity remains... */ 144 gtk_label_set_markup(GTK_LABEL(displayed_label),"<span font_desc=\"48\" >-∞</span>"); 127 } 128 else if (isinf(v)>0) 129 { 130 /* positive infinity */ 131 gtk_label_set_markup(GTK_LABEL(displayed_label),"∞"); 132 } 133 else 134 { 135 /* only negative infinity remains... */ 136 gtk_label_set_markup(GTK_LABEL(displayed_label),"-∞"); 145 137 } 146 138 return; /* short-cut out */ … … 153 145 value *= pow(10,-expof10); 154 146 if (expof10 >= MAX_DISPLAY_CHARS) 155 snprintf(dispstring,MAX_DISPLAY_MARKUP," <span font_desc=\"48\" >%.*g <small>e</small><sup><big>%d</big></sup></span>",(MAX_DISPLAY_CHARS-2),value,expof10);147 snprintf(dispstring,MAX_DISPLAY_MARKUP,"%.*g <small>e</small><sup><big>%d</big></sup>",(MAX_DISPLAY_CHARS-2),value,expof10); 156 148 else 157 snprintf(dispstring,MAX_DISPLAY_MARKUP," <span font_desc=\"48\" >%.*g</span>",MAX_DISPLAY_CHARS,v);149 snprintf(dispstring,MAX_DISPLAY_MARKUP,"%.*g",MAX_DISPLAY_CHARS,v); 158 150 } 159 151 } else { 160 152 /* We display entered value including trailing 0s */ 161 153 if (the_state.decimal_point == TRUE) 162 snprintf(dispstring,MAX_DISPLAY_MARKUP," <span font_desc=\"48\" >%#.*f</span>",the_state.n_fractional,v);154 snprintf(dispstring,MAX_DISPLAY_MARKUP,"%#.*f",the_state.n_fractional,v); 163 155 else 164 snprintf(dispstring,MAX_DISPLAY_MARKUP," <span font_desc=\"48\" >%.*f</span>",the_state.n_fractional,v);156 snprintf(dispstring,MAX_DISPLAY_MARKUP,"%.*f",the_state.n_fractional,v); 165 157 } 166 158 #if 1 … … 295 287 * Convenience static function 296 288 */ 297 static GtkTable* calc_panel_init (void) 298 { 299 300 GtkTable *table; 289 static GtkWidget* 290 calc_panel_init (void) 291 { 292 293 GtkWidget *table; 301 294 int i, j; 302 295 303 table = GTK_TABLE(gtk_table_new (CALC_ROWS, CALC_COLS, TRUE)); 304 gtk_table_set_row_spacings(table, 10); 305 gtk_table_set_col_spacings(table, 10); 296 table = gtk_table_new (CALC_ROWS, CALC_COLS, TRUE); 306 297 307 298 for (j = 0; j < CALC_COLS; j++) 308 299 for (i = 0; i < CALC_ROWS; i++) 309 300 { 310 Gtk Button* button = GTK_BUTTON(gtk_button_new());301 GtkWidget* button = gtk_button_new(); 311 302 GtkWidget* blabel = gtk_label_new(NULL); 312 303 gtk_label_set_markup(GTK_LABEL(blabel),gettext(label[i][j])); … … 315 306 g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(calc_button_pressed),&(ops[i][j])); 316 307 /* TODO: Check if this changes the aspect */ 317 gtk_widget_set_name( GTK_WIDGET(button), wnames[i][j]);308 gtk_widget_set_name(button, wnames[i][j]); 318 309 319 310 if ((j == (CALC_COLS-1)) && (i == (CALC_ROWS-2))) { 320 311 /* Last button spans two cells vertically */ 321 gtk_table_attach_defaults ( table, GTK_WIDGET(button),312 gtk_table_attach_defaults (GTK_TABLE (table), button, 322 313 j, j + 1, i, i + 2); 323 314 i++; 324 315 } else { 325 gtk_table_attach_defaults ( table, GTK_WIDGET(button),316 gtk_table_attach_defaults (GTK_TABLE (table), button, 326 317 j, j + 1, i, i + 1); 327 318 } 328 gtk_widget_set_size_request (GTK_WIDGET(button), 20, 20);329 319 } 330 320 return table; … … 346 336 int main( int argc, char** argv ) 347 337 { 348 GtkHBox* hbox; 349 GtkVBox* vbox; 350 GtkTable* table; 338 GtkWidget* vbox; 339 GtkWidget* table; 351 340 352 341 calc_debug( "openmoko-calculator starting up" ); … … 370 359 textdomain (GETTEXT_PACKAGE); 371 360 372 /* application object */ 373 /* MokoApplication* app = MOKO_APPLICATION(moko_application_get_instance()); */ 361 /* application */ 374 362 g_set_application_name( _("Calculator") ); 375 363 376 364 /* main window */ 377 MokoFingerWindow* window = MOKO_FINGER_WINDOW(moko_finger_window_new()); 378 379 /* application menu */ 380 GtkMenu* appmenu = GTK_MENU(gtk_menu_new()); 381 GtkMenuItem* closeitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( _("Close") )); 382 g_signal_connect( G_OBJECT(closeitem), "activate", G_CALLBACK(gtk_main_quit), NULL ); 383 gtk_menu_shell_append( GTK_MENU_SHELL(appmenu), GTK_WIDGET(closeitem) ); 384 moko_finger_window_set_application_menu( window, appmenu ); 365 GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 385 366 386 367 /* connect close event */ … … 388 369 389 370 /* contents */ 390 hbox = GTK_HBOX(gtk_hbox_new(TRUE, 10)); /* The hbox is just to get some border space...! */ 391 vbox = GTK_VBOX(gtk_vbox_new(FALSE, 10)); 371 vbox = gtk_vbox_new(FALSE, 10); 392 372 393 373 displayed_label = gtk_label_new("123"); 374 gtk_widget_set_name (displayed_label, "calculator-display"); 394 375 gtk_misc_set_alignment(GTK_MISC(displayed_label), 1, 0); 395 376 update_display(0.0); 396 GtkWidget *eventbox1 = gtk_event_box_new (); 397 gtk_widget_set_name (eventbox1, "gtkeventbox-black"); 398 gtk_container_add (GTK_CONTAINER (eventbox1), displayed_label); 399 gtk_box_pack_start( GTK_BOX(vbox), eventbox1, FALSE, FALSE, 10); 377 378 GtkWidget *display_frame; 379 display_frame = gtk_frame_new (NULL); 380 gtk_container_add (GTK_CONTAINER (display_frame), displayed_label); 381 382 GtkWidget *display_eventbox = gtk_event_box_new (); 383 gtk_widget_set_name (display_eventbox, "calculator-display-background"); 384 gtk_container_add (GTK_CONTAINER (display_eventbox), display_frame); 385 gtk_box_pack_start( GTK_BOX(vbox), display_eventbox, FALSE, FALSE, 0); 400 386 401 387 table = calc_panel_init(); 402 gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(table), TRUE, TRUE, 10); 403 404 gtk_box_pack_start( GTK_BOX(hbox), GTK_WIDGET(vbox), TRUE, TRUE, 10); 405 moko_finger_window_set_contents(window, GTK_WIDGET(hbox)); 388 gtk_box_pack_start( GTK_BOX(vbox), table, TRUE, TRUE, 0); 389 390 GtkWidget *main_frame = gtk_frame_new (NULL); 391 gtk_frame_set_shadow_type (GTK_FRAME (main_frame), GTK_SHADOW_NONE); 392 gtk_widget_set_name (main_frame, "calculator-frame"); 393 gtk_container_add (GTK_CONTAINER (main_frame), vbox); 394 gtk_container_add (GTK_CONTAINER (window), main_frame); 406 395 407 396 /* show everything and run main loop */ -
trunk/src/target/OM-2007.2/artwork/themes/openmoko-standard-2/gtk-2.0/gtkrc
r2523 r2562 129 129 130 130 #include "mokomessagedialog" 131 include "openmoko-calculator"
Note: See TracChangeset
for help on using the changeset viewer.
