[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright/xshell Makefile arguments.c button.c ...
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright/xshell Makefile arguments.c button.c ... |
Date: |
Tue, 28 Aug 2007 19:39:12 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 07/08/28 19:39:12
Modified files:
xshell : Makefile arguments.c button.c text.c xshell.h
Added files:
xshell : dialog.c dialog.h
Log message:
Added initial dialog code, not yet functional. Split out code for
definition of free-floating buttons.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/Makefile?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/arguments.c?cvsroot=antiright&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/button.c?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/text.c?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/xshell.h?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/dialog.c?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/dialog.h?cvsroot=antiright&rev=1.1
Patches:
Index: Makefile
===================================================================
RCS file: /sources/antiright/antiright/xshell/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Makefile 7 Aug 2007 16:25:23 -0000 1.4
+++ Makefile 28 Aug 2007 19:39:12 -0000 1.5
@@ -41,7 +41,7 @@
LDFLAGS=$(LIBS)
OBJECTS=xshell.o widget.o button.o arguments.o shell.o events.o decoration.o\
- text.o layout.o color.o font.o
+ text.o layout.o color.o font.o dialog.o
all: xshell
Index: arguments.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/arguments.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- arguments.c 20 Aug 2007 16:18:58 -0000 1.9
+++ arguments.c 28 Aug 2007 19:39:12 -0000 1.10
@@ -106,6 +106,7 @@
}
+
static void
handle_options(XShell * xsh, int argc, char ** argv,
unsigned int * counter)
@@ -118,6 +119,9 @@
case 'a': /* Add options. */
handle_add_options(xsh, argc, argv, counter);
break;
+ case 'd':
+ xshell_handle_dialog_options(xsh, argc, argv, counter);
+ break;
case 'h':
xsh_show_usage_and_exit();
break;
Index: button.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/button.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- button.c 20 Aug 2007 19:55:24 -0000 1.7
+++ button.c 28 Aug 2007 19:39:12 -0000 1.8
@@ -98,28 +98,36 @@
button->events.button_release=&button_release;
void
-xshell_button_new(XShell * xsh, XWidget * parent, const char * command)
+xshell_floating_button_new(XShell * xsh, XWidget * parent,
+ const char * command, int x, int y,
+ unsigned int width, unsigned int height)
{
XWidget * button;
XSHButtonData * data;
char * label;
+
+ button=xsh->gui.last_widget;
+ button->data=data=malloc(sizeof(XSHButtonData));
+ data->command=(char *)command;
+ data->label=(label=strchr(command, '#'))?label+1:(char*)command;
+ SETUP_BUTTON_EVENTS(button);
+ xshell_XWidget_new(xsh, parent, x, y, width, height);
+}
+
+void
+xshell_button_new(XShell * xsh, XWidget * parent, const char * command)
+{
XShellGUILayout *layout=&(xsh->gui.layout);
- xshell_XWidget_new(xsh, parent,
+ xshell_floating_button_new(xsh, parent, command,
XSH_WIDGET_WIDTH*(layout->column_count),
- XSH_WIDGET_HEIGHT*
- ((layout->row_count =
+ XSH_WIDGET_HEIGHT*((layout->row_count =
layout->row_count < layout->max_row_count
? layout->row_count+1:0)-1),
XSH_WIDGET_WIDTH, XSH_WIDGET_HEIGHT);
if(layout->row_count==0)
layout->column_count++;
- button=xsh->gui.last_widget;
- button->data=data=malloc(sizeof(XSHButtonData));
- data->command=(char *)command;
- data->label=(label=strchr(command, '#'))?label+1:(char*)command;
- SETUP_BUTTON_EVENTS(button);
}
Index: text.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/text.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- text.c 20 Aug 2007 19:55:25 -0000 1.7
+++ text.c 28 Aug 2007 19:39:12 -0000 1.8
@@ -30,10 +30,16 @@
char * text=data->label;
unsigned int i, length=strlen(text), line=0, columns=80,
font_height=data->font_height, font_width=data->font_width;
+ XTextItem * items=NULL;
XSH_SET_COLOR(gui->display, gui->gc, 0, 0, 0);
for(i=0; i<length; i+=columns)
{
+ char * end;
+
+ end=strchr(text, '\n');
+ *end='\0';
+
unsigned int line_length
=(length=strlen(text)) < columns ? length : columns;
XDrawString(gui->display, text_widget->window, gui->gc,
Index: xshell.h
===================================================================
RCS file: /sources/antiright/antiright/xshell/xshell.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- xshell.h 7 Aug 2007 16:25:24 -0000 1.4
+++ xshell.h 28 Aug 2007 19:39:12 -0000 1.5
@@ -47,6 +47,7 @@
#include "layout.h"
#include "font.h"
#include "color.h"
+#include "dialog.h"
#endif /* XSHELL_H */
Index: dialog.c
===================================================================
RCS file: dialog.c
diff -N dialog.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dialog.c 28 Aug 2007 19:39:12 -0000 1.1
@@ -0,0 +1,53 @@
+/*
+ AntiRight
+ (c) 2002-2007 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 "xshell.h"
+
+static void
+xshell_message_dialog(XShell * xsh, const char * message)
+{
+ xsh->gui.widgets->geometry.width=200;
+ xsh->gui.widgets->geometry.height=100;
+ xshell_floating_button_new(xsh, xsh->gui.widgets->window, "OK",
+ 0, 0, 100, 50);
+ xshell_floating_button_new(xsh, xsh->gui.widgets->window, "Cancel",
+ 100, 0, 100, 50);
+ xshell_floating_button_new(xsh, xsh->gui.widgets->window, message,
+ 0, 50, 100, 50);
+}
+
+void
+xshell_handle_dialog_options(XShell * xsh, int argc,
+ char ** argv, unsigned int * counter)
+{
+ switch(argv[*counter][2])
+ {
+ case 'm':
+ *counter++;
+ xshell_message_dialog(xsh, argv[*counter]);
+ break;
+ default:
+ fprintf(stderr, "%s: Invalid dialog argument specified.",
+ argv[0]);
+ }
+}
+
Index: dialog.h
===================================================================
RCS file: dialog.h
diff -N dialog.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dialog.h 28 Aug 2007 19:39:12 -0000 1.1
@@ -0,0 +1,31 @@
+/*
+ AntiRight
+ (c) 2002-2007 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 XSH_DIALOG_H
+#define XSH_DIALOG_H
+
+void
+xshell_handle_dialog_options(XShell * xsh, int argc,
+ char ** argv, unsigned int * counter);
+
+#endif /* XSH_DIALOG_H */
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Antiright-devel] antiright/xshell Makefile arguments.c button.c ...,
Jeffrey Bedard <=