/*
****************************************************************************** *
*
- * Copyright (C) 1999-2003, International Business Machines
+ * Copyright (C) 1999-2007, International Business Machines
* Corporation and others. All Rights Reserved.
*
****************************************************************************** *
*/
#include <gnome.h>
-#include "freetype/freetype.h"
+#include <ft2build.h>
+#include FT_FREETYPE_H
#include "unicode/ustring.h"
#include "unicode/uscript.h"
Paragraph *paragraph;
};
-static TT_Engine engine;
+static FT_Library engine;
static GnomeGUISupport *guiSupport;
static GnomeFontMap *fontMap;
static ScriptCompositeFontInstance *font;
GtkWidget *newSample(const gchar *fileName);
void closeSample(GtkWidget *sample);
-void showabout(GtkWidget *widget, gpointer data)
+void showabout(GtkWidget */*widget*/, gpointer /*data*/)
{
GtkWidget *aboutBox;
+ const gchar *documentedBy[] = {NULL};
const gchar *writtenBy[] = {
"Eric Mader",
NULL
aboutBox = gnome_about_new("Gnome Layout Sample",
"0.1",
- "Copyright (C) 1998-2002 By International Business Machines Corporation and others. All Rights Reserved.",
- writtenBy,
+ "Copyright (C) 1998-2006 By International Business Machines Corporation and others. All Rights Reserved.",
"A simple demo of the ICU LayoutEngine.",
+ writtenBy,
+ documentedBy,
+ "",
NULL);
gtk_widget_show(aboutBox);
}
-void notimpl(GtkObject *object, gpointer data)
+void notimpl(GtkObject */*object*/, gpointer /*data*/)
{
gnome_ok_dialog("Not implemented...");
}
gchar *prettyTitle(const gchar *path)
{
- gchar *name = g_basename(path);
+ const gchar *name = g_basename(path);
gchar *title = g_strconcat("Gnome Layout Sample - ", name, NULL);
return title;
}
-void openOK(GtkObject *object, gpointer data)
+void openOK(GtkObject */*object*/, gpointer data)
{
GtkFileSelection *fileselection = GTK_FILE_SELECTION(data);
GtkWidget *app = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(fileselection), "app"));
g_free(fileName);
}
-void openfile(GtkObject *object, gpointer data)
+void openfile(GtkObject */*object*/, gpointer data)
{
GtkWidget *app = GTK_WIDGET(data);
GtkWidget *fileselection;
gtk_main();
}
-void newapp(GtkObject *object, gpointer data)
+void newapp(GtkObject */*object*/, gpointer /*data*/)
{
GtkWidget *app = newSample("Sample.txt");
gtk_widget_show_all(app);
}
-void closeapp(GtkWidget *widget, gpointer data)
+void closeapp(GtkWidget */*widget*/, gpointer data)
{
GtkWidget *app = GTK_WIDGET(data);
closeSample(app);
}
-void shutdown(GtkObject *object, gpointer data)
+void shutdown(GtkObject */*object*/, gpointer /*data*/)
{
gtk_main_quit();
}
GnomeUIInfo fileMenu[] =
{
- GNOMEUIINFO_MENU_NEW_ITEM("_New Sample",
- "Create a new Gnome Layout Sample",
+ GNOMEUIINFO_MENU_NEW_ITEM((gchar *) "_New Sample",
+ (gchar *) "Create a new Gnome Layout Sample",
newapp, NULL),
GNOMEUIINFO_MENU_OPEN_ITEM(openfile, NULL),
GnomeUIInfo mainMenu[] =
{
- GNOMEUIINFO_SUBTREE(N_("File"), fileMenu),
- GNOMEUIINFO_SUBTREE(N_("Help"), helpMenu),
+ GNOMEUIINFO_SUBTREE(N_((gchar *) "File"), fileMenu),
+ GNOMEUIINFO_SUBTREE(N_((gchar *) "Help"), helpMenu),
GNOMEUIINFO_END
};
-gint eventDelete(GtkWidget *widget, GdkEvent *event, gpointer data)
+gint eventDelete(GtkWidget *widget, GdkEvent */*event*/, gpointer /*data*/)
{
closeSample(widget);
return TRUE;
}
-gint eventConfigure(GtkWidget *widget, GdkEventConfigure *event, Context *context)
+gint eventConfigure(GtkWidget */*widget*/, GdkEventConfigure *event, Context *context)
{
if (context->paragraph != NULL) {
context->width = event->width;
return TRUE;
}
-gint eventExpose(GtkWidget *widget, GdkEvent *event, Context *context)
+gint eventExpose(GtkWidget *widget, GdkEvent */*event*/, Context *context)
{
if (context->paragraph != NULL) {
gint maxLines = context->paragraph->getLineCount() - 1;
int main (int argc, char *argv[])
{
LEErrorCode fontStatus = LE_NO_ERROR;
- GtkWidget *app;
+ poptContext ptctx;
+ GtkWidget *app;
- TT_Init_FreeType(&engine);
+ FT_Init_FreeType(&engine);
- gnome_init("gnomelayout", "0.1", argc, argv);
+ gnome_init_with_popt_table("gnomelayout", "0.1", argc, argv, NULL, 0, &ptctx);
guiSupport = new GnomeGUISupport();
fontMap = new GnomeFontMap(engine, "FontMap.Gnome", 24, guiSupport, fontStatus);
font = new ScriptCompositeFontInstance(fontMap);
if (LE_FAILURE(fontStatus)) {
- TT_Done_FreeType(engine);
+ FT_Done_FreeType(engine);
return 1;
}
- if (argc <= 1) {
- app = newSample("Sample.txt");
-
- gtk_widget_show_all(app);
- } else {
- for (int i = 1; i < argc; i += 1) {
- app = newSample(argv[i]);
-
- gtk_widget_show_all(app);
- }
+ const char *defaultArgs[] = {"Sample.txt", NULL};
+ const char **args = poptGetArgs(ptctx);
+
+ if (args == NULL) {
+ args = defaultArgs;
}
+ for (int i = 0; args[i] != NULL; i += 1) {
+ app = newSample(args[i]);
+
+ gtk_widget_show_all(app);
+ }
+
+ poptFreeContext(ptctx);
+
gtk_main();
delete font;
delete guiSupport;
- TT_Done_FreeType(engine);
+ FT_Done_FreeType(engine);
exit(0);
}