[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright gtkshell/Makefile gtkshell/main.c fls...
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright gtkshell/Makefile gtkshell/main.c fls... |
Date: |
Wed, 23 Aug 2006 07:15:22 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 06/08/23 07:15:22
Added files:
gtkshell : Makefile main.c
Removed files:
flshell : Makefile args.cc args.hh button.cc button.hh
callbacks.cc callbacks.hh flshell.hh label.cc
label.hh main.cc update.cc update.hh
Log message:
Changed to GTK2.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/Makefile?cvsroot=antiright&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/args.cc?cvsroot=antiright&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/args.hh?cvsroot=antiright&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/button.cc?cvsroot=antiright&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/button.hh?cvsroot=antiright&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/callbacks.cc?cvsroot=antiright&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/callbacks.hh?cvsroot=antiright&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/flshell.hh?cvsroot=antiright&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/label.cc?cvsroot=antiright&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/label.hh?cvsroot=antiright&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/main.cc?cvsroot=antiright&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/update.cc?cvsroot=antiright&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/flshell/update.hh?cvsroot=antiright&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/Makefile?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/main.c?cvsroot=antiright&rev=1.1
Patches:
Index: gtkshell/Makefile
===================================================================
RCS file: gtkshell/Makefile
diff -N gtkshell/Makefile
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gtkshell/Makefile 23 Aug 2006 07:15:22 -0000 1.1
@@ -0,0 +1,14 @@
+.include "../config.mk"
+
+CFLAGS+=`pkg-config --cflags gtk+-2.0`
+LDFLAGS+=-L../libantiright -lantiright
+LDFLAGS+=`pkg-config --libs gtk+-2.0`
+
+objects=main.o
+all: ${objects}
+ cc -o gtkshell ${objects} ${LDFLAGS}
+clean:
+ rm -f gtkshell *.o
+install:
+ install gtkshell ${PREFIX}/bin
+
Index: gtkshell/main.c
===================================================================
RCS file: gtkshell/main.c
diff -N gtkshell/main.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gtkshell/main.c 23 Aug 2006 07:15:22 -0000 1.1
@@ -0,0 +1,169 @@
+#include <gtk/gtk.h>
+#include <errno.h>
+#include "../libantiright/library.h"
+
+GtkWidget *gsh_window;
+GtkWidget *gsh_button;
+unsigned int gsh_rows=8;
+unsigned int gsh_row=1;
+GtkWidget *gsh_hbox;
+GtkWidget *gsh_vbox;
+GtkWidget *gsh_label;
+gboolean gsh_updater_defined=FALSE;
+gboolean gsh_button_exits=FALSE;
+
+static void
+system_cb(GtkWidget *widget, gpointer data)
+{
+ system(data);
+ if(gsh_button_exits==TRUE)
+ {
+ exit(0);
+ }
+}
+gint
+gsh_updater(gpointer data)
+{
+ char *results;
+ results=antiright_pipe_read(data);
+ gtk_label_set_text(GTK_LABEL(gsh_label), results);
+ free(results);
+ return(TRUE);
+}
+
+static void
+entry_cb(GtkWidget *widget, gpointer data)
+{
+ const gchar *entry_text;
+ char *formatted;
+ entry_text=gtk_entry_get_text(GTK_ENTRY(widget));
+ asprintf(&formatted, "%s %s", (char*)data, entry_text);
+ system(formatted);
+ free(formatted);
+}
+
+int
+main(int argc, char **argv)
+{
+ unsigned int counter;
+
+ gtk_init(&argc, &argv);
+
+ gsh_window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+ gsh_hbox=gtk_hbox_new(FALSE, 2);
+ gtk_container_add(GTK_CONTAINER(gsh_window), gsh_hbox);
+ gtk_widget_show(gsh_hbox);
+
+ gsh_vbox=gtk_vbox_new(FALSE, 2);
+ gtk_container_add(GTK_CONTAINER(gsh_hbox), gsh_vbox);
+ gtk_widget_show(gsh_vbox);
+
+ for(counter=1; counter<argc; counter++)
+ {
+ if(gsh_row==gsh_rows)
+ {
+ gsh_vbox=gtk_vbox_new(FALSE, 2);
+ gtk_container_add(GTK_CONTAINER(gsh_hbox), gsh_vbox);
+ gtk_widget_show(gsh_vbox);
+ gsh_row=1;
+ }
+ if(argv[counter][0]=='-')
+ {
+ switch(argv[counter][1])
+ {
+ case 'E':
+ gsh_button_exits=TRUE;
+ break;
+ case 'g':
+ counter++;
+ gtk_window_parse_geometry(
+ GTK_WINDOW(gsh_window),
+ argv[counter]);
+ break;
+ case 'r':
+ counter++;
+ assert(counter<=argc);
+ gsh_rows=atoi(argv[counter]);
+ break;
+ case 'l':
+ {
+ GtkWidget *label;
+ counter++;
+ assert(counter<=argc);
+
label=gtk_label_new(argv[counter]);
+ gtk_container_add(
+ GTK_CONTAINER(gsh_vbox),
+ label);
+ gtk_widget_show(label);
+ gsh_row++;
+ }
+ break;
+ case 't':
+ {
+ GtkWidget *entry;
+ counter++;
+ assert(counter<=argc);
+ gsh_row++;
+ entry=gtk_entry_new();
+ g_signal_connect(
+ G_OBJECT(entry), "activate",
+ G_CALLBACK(entry_cb),
+ (gpointer)argv[counter]);
+ gtk_container_add(
+ GTK_CONTAINER(gsh_vbox),
+ entry);
+ gtk_widget_show(entry);
+
+ }
+ break;
+ case 'u':
+ if(gsh_updater_defined==FALSE)
+ {
+ gsh_label=gtk_label_new("Dynamic
Label");
+ gtk_container_add(
+ GTK_CONTAINER(gsh_vbox),
+ gsh_label);
+ gtk_widget_show(gsh_label);
+
+ gsh_row++;
+ counter++;
+ assert(counter<=argc);
+ gsh_updater(argv[counter]);
+ g_timeout_add(1000,gsh_updater,
+ argv[counter]);
+ gsh_updater_defined=TRUE;
+ }
+ else
+ {
+ errno=1;
+ g_warning("%s: %d: Attempt to define multiple dynamic labels: %s",
+ __FILE__, __LINE__, g_strerror(errno));
+ counter++;
+ assert(counter<=argc);
+ }
+ break;
+ }
+ }
+ else
+ {
+ char *label_text;
+ label_text=antiright_beautified_label(argv[counter]);
+ gsh_button=gtk_button_new_with_label(label_text);
+ free(label_text);
+ g_signal_connect(G_OBJECT(gsh_button), "clicked",
+ G_CALLBACK(system_cb),argv[counter]);
+ gtk_container_add(GTK_CONTAINER(gsh_vbox), gsh_button);
+ gtk_widget_show(gsh_button);
+ gsh_row++;
+ }
+ }
+
+
+ gtk_widget_show(gsh_window);
+
+ gtk_main();
+
+ return(0);
+}
+
Index: flshell/Makefile
===================================================================
RCS file: flshell/Makefile
diff -N flshell/Makefile
--- flshell/Makefile 12 Aug 2006 03:40:51 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
-
-.include "../config.mk"
-
-CXXFLAGS+=`fltk-config --cxxflags`
-LDFLAGS+=-L../libantiright -lantiright
-LDFLAGS+=`fltk-config --ldflags`
-
-objects=main.o args.o callbacks.o label.o update.o button.o
-all: ${objects}
- c++ -o flshell ${objects} ${LDFLAGS}
-
-clean:
- rm -f flshell *.o
-
-install:
- install flshell ${PREFIX}/bin
-
Index: flshell/args.cc
===================================================================
RCS file: flshell/args.cc
diff -N flshell/args.cc
--- flshell/args.cc 12 Aug 2006 03:40:51 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,103 +0,0 @@
-
-/*
- AntiRight
- (c) 2002-2006 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#include "flshell.hh"
-
-namespace flsh
-{
-
- void
- setup_menu(Fl_Menu_Bar *m)
- {
- Fl_Menu_Item menuitems[] = {
- {"&File", 0, 0, 0, FL_SUBMENU},
- {"E&xit", FL_CTRL + 'q', callbacks::exit_cb,0},
- {0},
- {"&View", 0,0,0,FL_SUBMENU},
- {"&ACE Panel", 0, callbacks::ace_cb, 0},
- {0},
- {"&Help", 0,0,0,FL_SUBMENU},
- {"&About", 0, 0,0},
- {0},
- {0}};
- m->copy(menuitems);
-
- }
-
-
- void
- handle_args(const char arg, const char *option)
- {
-
- using namespace std;
-
- switch(arg)
- {
- case 'C':
- {
- Fl_Clock *clock;
- clock=new
Fl_Clock(0,0,globals::widget_width,globals::widget_height*(globals::rows-globals::row_counter));
- globals::row_counter=globals::rows;
- }
- break;
- case 'h':
- cout << "Usage:\n"
- << "flshell -[bhr] [button commands ...]\n";
- exit(0);
- break;
- case 'r':
- row_globals::rows=atoi(option);
- break;
- case 'u':
- updater_argument(option);
- break;
- }
- }
-
-
- void
- command_line_loop(int argc, char **argv)
- {
- unsigned int counter;
-
- for(counter=1; counter<argc; counter++)
- {
- if(argv[counter][0]=='-')
- {
- if(counter+1<argc || argv[counter][1]=='h')
- {
- handle_args(argv[counter][1],
- argv[counter+1]);
- counter++;
- }
- }
- else
- {
- Button *button=new Button(argv[counter]);
- }
- }
- }
-
-
-}
-
Index: flshell/args.hh
===================================================================
RCS file: flshell/args.hh
diff -N flshell/args.hh
--- flshell/args.hh 12 Aug 2006 03:40:51 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,41 +0,0 @@
-
-/*
- AntiRight
- (c) 2002-2006 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#ifndef ARGS_HH
-#define ARGS_HH
-
-namespace flsh
-{
-
- void
- command_line_loop(int argc, char **argv);
-
- void
- handle_args(const char arg, const char *option);
-
- void
- setup_menu(Fl_Menu_Bar *m);
-
-}
-
-#endif
Index: flshell/button.cc
===================================================================
RCS file: flshell/button.cc
diff -N flshell/button.cc
--- flshell/button.cc 12 Aug 2006 03:40:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,53 +0,0 @@
-/*
- AntiRight
- (c) 2002-2006 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#include "flshell.hh"
-
-namespace flsh
-{
- void
- Button::create_button(const char* label)
- {
- formatted_label=antiright_beautified_label((char*)label);
- check_rows();
- widget=new Fl_Button(globals::widget_width
- *globals::used_rows,
- globals::widget_height
- *globals::row_counter,
- globals::widget_width,
- globals::widget_height,
- formatted_label);
- widget->labelfont(FL_HELVETICA_BOLD_ITALIC);
- globals::row_counter++;
- }
- Button::Button()
- {
- create_button("Exit");
- widget->callback(callbacks::exit_cb, (void*)NULL);
- }
-
- Button::Button(const char* command)
- {
- create_button(command);
- widget->callback(callbacks::system_cb, (void*)command);
- }
-}
Index: flshell/button.hh
===================================================================
RCS file: flshell/button.hh
diff -N flshell/button.hh
--- flshell/button.hh 12 Aug 2006 03:40:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,39 +0,0 @@
-/*
- AntiRight
- (c) 2002-2006 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-#ifndef FLSH_BUTTON_HH
-#define FLSH_BUTTON_HH
-#include "flshell.hh"
-namespace flsh
-{
- class Button
- {
- public:
- Button();
- Button(const char* command);
- private:
- void create_button(const char* label);
- char *label;
- Fl_Button *widget;
- char *formatted_label;
- };
-}
-#endif
Index: flshell/callbacks.cc
===================================================================
RCS file: flshell/callbacks.cc
diff -N flshell/callbacks.cc
--- flshell/callbacks.cc 12 Aug 2006 03:40:51 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,53 +0,0 @@
-
-/*
- AntiRight
- (c) 2002-2006 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#include "flshell.hh"
-
-namespace flsh
-{
-
- void
- callbacks::system_cb(Fl_Widget* widget, void *data)
- {
- antiright_system((char*)data);
- }
- void
- callbacks::system_label_cb(void *data)
- {
- puts("TICK");
- Fl::repeat_timeout(1.0, callbacks::system_label_cb,
(void*)data);
- }
-
- void
- callbacks::ace_cb(Fl_Widget* widget, void *data)
- {
- system("ACE &");
- }
-
- void
- callbacks::exit_cb(Fl_Widget* widget, void *data)
- {
- exit(0);
- }
-
-}
Index: flshell/callbacks.hh
===================================================================
RCS file: flshell/callbacks.hh
diff -N flshell/callbacks.hh
--- flshell/callbacks.hh 12 Aug 2006 03:40:51 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,43 +0,0 @@
-/*
- AntiRight
- (c) 2002-2006 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-
-#ifndef CALLBACKS_HH
-#define CALLBACKS_HH
-
-namespace flsh
-{
-
- class callbacks
- {
- public:
- static void system_cb(Fl_Widget* widget, void *data);
- static void system_label_cb(void *data);
- static void exit_cb(Fl_Widget* widget, void *data);
- static void ace_cb(Fl_Widget* widget, void *data);
- };
-
-}
-
-#endif
-
-
Index: flshell/flshell.hh
===================================================================
RCS file: flshell/flshell.hh
diff -N flshell/flshell.hh
--- flshell/flshell.hh 12 Aug 2006 03:40:51 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,85 +0,0 @@
-// flshell.hh
-
-/*
- AntiRight
- (c) 2002-2006 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#ifndef FLSHELL_HH
-#define FLSHELL_HH
-extern "C"
-{
-#include "../libantiright/library.h"
-}
-#include <iostream>
-#include <FL/Fl.H>
-#include <FL/Fl_Window.H>
-#include <FL/Fl_Button.H>
-#include <FL/Fl_Box.H>
-#include <FL/Fl_Pack.H>
-#include <FL/Fl_Menu_Bar.H>
-#include <FL/Fl_Valuator.H>
-#include <FL/Fl_Multiline_Output.H>
-#include <FL/Fl_Clock.H>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "args.hh"
-#include "callbacks.hh"
-#include "label.hh"
-#include "update.hh"
-#include "button.hh"
-
-namespace flsh
-{
-
- enum Bool {True=0, False=1};
-
- class row_globals
- {
- public:
- static unsigned int used_rows;
- static unsigned int rows;
- static Fl_Pack *row;
- static unsigned int row_counter;
- };
-
-
- class globals :public row_globals
- {
- public:
- static unsigned int widget_width;
- static unsigned int widget_height;
- static Bool use_border;
- static Fl_Widget *current_widget;
- };
-
- class environment :public globals, public callbacks
- {
- };
-
-
-
- void check_rows();
-}
-
-#endif
-
-
Index: flshell/label.cc
===================================================================
RCS file: flshell/label.cc
diff -N flshell/label.cc
--- flshell/label.cc 12 Aug 2006 03:40:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,42 +0,0 @@
-
-/*
- AntiRight
- (c) 2002-2006 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#include "flshell.hh"
-
-namespace flsh
-{
- void Label::create_label()
- {
- widget=new Fl_Output(0,0,128,30);
- }
- Label::Label(const char *text)
- {
- create_label();
- widget->value(text);
- }
- Label::Label()
- {
- create_label();
- }
-
-}
Index: flshell/label.hh
===================================================================
RCS file: flshell/label.hh
diff -N flshell/label.hh
--- flshell/label.hh 12 Aug 2006 03:40:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,42 +0,0 @@
-
-/*
- AntiRight
- (c) 2002-2006 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#ifndef FLSH_LABEL_HH
-#define FLSH_LABEL_HH
-
-#include "flshell.hh"
-
-namespace flsh
-{
- class Label
- {
- public:
- Label();
- Label(const char *text);
- void set(const char *text);
- private:
- void create_label();
- Fl_Output *widget;
- };
-}
-#endif
Index: flshell/main.cc
===================================================================
RCS file: flshell/main.cc
diff -N flshell/main.cc
--- flshell/main.cc 12 Aug 2006 03:40:51 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,110 +0,0 @@
-/*
- AntiRight
- (c) 2002-2006 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#include "flshell.hh"
-namespace flsh
-{
- unsigned int row_globals::used_rows=1;
- unsigned int row_globals::rows=8;
- unsigned int row_globals::row_counter=0;
- Fl_Pack *row_globals::row;
-
- unsigned int globals::widget_width=192;
- unsigned int globals::widget_height=32;
- Fl_Widget *globals::current_widget;
-
-
-
- void check_rows()
- {
- if(globals::row_counter==globals::rows)
- {
- globals::row->end();
- globals::row=new Fl_Pack(0,0,globals::widget_width,
globals::widget_height*globals::rows);
- globals::row_counter=0;
- globals::used_rows++;
- }
- }
-
-} // End namespace FLSH
-
-
-int
-main(int argc, char **argv)
-{
- using namespace flsh;
-
- Fl_Window *window;
- Fl_Pack *packer;
- Fl_Pack *columns;
- Fl_Box *box;
- Fl_Menu_Bar *menubar;
-
-
- window=new Fl_Window(globals::widget_width,
- globals::widget_height);
-
- box=new Fl_Box(0,0,globals::widget_width,
- globals::widget_height);
-
- window->resizable(box);
-
- packer=new Fl_Pack(0,0,globals::widget_width,
- globals::widget_height);
- packer->spacing(0);
-
- menubar=new Fl_Menu_Bar(0,0,0,30);
- setup_menu(menubar);
-
- columns=new Fl_Pack(0,0,globals::widget_width,
- globals::widget_height*row_globals::rows);
- columns->type(FL_HORIZONTAL);
-
- row_globals::row=new Fl_Pack(0,0,globals::widget_width,
- globals::widget_height);
- row_globals::row->type(FL_VERTICAL);
-
- command_line_loop(argc, argv);
-
- // This is done to ensure that row size changes are taken into
- // account by the base container.
- columns->resize(0,0,globals::widget_width,
- globals::widget_height*row_globals::rows);
-
-
- columns->end();
- packer->end();
-
- // Ensure that all the buttons are seen.
- window->size(globals::widget_width*globals::used_rows,
- row_globals::rows*globals::widget_height+30);
-
- window->end();
-
-
- // FIXME: the previous arguments processed should be removed,
- // such as to not produce needless output from the call below.
- window->show(argc, argv);
-
- return Fl::run();
-}
-
Index: flshell/update.cc
===================================================================
RCS file: flshell/update.cc
diff -N flshell/update.cc
--- flshell/update.cc 12 Aug 2006 03:40:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,68 +0,0 @@
-/*
- AntiRight
- (c) 2002-2006 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-#include "flshell.hh"
-
-namespace flsh
-{
- void update_value(void *data)
- {
- char *returned;
- Update *update=(Update*)data;
- returned=antiright_pipe_read((char*)update->command);
- update->widget->value(returned);
- free(returned);
-#ifdef DEBUG
- puts("TICK");
-#endif
- Fl::repeat_timeout(1.0, update_value, data);
- }
-
- void add_updater(void* data)
- {
- Fl::add_timeout(1.0, update_value, data);
- }
- void updater_argument(const char *option)
- {
- Update *update;
-
- //globals::widget_width=256;
-
- update=new Update;
- globals::widget_width=512;
-
- check_rows();
-
- globals::row->size(globals::widget_width,
globals::widget_height*globals::rows);
-
- update->widget=new
- Fl_Multiline_Output(0,globals::widget_height*globals::row_counter,
- globals::widget_width,
- globals::widget_height
- *(row_globals::rows-row_globals::row_counter));
- update->widget->textfont(FL_SCREEN);
- update->widget->textsize(10);
- globals::row_counter=globals::rows;
- asprintf(&update->command, "%s", option);
- add_updater((void*)update);
- }
-}
Index: flshell/update.hh
===================================================================
RCS file: flshell/update.hh
diff -N flshell/update.hh
--- flshell/update.hh 12 Aug 2006 03:40:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,39 +0,0 @@
-
-/*
- AntiRight
- (c) 2002-2006 Jeffrey Bedard
- address@hidden
-
- This file is part of AntiRight.
-
- AntiRight is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- AntiRight 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with AntiRight; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-*/
-
-
-#ifndef FLSH_UPDATE_HH
-#define FLSH_UPDATE_HH
-namespace flsh
-{
- class Update
- {
- public:
- Fl_Multiline_Output *widget;
- char *command;
- };
- void add_updater(void *data);
- void update_value(void *data);
- void updater_argument(const char *option);
-}
-#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Antiright-devel] antiright gtkshell/Makefile gtkshell/main.c fls...,
Jeffrey Bedard <=