Binary files free42-1.4.27-orig/Free42Linux.tgz and free42-1.4.27-hildon/Free42Linux.tgz differ diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/common/skin2cc.cc free42-1.4.27-hildon/common/skin2cc.cc --- free42-1.4.27-orig/common/skin2cc.cc 2006-03-27 05:03:00.000000000 +0300 +++ free42-1.4.27-hildon/common/skin2cc.cc 2006-09-12 21:45:49.000000000 +0300 @@ -26,7 +26,11 @@ #define SKIN2CC "skin2cpp" #else #define SKINS_CC "skins.cc" +#ifdef HILDON +#define SKIN2CC_CONF "skin2cc-hildon.conf" +#else #define SKIN2CC_CONF "skin2cc.conf" +#endif #define SKIN2CC "skin2cc" #endif diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/debian/README free42-1.4.27-hildon/debian/README --- free42-1.4.27-orig/debian/README 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/debian/README 2006-09-12 21:20:21.000000000 +0300 @@ -0,0 +1,3 @@ +This is not a standard Debian build stuff, but stuff to make this +compile on the Maemo platform, see http://www.maemo.org for more. + diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/debian/changelog free42-1.4.27-hildon/debian/changelog --- free42-1.4.27-orig/debian/changelog 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/debian/changelog 2006-09-19 21:57:37.000000000 +0300 @@ -0,0 +1,6 @@ +free42 (1.4.27-hildon1) unstable; urgency=low + + * Hildonized, steps one and two... + + -- Tatu Mannisto Tue, 12 Sep 2006 18:46:47 +0200 + diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/debian/control free42-1.4.27-hildon/debian/control --- free42-1.4.27-orig/debian/control 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/debian/control 2006-09-19 21:57:33.000000000 +0300 @@ -0,0 +1,15 @@ +Source: free42 +Section: maemo/Applications +Priority: optional +Maintainer: Tatu Mannisto +Build-Depends: debhelper (>= 4.0.0), intltool, hildon-base-lib-dev, + hildon-libs-dev, libgtk2.0-dev, libglib2.0-dev, libdbus-glib-1-dev, libosso-dev +Standards-Version: 3.6.0 + +Package: free42 +Architecture: armel +Description: HP-42 calculator (based on the Free42 project), for the project + itself, please look at http://home.planet.nl/~demun000/thomas_projects/free42. + This package just wraps it up for Maemo platform (e.g. Nokia 770) with + realistic looking pseudo skins. + diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/debian/copyright free42-1.4.27-hildon/debian/copyright --- free42-1.4.27-orig/debian/copyright 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/debian/copyright 2006-09-19 21:58:52.000000000 +0300 @@ -0,0 +1,7 @@ +Copyright: GNU GPLv2 + +This package is licensed under the GNU GPL license +For further information please refer to the COPYING file + + + diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/debian/files free42-1.4.27-hildon/debian/files --- free42-1.4.27-orig/debian/files 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/debian/files 2006-09-19 21:59:29.000000000 +0300 @@ -0,0 +1 @@ +free42_1.4.27-hildon1_armel.deb maemo/Applications optional diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/debian/free42.desktop free42-1.4.27-hildon/debian/free42.desktop --- free42-1.4.27-orig/debian/free42.desktop 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/debian/free42.desktop 2006-09-12 21:40:30.000000000 +0300 @@ -0,0 +1,7 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.4.27 +Type=Application +Name=HP-42 +Exec=/usr/bin/free42 +MimeType=application/x-hp42; diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/debian/free42.install free42-1.4.27-hildon/debian/free42.install --- free42-1.4.27-orig/debian/free42.install 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/debian/free42.install 2006-09-12 21:49:45.000000000 +0300 @@ -0,0 +1,5 @@ +gtk/free42.launch usr/bin +debian/free42.desktop /usr/share/applications/hildon +CREDITS usr/share/free42 +README usr/share/free42 +COPYING usr/share/free42 diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/debian/free42.links free42-1.4.27-hildon/debian/free42.links --- free42-1.4.27-orig/debian/free42.links 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/debian/free42.links 2006-09-12 21:49:07.000000000 +0300 @@ -0,0 +1,2 @@ +/usr/share/applications/hildon/free42.desktop etc/others-menu/0042_free42.desktop +/usr/bin/maemo-invoker usr/bin/free42 diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/debian/free42.postrm free42-1.4.27-hildon/debian/free42.postrm --- free42-1.4.27-orig/debian/free42.postrm 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/debian/free42.postrm 2006-09-12 21:33:18.000000000 +0300 @@ -0,0 +1,4 @@ +#!/bin/sh + +/bin/rm -fr $HOME/.free42 +/bin/rm -fr /usr/bin/free42 diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/debian/rules free42-1.4.27-hildon/debian/rules --- free42-1.4.27-orig/debian/rules 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/debian/rules 2006-09-12 21:47:13.000000000 +0300 @@ -0,0 +1,82 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + + +CFLAGS = -Wall -g +PACKAGENAME = free42 + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +config.status: configure + dh_testdir + +configure: +# ./autogen.sh + touch config.status + +build: build-stamp + +build-stamp: config.status + dh_testdir + + ( cd gtk ; $(MAKE) -e HILDON=1 skins.cc ) + ( cd gtk ; $(MAKE) -e HILDON=1 ) + strip gtk/free42.launch + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + dh_clean + + ( cd gtk ; $(MAKE) cleaner ) + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + dh_install + + +# Build architecture-independent files here. +binary-indep: build install + + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/debian/substvars free42-1.4.27-hildon/debian/substvars --- free42-1.4.27-orig/debian/substvars 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/debian/substvars 2006-09-19 21:59:29.000000000 +0300 @@ -0,0 +1 @@ +shlibs:Depends=libc6 (>= 2.3.5-1), libgcc1 (>= 1:3.4.4), libstdc++6 (>= 3.4.4) Binary files free42-1.4.27-orig/extra-skins.tgz and free42-1.4.27-hildon/extra-skins.tgz differ diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/gtk/Makefile free42-1.4.27-hildon/gtk/Makefile --- free42-1.4.27-orig/gtk/Makefile 2006-08-14 14:55:16.000000000 +0300 +++ free42-1.4.27-hildon/gtk/Makefile 2006-09-19 21:40:34.000000000 +0300 @@ -17,8 +17,17 @@ ############################################################################### CXXFLAGS := -MMD -Wall -g -fno-exceptions -fno-rtti $(shell pkg-config --cflags gtk+-2.0) -DVERSION="\"$(shell cat ../VERSION)\"" + +ifdef HILDON +BCD_MATH = 1 +CXXFLAGS += -DHILDON -fpic $(shell pkg-config --cflags hildon-libs) $(shell pkg-config --cflags hildon-fm) +CXXFLAGS_skin2cc = -DHILDON +LDFLAGS = -shared +LIBS = +else LDFLAGS = -LIBS := $(shell pkg-config --libs gtk+-2.0) +LIBS = $(shell pkg-config --libs gtk+-2.0) +endif SRCS = shell_main.cc shell_skin.cc skins.cc keymap.cc shell_loadimage.cc \ shell_spool.cc core_main.cc core_commands1.cc core_commands2.cc \ @@ -44,6 +53,10 @@ EXE = free42bin endif +ifdef HILDON +EXE = free42.launch +endif + $(EXE): $(OBJS) $(CXX) -o $(EXE) $(LDFLAGS) $(OBJS) $(LIBS) @@ -53,9 +66,9 @@ $(CXX) $(CXXFLAGS) -c -o $@ $< skin2cc: skin2cc.cc - $(CXX) -o skin2cc skin2cc.cc + $(CXX) $(CXXFLAGS_skin2cc) -o skin2cc skin2cc.cc -skins.cc: skin2cc skin2cc.conf +skins.cc: symlinks skin2cc skin2cc.conf ./skin2cc keymap2cc: keymap2cc.cc @@ -129,6 +142,7 @@ cleaner: FORCE rm -f `find . -type l` \ free42bin free42bin.exe free42dec free42dec.exe \ + free42 free42.launch \ skin2cc skin2cc.exe skins.cc \ keymap2cc keymap2cc.exe keymap.cc \ *.o *.d *.i *.ii *.s symlinks core.* diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/gtk/shell_main.cc free42-1.4.27-hildon/gtk/shell_main.cc --- free42-1.4.27-orig/gtk/shell_main.cc 2006-08-21 14:38:16.000000000 +0300 +++ free42-1.4.27-hildon/gtk/shell_main.cc 2006-09-12 21:12:57.000000000 +0300 @@ -27,6 +27,10 @@ #include #include #include +#ifdef HILDON +#include +#include +#endif #include "shell.h" #include "shell_main.h" @@ -76,6 +80,9 @@ static int pype[2]; +#ifdef HILDON +static HildonProgram *hildon_program; +#endif static GtkWidget *mainwindow; static GtkWidget *printwindow; static GtkWidget *print_widget; @@ -175,18 +182,28 @@ { "/File/sep2", NULL, NULL, 0, "" }, { "/File/Clear Print-Out", NULL, clearPrintOutCB, 0, "" }, { "/File/Preferences...", NULL, preferencesCB, 0, "" }, +#ifndef HILDON { "/File/sep3", NULL, NULL, 0, "" }, { "/File/Quit", "Q", quitCB, 0, "" }, +#endif { "/Edit", NULL, NULL, 0, "" }, { "/Edit/Copy", "C", copyCB, 0, "" }, { "/Edit/Paste", "V", pasteCB, 0, "" }, { "/Skin", NULL, NULL, 0, "" }, { "/Help", NULL, NULL, 0, "" }, { "/Help/About Free42...", NULL, aboutCB, 0, "" } +#ifdef HILDON + ,{ "/sep3", NULL, NULL, 0, "" }, + { "/Quit", "Q", quitCB, 0, "" }, +#endif }; static gint num_entries = sizeof(entries) / sizeof(entries[0]); +#ifdef HILDON +static int is_fullscreen; +#endif + int main(int argc, char *argv[]) { gtk_init(&argc, &argv); char *skin_arg = NULL; @@ -275,7 +292,19 @@ icon = gdk_pixbuf_new_from_xpm_data((const char **) icon_xpm); +#ifdef HILDON + hildon_program = HILDON_PROGRAM(hildon_program_get_instance()); + g_set_application_name("Free42"); + mainwindow = hildon_window_new(); + hildon_program_add_window(hildon_program, HILDON_WINDOW(mainwindow)); + is_fullscreen = FALSE; + if (is_fullscreen_skin()) { + gtk_window_fullscreen(GTK_WINDOW(mainwindow)); + is_fullscreen = TRUE; + } +#else mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); +#endif gtk_window_set_icon(GTK_WINDOW(mainwindow), icon); gtk_window_set_title(GTK_WINDOW(mainwindow), TITLE); gtk_window_set_resizable(GTK_WINDOW(mainwindow), FALSE); @@ -287,8 +316,13 @@ state.mainWindowY); GtkAccelGroup *acc_grp = gtk_accel_group_new(); +#ifdef HILDON + GtkItemFactory *fac = gtk_item_factory_new(GTK_TYPE_MENU, + "
", acc_grp); +#else GtkItemFactory *fac = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "
", acc_grp); +#endif gtk_item_factory_create_items(fac, num_entries, entries, NULL); gtk_window_add_accel_group(GTK_WINDOW(mainwindow), acc_grp); GtkWidget *menubar = gtk_item_factory_get_widget(fac, "
"); @@ -306,7 +340,11 @@ GtkWidget *box = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(mainwindow), box); +#ifdef HILDON + hildon_window_set_menu(HILDON_WINDOW(mainwindow), GTK_MENU(menubar)); +#else gtk_box_pack_start(GTK_BOX(box), menubar, FALSE, FALSE, 0); +#endif /****************************************/ @@ -396,7 +434,7 @@ gint width, height; gtk_window_get_size(GTK_WINDOW(printwindow), &width, &height); gtk_window_resize(GTK_WINDOW(printwindow), width, - state.printWindowKnown ? state.printWindowHeight : 600); + state.printWindowKnown ? state.printWindowHeight : 419); gtk_widget_realize(printwindow); gtk_widget_realize(print_widget); @@ -950,6 +988,11 @@ const char *pattern, bool save, GtkWidget *owner) { +#ifdef HILDON + GtkWidget *dialog = hildon_file_chooser_dialog_new( + GTK_WINDOW(owner), + save ? GTK_FILE_CHOOSER_ACTION_SAVE : GTK_FILE_CHOOSER_ACTION_OPEN); +#else GtkWidget *dialog = gtk_file_chooser_dialog_new( title, GTK_WINDOW(owner), @@ -959,6 +1002,8 @@ save ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); +#endif + const char *p = pattern; while (1) { const char *descr, *ext; @@ -989,7 +1034,11 @@ "Program Files (*.raw)\0*.[Rr][Aa][Ww]\0All Files (*.*)\0*\0", false, mainwindow); +#ifdef HILDON + bool cancelled = gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_OK; +#else bool cancelled = gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_ACCEPT; +#endif gtk_widget_hide(dialog); if (cancelled) return; @@ -1005,10 +1054,13 @@ filenamebuf[FILENAMELEN - 1] = 0; g_free(filename); +#ifdef HILDON +#else if (strncmp(gtk_file_filter_get_name( gtk_file_chooser_get_filter( GTK_FILE_CHOOSER(dialog))), "All", 3) != 0) appendSuffix(filenamebuf, ".raw"); +#endif import_file = fopen(filenamebuf, "r"); if (import_file == NULL) { @@ -1384,6 +1436,22 @@ if (event->hardware_keycode == active_keycode) // Auto-repeat return TRUE; +#ifdef HILDON + if (event->keyval == GDK_F6) { + if (is_fullscreen) { + if (set_fullscreen_skin(0)) { + gtk_window_unfullscreen(GTK_WINDOW(mainwindow)); + is_fullscreen = 0; + } + } else { + if (set_fullscreen_skin(1)) { + gtk_window_fullscreen(GTK_WINDOW(mainwindow)); + is_fullscreen = 1; + } + } + return TRUE; + } +#endif if (ckey == 0 || !mouse_key) { int i; @@ -2024,3 +2092,14 @@ void shell_release_bcd_table(shell_bcd_table_struct *bcdtab) { free(bcdtab); } + +#ifdef HILDON +void switch_to_fullscreen(int fs) { + if (fs) { + gtk_window_fullscreen(GTK_WINDOW(mainwindow)); + } else { + gtk_window_unfullscreen(GTK_WINDOW(mainwindow)); + } + is_fullscreen = fs != 0; +} +#endif diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/gtk/shell_main.h free42-1.4.27-hildon/gtk/shell_main.h --- free42-1.4.27-orig/gtk/shell_main.h 2006-04-29 15:48:52.000000000 +0300 +++ free42-1.4.27-hildon/gtk/shell_main.h 2006-09-12 20:48:12.000000000 +0300 @@ -58,4 +58,8 @@ keymap_entry *parse_keymap_entry(char *line, int lineno); +#ifdef HILDON +void switch_to_fullscreen(int fs); +#endif + #endif diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/gtk/shell_skin.cc free42-1.4.27-hildon/gtk/shell_skin.cc --- free42-1.4.27-orig/gtk/shell_skin.cc 2006-06-08 18:31:58.000000000 +0300 +++ free42-1.4.27-hildon/gtk/shell_skin.cc 2006-09-12 22:22:39.000000000 +0300 @@ -23,13 +23,15 @@ #include #include #include +#ifdef HILDON +#include +#endif #include "shell_skin.h" #include "shell_main.h" #include "shell_loadimage.h" #include "core_main.h" - /**************************/ /* Skin description stuff */ /**************************/ @@ -140,6 +142,67 @@ gtk_widget_show(w); } +#ifdef HILDON +static void switch_to_skin(const char *name) { + if (strcmp(state.skinName, name) != 0) { + int w, h; + strcpy(state.skinName, name); + skin_load(&w, &h); + switch_to_fullscreen(is_fullscreen_skin()); + core_repaint_display(); + gtk_widget_set_size_request(calc_widget, w, h); + } +} + +int is_fullscreen_skin() { + /* ugly hack for embedded skin */ + if (strcmp(state.skinName, "Full Screen") == 0) + return 1; + + /* state.skinName =~ /-full$/ */ + const char *full = strstr(state.skinName, "-full"); + return full && strlen(full) == 5; +} + +int set_fullscreen_skin(int fullscreen) { + char namebuf[1024]; + char basename[1024]; + const char *full; + + /* ugly hacks for embedded skins */ + if (fullscreen && strcmp(state.skinName, "Standard") == 0) { + switch_to_skin("Full Screen"); + return 1; + } + if (!fullscreen && strcmp(state.skinName, "Full Screen") == 0) { + switch_to_skin("Standard"); + return 1; + } + + /* state.skinName =~ s/-full$// */ + strncpy(basename, state.skinName, sizeof(namebuf)); + full = strstr(basename, "-full"); + if (full && strlen(full) == 5) { + basename[strlen(basename)-5] = 0; + } + + full = fullscreen ? "-full" : ""; + snprintf(namebuf, sizeof(namebuf), "%s/.free42/%s%s.gif", getenv("HOME"), basename, full); + if (access(namebuf, R_OK)) return 0; + snprintf(namebuf, sizeof(namebuf), "%s/.free42/%s%s.layout", getenv("HOME"), basename, full); + if (access(namebuf, R_OK)) return 0; + + snprintf(namebuf, sizeof(namebuf), "%s%s", basename, full); + switch_to_skin(namebuf); + + return 1; +} + +static void selectSkinCB(GtkWidget *w, gpointer cd) { + switch_to_skin((char *)cd); +} + +#else static void selectSkinCB(GtkWidget *w, gpointer cd) { char *name = (char *) cd; if (strcmp(state.skinName, name) != 0) { @@ -150,6 +213,7 @@ gtk_widget_set_size_request(calc_widget, w, h); } } +#endif static int skin_open(const char *name, int open_layout) { int i; diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/gtk/shell_skin.h free42-1.4.27-hildon/gtk/shell_skin.h --- free42-1.4.27-orig/gtk/shell_skin.h 2006-05-01 19:54:37.000000000 +0300 +++ free42-1.4.27-hildon/gtk/shell_skin.h 2006-09-02 14:03:49.000000000 +0300 @@ -54,4 +54,9 @@ void skin_repaint_display(); void skin_display_set_enabled(bool enable); +#ifdef HILDON +int set_fullscreen_skin(int fullscreen); +int is_fullscreen_skin(); +#endif + #endif diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/gtk/skin2cc-hildon.conf free42-1.4.27-hildon/gtk/skin2cc-hildon.conf --- free42-1.4.27-orig/gtk/skin2cc-hildon.conf 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/gtk/skin2cc-hildon.conf 2006-09-12 21:46:28.000000000 +0300 @@ -0,0 +1,4 @@ +skins/42ct +Standard +skins/42ct-full +Full Screen diff -Nruw -x '42ct-full.*' free42-1.4.27-orig/shell_main.cc.patch free42-1.4.27-hildon/shell_main.cc.patch --- free42-1.4.27-orig/shell_main.cc.patch 1970-01-01 02:00:00.000000000 +0200 +++ free42-1.4.27-hildon/shell_main.cc.patch 2006-05-22 21:45:36.000000000 +0300 @@ -0,0 +1,19 @@ +*** shell_main.cc.ORIG 2006-04-27 14:33:15.000000000 -0600 +--- shell_main.cc 2006-04-27 14:33:38.000000000 -0600 +*************** +*** 386,392 **** + gint width, height; + gtk_window_get_size(GTK_WINDOW(printwindow), &width, &height); + gtk_window_resize(GTK_WINDOW(printwindow), width, +! state.printWindowKnown ? state.printWindowHeight : 600); + + gtk_widget_realize(printwindow); + scroll_printout_to_bottom(); +--- 386,392 ---- + gint width, height; + gtk_window_get_size(GTK_WINDOW(printwindow), &width, &height); + gtk_window_resize(GTK_WINDOW(printwindow), width, +! state.printWindowKnown ? state.printWindowHeight : 419); + + gtk_widget_realize(printwindow); + scroll_printout_to_bottom();