r2606 - in trunk/src/target/OM-2007.2/applications/openmoko-dialer2: . src

thomas at sita.openmoko.org thomas at sita.openmoko.org
Thu Aug 2 13:34:19 CEST 2007


Author: thomas
Date: 2007-08-02 13:34:17 +0200 (Thu, 02 Aug 2007)
New Revision: 2606

Removed:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-declares.h
Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.h
Log:
* src/Makefile.am: Stop being pedantic
* src/moko-dialer-declares.h: Removed
* src/moko-dialer-textview.c: (moko_dialer_textview_class_init),
(moko_dialer_textview_init), (moko_dialer_textview_set_color),
(moko_dialer_textview_insert):
* src/moko-dialer-textview.h:

- Add style properties for small, medium and large font sizes
- Remove hardcoding of font sizes and colours


Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2007-08-02 10:38:22 UTC (rev 2605)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2007-08-02 11:34:17 UTC (rev 2606)
@@ -1,3 +1,16 @@
+2007-08-02  Thomas Wood  <thomas at openedhand.com>
+
+	* src/Makefile.am: Stop being pedantic
+	* src/moko-dialer-declares.h: Removed
+	* src/moko-dialer-textview.c: (moko_dialer_textview_class_init),
+	(moko_dialer_textview_init), (moko_dialer_textview_set_color),
+	(moko_dialer_textview_insert):
+	* src/moko-dialer-textview.h:
+
+	- Add style properties for small, medium and large font sizes
+	- Remove hardcoding of font sizes and colours
+
+
 2007-08-02  Neil J. Patel  <njp at o-hand.com>
 
 	* src/moko-dialer.c: (on_incoming_call):

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am	2007-08-02 10:38:22 UTC (rev 2605)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am	2007-08-02 11:34:17 UTC (rev 2606)
@@ -1,6 +1,6 @@
 AM_CPPFLAGS = -DDATADIR=\"$(datadir)\" \
               -DPKGDATADIR=\"$(pkgdatadir)\"
-AM_CFLAGS = -Wall -pedantic @CFLAGS@
+AM_CFLAGS = -Wall @CFLAGS@
 
 bin_PROGRAMS = openmoko-dialer
 

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-declares.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-declares.h	2007-08-02 10:38:22 UTC (rev 2605)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-declares.h	2007-08-02 11:34:17 UTC (rev 2606)
@@ -1,32 +0,0 @@
-/*  moko-dialer-declares.h
- *
- *  Authored by Tony Guan<tonyguan at fic-sh.com.cn>
- *
- *  Copyright (C) 2006 FIC Shanghai Lab
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Public License as published by
- *  the Free Software Foundation; version 2.1 of the license.
- *
- *  This program 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date) [$Author: Tony Guan $]
- */
-#ifndef _MOKO_DIALER_DECLARES_H_
-#define _MOKO_DIALER_DECLARES_H_
-#define MOKO_DIALER_MAX_TIME_STATUS_LEN (128)   ///<TO HOLD THE STRINGS LIKE "CALL...(00:00:30)
-#define MOKO_DIALER_MAX_NUMBER_LEN	(64)    ///<TO HOLD THE PHONE NUMBERS
-#define MOKO_DIALER_MAX_PIN_LEN	(64)    ///<TO HOLD THE PHONE NUMBERS
-#define MOKO_DIALER_MAX_DISP_NAME_LEN (20)      ///<THE MAXIMUM LENGTH OF THE DISPLAYED CONTACT NAME
-#define MOKO_DIALER_MAX_PATH_LEN (128)  ///<THE MAX PATH LEN
-//MAXDISPNAMENUM MUST >=1 & <=9!
-
-#define MOKO_DIALER_MIN_SENSATIVE_LEN (1)       ///<only when user inputs at least MINSENSATIVELEN, should we start to search.
-#define MOKO_DIALER_MAX_STATUS_ICONS (6)        ///<THE NUMBERS OF THE ICONS WHEN OUTGOING CALL IS ON
-#define MOKO_DIALER_DEFAULT_PERSON_IMAGE_PATH ("unkown.png")    ///<THE DEFAULT PERSON IMAGE
-#define MOKO_DIALER_MAX_TIPS (3)
-
-#endif

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.c	2007-08-02 10:38:22 UTC (rev 2605)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.c	2007-08-02 11:34:17 UTC (rev 2606)
@@ -1,6 +1,8 @@
 /*  moko-dialer-textview.c
  *
- *  Authored by Tony Guan<tonyguan at fic-sh.com.cn>
+ *  Authored by:
+ *    Tony Guan<tonyguan at fic-sh.com.cn>
+ *    OpenedHand Ltd. <info at openedhand.com>
  *
  *  Copyright (C) 2006 FIC Shanghai Lab
  *
@@ -18,7 +20,6 @@
  */
 
 #include "moko-dialer-textview.h"
-#include "moko-dialer-declares.h"
 #include "error.h"
 G_DEFINE_TYPE (MokoDialerTextview, moko_dialer_textview, GTK_TYPE_TEXT_VIEW)
      enum
@@ -28,21 +29,45 @@
        LAST_SIGNAL
      };
 
-//forward definition
-//static void  moko_dialer_textview_pressed  (MokoDigitButton * button, GdkEventButton  *event,gpointer data);
-//static void moko_dialer_textview_pressed (MokoDigitButton * button, gpointer data);
+static void
+moko_dialer_textview_class_init (MokoDialerTextviewClass * class)
+{
 
-//static gint moko_dialer_textview_signals[LAST_SIGNAL] = { 0 };
+  GtkWidgetClass *widget_class;
 
-     static void
-       moko_dialer_textview_class_init (MokoDialerTextviewClass * class)
-{
+  widget_class = GTK_WIDGET_CLASS (class);
 
-  GtkObjectClass *object_class;
 
-  object_class = (GtkObjectClass *) class;
+  gtk_widget_class_install_style_property (widget_class,
+      g_param_spec_int (
+        "small_font",
+        "Small Font",
+        "Smallest font size for the display",
+        0,
+        128,
+        10,
+        G_PARAM_READABLE | G_PARAM_WRITABLE));
+  gtk_widget_class_install_style_property (widget_class,
+      g_param_spec_int (
+        "medium_font",
+        "Medium Font",
+        "Medium font size for the display",
+        0,
+        128,
+        15,
+        G_PARAM_READABLE | G_PARAM_WRITABLE));
+  gtk_widget_class_install_style_property (widget_class,
+      g_param_spec_int (
+        "large_font",
+        "Large Font",
+        "Largest font size for the display",
+        0,
+        128,
+        20,
+        G_PARAM_READABLE | G_PARAM_WRITABLE));
 
 
+
 }
 
 
@@ -52,7 +77,7 @@
 
   GtkTextView *textview = 0;
   GtkTextBuffer *buffer;
-  GdkColor color;
+  gint large;
 
   textview = &moko_dialer_textview->textview;
   buffer = gtk_text_view_get_buffer (textview);
@@ -61,14 +86,6 @@
   moko_dialer_textview->tag_for_cursor = NULL;
   moko_dialer_textview->tag_for_autofilled = NULL;
 
-  /* TODO: use theme colours */
-  gdk_color_parse ("black", &color);
-  gtk_widget_modify_base (GTK_WIDGET (textview), GTK_STATE_NORMAL, &color);
-
-
-
-
-  gtk_widget_set_size_request (GTK_WIDGET (textview), 480, 92);
   GTK_WIDGET_UNSET_FLAGS (textview, GTK_CAN_FOCUS);
   gtk_text_view_set_editable (GTK_TEXT_VIEW (textview), FALSE);
   gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (textview), FALSE);
@@ -82,26 +99,21 @@
   PangoFontDescription *font_desc_textview = NULL;
   font_desc_textview = pango_font_description_new ();
 
-  // set the default font for the textview.
-  pango_font_description_set_size (font_desc_textview, 32 * PANGO_SCALE);
+  /* get font sizes */
+  gtk_widget_style_get (GTK_WIDGET (moko_dialer_textview), "large_font", &large, NULL);
 
+  /* set the default font for the textview. */
+  pango_font_description_set_size (font_desc_textview, large * PANGO_SCALE);
+  gtk_widget_modify_font (GTK_WIDGET (moko_dialer_textview), font_desc_textview);
+
   if (font_desc_textview)
   {
-    gtk_widget_modify_font (GTK_WIDGET (moko_dialer_textview),
-                            font_desc_textview);
-    // save it to the structure for later usage.
+    /* save it to the structure for later usage. */
     moko_dialer_textview->font_desc_textview = font_desc_textview;
   }
-  // create the formatting tag;
-  moko_dialer_textview->tag_for_inputed =
-    gtk_text_buffer_create_tag (buffer, "tag_input", "foreground", "#FF8000",
-                                NULL);
   moko_dialer_textview->tag_for_cursor =
     gtk_text_buffer_create_tag (buffer, "tag_cursor", "weight",
                                 "PANGO_WEIGHT_BOLD", NULL);
-  moko_dialer_textview->tag_for_autofilled =
-    gtk_text_buffer_create_tag (buffer, "tag_filled", "foreground", "#FFFF00",
-                                NULL);
   moko_dialer_textview->sensed = FALSE;
 
 }
@@ -136,8 +148,8 @@
   gint len;
   GtkTextIter start, cursoriter_1, cursoriter;
   GtkTextIter end;
+  gint small = 10, medium = 10, large = 10;
 
-//text_view= lookup_widget (GTK_WIDGET(button), "textview");
   /* Obtaining the buffer associated with the widget. */
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (moko_dialer_textview));
 
@@ -155,42 +167,48 @@
     gtk_text_buffer_remove_all_tags (buffer, &start, &end);
 
     gtk_text_buffer_get_iter_at_offset (buffer, &cursoriter_1, cur - 1);
-    gtk_text_buffer_apply_tag (buffer,
-                               moko_dialer_textview->tag_for_inputed,
-                               &start, &cursoriter);
-    gtk_text_buffer_apply_tag (buffer,
-                               moko_dialer_textview->tag_for_autofilled,
-                               &cursoriter, &end);
+//    gtk_text_buffer_apply_tag (buffer,
+//                               moko_dialer_textview->tag_for_inputed,
+//                               &start, &cursoriter);
+//    gtk_text_buffer_apply_tag (buffer,
+//                               moko_dialer_textview->tag_for_autofilled,
+//                               &cursoriter, &end);
     gtk_text_buffer_apply_tag (buffer, moko_dialer_textview->tag_for_cursor,
                                &cursoriter_1, &cursoriter);
 
   }
   else
   {                             // cur==0
-    gtk_text_buffer_apply_tag (buffer,
-                               moko_dialer_textview->tag_for_autofilled,
-                               &cursoriter, &end);
+//    gtk_text_buffer_apply_tag (buffer,
+//                               moko_dialer_textview->tag_for_autofilled,
+//                               &cursoriter, &end);
   }
 
+  /* get font sizes */
+  gtk_widget_style_get (GTK_WIDGET (moko_dialer_textview), "small_font", &small, NULL);
+  gtk_widget_style_get (GTK_WIDGET (moko_dialer_textview), "medium_font", &medium, NULL);
+  gtk_widget_style_get (GTK_WIDGET (moko_dialer_textview), "large_font", &large, NULL);
 
+
+
   len = gtk_text_buffer_get_char_count (buffer);
   if (len >= 12 && len <= 64)
   {
     if (moko_dialer_textview->font_desc_textview)
       pango_font_description_set_size (moko_dialer_textview->
-                                       font_desc_textview, 32 * PANGO_SCALE);
+                                       font_desc_textview, small * PANGO_SCALE);
   }
   else if (len >= 9 && len < 12)
   {
     if (moko_dialer_textview->font_desc_textview)
       pango_font_description_set_size (moko_dialer_textview->
-                                       font_desc_textview, 48 * PANGO_SCALE);
+                                       font_desc_textview, medium * PANGO_SCALE);
   }
   else if (len >= 0 && len < 9)
   {
     if (moko_dialer_textview->font_desc_textview)
       pango_font_description_set_size (moko_dialer_textview->
-                                       font_desc_textview, 64 * PANGO_SCALE);
+                                       font_desc_textview, large * PANGO_SCALE);
   }
 
   gtk_widget_modify_font (GTK_WIDGET (moko_dialer_textview),
@@ -227,21 +245,21 @@
   GtkTextIter selectioniter, insertiter;
   GtkTextMark *selectmark, *insertmark;
 
-//DBG_MESSAGE("number=%s",number);
-
   /* Obtaining the buffer associated with the widget. */
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (moko_dialer_textview));
 
   selectmark = gtk_text_buffer_get_selection_bound (buffer);
   insertmark = gtk_text_buffer_get_insert (buffer);
-//get current cursor iterator
+
+  /* get current cursor iterator */
   gtk_text_buffer_get_iter_at_mark (buffer, &insertiter, insertmark);
   gtk_text_buffer_get_iter_at_mark (buffer, &selectioniter, selectmark);
-  // to see whether there is a selection range.
+
+  /* to see whether there is a selection range. */
   if (gtk_text_iter_get_offset (&insertiter) !=
       gtk_text_iter_get_offset (&selectioniter))
   {
-    // yes, first delete the range.
+    /* first delete the range */
     gtk_text_buffer_delete (buffer, &selectioniter, &insertiter);
     insertmark = gtk_text_buffer_get_insert (buffer);
     gtk_text_buffer_get_iter_at_mark (buffer, &insertiter, insertmark);
@@ -252,36 +270,17 @@
 
 
   len = gtk_text_buffer_get_char_count (buffer);
-  if (len >= 0 && len < MOKO_DIALER_MAX_NUMBER_LEN)
-  {
+  gtk_text_buffer_insert_at_cursor (buffer, number,
+                                    g_utf8_strlen (number, -1));
+  len = len + g_utf8_strlen (number, -1);
 
-    gtk_text_buffer_insert_at_cursor (buffer, number,
-                                      g_utf8_strlen (number, -1));
-    len = len + g_utf8_strlen (number, -1);
-  }
-  else
-  {
-    // DBG_WARN("INPUT EXCEEDS %d,reset to null!",MAXDIALNUMBERLEN);
-
-    /* FIXME: shouldn't this just leave the existing number? */
-    gtk_text_buffer_set_text (buffer, number, -1);
-    len = 1;
-  }
-  // reget the cursor iter.
+  /* reget the cursor iter. */
   insertmark = gtk_text_buffer_get_insert (buffer);
-//get current cursor iterator
+  /* get current cursor iterator */
   gtk_text_buffer_get_iter_at_mark (buffer, &insertiter, insertmark);
-  // get the inputed string lengh.
+  /* get the inputed string lengh. */
   len = gtk_text_iter_get_offset (&insertiter);
-//      DBG_MESSAGE("the current cursor offset is %d",len);
 
-/*
-	if(len>=MINSENSATIVELEN)
-	{//here we start to search the contacts.
-		rebuild_contact_view(text_view,1);		
-	}
-*/
-
   moko_dialer_textview_set_color (moko_dialer_textview);
   return len;
 }

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.h	2007-08-02 10:38:22 UTC (rev 2605)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.h	2007-08-02 11:34:17 UTC (rev 2606)
@@ -42,11 +42,11 @@
 
 struct _MokoDialerTextview
 {
-  GtkTextView textview;         //<the main widget
-  PangoFontDescription *font_desc_textview;     //< the font description of this textview
-  GtkTextTag *tag_for_inputed;  //<the formating tag for the digits user already inputed
-  GtkTextTag *tag_for_cursor;   //<the formatting tag  for the right digit user just inputed.
-  GtkTextTag *tag_for_autofilled;       //<the formatting tag for the autofilled digits if any.
+  GtkTextView textview;         /* the main widget */
+  PangoFontDescription *font_desc_textview;     /* the font description of this textview */
+  GtkTextTag *tag_for_inputed;  /* the formating tag for the digits user already inputed */
+  GtkTextTag *tag_for_cursor;   /* the formatting tag  for the right digit user just inputed. */
+  GtkTextTag *tag_for_autofilled; /* the formatting tag for the autofilled digits if any. */
   gboolean sensed;
 };
 
@@ -77,4 +77,4 @@
                                       const gchar * string);
 
 G_END_DECLS
-#endif //
+#endif





More information about the commitlog mailing list