[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-commits] CVS: adonthell/src/tools/dlgedit cfg_data.cc,1.1,1.2
From: |
Kai Sterker <address@hidden> |
Subject: |
[Adonthell-commits] CVS: adonthell/src/tools/dlgedit cfg_data.cc,1.1,1.2 cfg_project.h,1.1,1.2 gui_settings.cc,1.5,1.6 gui_settings.h,1.3,1.4 |
Date: |
Sun, 20 Oct 2002 16:22:59 -0400 |
Update of /cvsroot/adonthell/adonthell/src/tools/dlgedit
In directory subversions:/tmp/cvs-serv29811
Modified Files:
cfg_data.cc cfg_project.h gui_settings.cc gui_settings.h
Log Message:
UPDATED settings dialog to allow editing of dialogue Description and project
bas directory. (So far, only the GUI is ready, though)
Index: cfg_data.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/cfg_data.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** cfg_data.cc 17 Oct 2002 20:42:59 -0000 1.1
--- cfg_data.cc 20 Oct 2002 20:22:57 -0000 1.2
***************
*** 20,23 ****
--- 20,24 ----
*/
+ #include <stdio.h>
#include <algorithm>
#include "cfg_data.h"
***************
*** 40,46 ****
if (i != Files.end ()) Files.erase (i);
! // otherwise test whether there's enough
! // room and free some, if neccessary.
! else if (Files.size () == 15) Files.pop_front ();
// add file
--- 41,55 ----
if (i != Files.end ()) Files.erase (i);
! // otherwise make sure that we can add it
! else
! {
! // check whether the file exists at all
! FILE* test = fopen (file.c_str (), "r");
! if (!test) return;
! else fclose (test);
!
! // check whether there's enough room
! if (Files.size () == 15) Files.pop_front ();
! }
// add file
Index: cfg_project.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/cfg_project.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** cfg_project.h 17 Oct 2002 20:42:59 -0000 1.1
--- cfg_project.h 20 Oct 2002 20:22:57 -0000 1.2
***************
*** 29,33 ****
* Data that belongs to an individual project. Usually, a project
* contains all dialogues that belong to a certain game. The project's
! * name will be the name of the game, i.e. 'wastesedge'.
*/
class CfgProject
--- 29,33 ----
* Data that belongs to an individual project. Usually, a project
* contains all dialogues that belong to a certain game. The project's
! * name will be the name of the game, e.g. 'wastesedge'.
*/
class CfgProject
Index: gui_settings.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_settings.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** gui_settings.cc 12 Oct 2002 18:51:33 -0000 1.5
--- gui_settings.cc 20 Oct 2002 20:22:57 -0000 1.6
***************
*** 28,38 ****
// global pointer to the settings dialog
! GuiSettings *GuiSettings::dialog = NULL;
// browse the harddisk for a project
! void on_browse_project_clicked (GtkButton *button, gpointer user_data)
! {
! GuiFile fs (LOAD, "Select project directory", DATA_DIR"/games/");
!
// File selection closed with OK
if (fs.run ())
--- 28,38 ----
// global pointer to the settings dialog
! GuiSettings * GuiSettings::dialog = NULL;
// browse the harddisk for a project
! void on_browse_basedir_clicked (GtkButton * button, gpointer user_data)
! {
! GuiFile fs (LOAD, "Select project directory", DATA_DIR "/games/");
!
// File selection closed with OK
if (fs.run ())
***************
*** 42,46 ****
std::string file = fs.getSelection ();
stat (file.c_str (), &statbuf);
!
if (S_ISDIR (statbuf.st_mode))
{
--- 42,46 ----
std::string file = fs.getSelection ();
stat (file.c_str (), &statbuf);
!
if (S_ISDIR (statbuf.st_mode))
{
***************
*** 48,52 ****
GtkEntry *entry = (GtkEntry *) user_data;
unsigned int pos, len = file.length () - 1;
!
if (file[len] == '/')
{
--- 48,52 ----
GtkEntry *entry = (GtkEntry *) user_data;
unsigned int pos, len = file.length () - 1;
!
if (file[len] == '/')
{
***************
*** 64,68 ****
// OK button pressed
! void on_ok_button_clicked (GtkButton *button, gpointer user_data)
{
GuiSettings::dialog->applyChanges ();
--- 64,68 ----
// OK button pressed
! void on_ok_button_clicked (GtkButton * button, gpointer user_data)
{
GuiSettings::dialog->applyChanges ();
***************
*** 71,75 ****
// callback for closing the window
! void on_close_settings (GtkButton *button, gpointer user_data)
{
delete GuiSettings::dialog;
--- 71,75 ----
// callback for closing the window
! void on_close_settings (GtkButton * button, gpointer user_data)
{
delete GuiSettings::dialog;
***************
*** 79,95 ****
GuiSettings::GuiSettings ()
{
! GtkWidget *vbox;
! GtkWidget *hbox;
GtkWidget *label;
GtkWidget *button;
GtkWidget *hseparator;
GtkWidget *hbuttonbox;
! GtkTooltips *tooltips = gtk_tooltips_new ();
! // the dialog window
window = gtk_window_new (GTK_WINDOW_DIALOG);
gtk_object_set_data (GTK_OBJECT (window), "window", window);
gtk_widget_set_usize (window, 400, 320);
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, FALSE);
--- 79,101 ----
GuiSettings::GuiSettings ()
{
! GtkWidget *vbox, *vbox1;
! GtkWidget *frame;
! GtkWidget *table;
GtkWidget *label;
+ GtkWidget *scrolledwindow;
+ GtkWidget *project_menu;
+ GtkWidget *hbox;
GtkWidget *button;
GtkWidget *hseparator;
GtkWidget *hbuttonbox;
+ GtkTooltips *tooltips;
! tooltips = gtk_tooltips_new ();
! // the dialog
window = gtk_window_new (GTK_WINDOW_DIALOG);
gtk_object_set_data (GTK_OBJECT (window), "window", window);
gtk_widget_set_usize (window, 400, 320);
+ gtk_window_set_title (GTK_WINDOW (window), "Settings");
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, FALSE);
***************
*** 101,138 ****
gtk_container_add (GTK_CONTAINER (window), vbox);
! // the project entry
! hbox = gtk_hbox_new (FALSE, 4);
! gtk_widget_ref (hbox);
! gtk_object_set_data_full (GTK_OBJECT (window), "hbox", hbox,
(GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (hbox);
! gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
! gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
label = gtk_label_new ("Project");
gtk_widget_ref (label);
gtk_object_set_data_full (GTK_OBJECT (window), "label", label,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label);
! gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
! gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
! gtk_misc_set_padding (GTK_MISC (label), 12, 0);
! project = gtk_entry_new ();
gtk_widget_ref (project);
gtk_object_set_data_full (GTK_OBJECT (window), "project", project,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (project);
! gtk_box_pack_start (GTK_BOX (hbox), project, TRUE, FALSE, 0);
! gtk_widget_set_usize (project, 275, -2);
! gtk_tooltips_set_tip (tooltips, project, "The project this dialogue
belongs to, e.g. wastesedge", NULL);
button = gtk_button_new_with_label ("...");
gtk_widget_ref (button);
gtk_object_set_data_full (GTK_OBJECT (window), "button", button,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button);
! gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, FALSE, 0);
gtk_widget_set_usize (button, 30, -2);
! gtk_tooltips_set_tip (tooltips, button, "Browse your HD for a project",
NULL);
! gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC
(on_browse_project_clicked), project);
- // seperator
hseparator = gtk_hseparator_new ();
gtk_widget_ref (hseparator);
--- 107,216 ----
gtk_container_add (GTK_CONTAINER (window), vbox);
! // dialogue settings
! frame = gtk_frame_new ("Dialogue Settings");
! gtk_widget_ref (frame);
! gtk_object_set_data_full (GTK_OBJECT (window), "frame", frame,
(GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (frame);
! gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
! gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
!
! vbox1 = gtk_vbox_new (FALSE, 0);
! gtk_widget_ref (vbox1);
! gtk_object_set_data_full (GTK_OBJECT (window), "vbox1", vbox1,
(GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (vbox1);
! gtk_container_add (GTK_CONTAINER (frame), vbox1);
!
! table = gtk_table_new (2, 2, FALSE);
! gtk_widget_ref (table);
! gtk_object_set_data_full (GTK_OBJECT (window), "table", table,
(GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (table);
! gtk_box_pack_start (GTK_BOX (vbox1), table, TRUE, TRUE, 0);
! gtk_container_set_border_width (GTK_CONTAINER (table), 4);
! gtk_table_set_col_spacings (GTK_TABLE (table), 8);
+ // project
label = gtk_label_new ("Project");
gtk_widget_ref (label);
gtk_object_set_data_full (GTK_OBJECT (window), "label", label,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label);
! gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 8);
! gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
! gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
! // description
! label = gtk_label_new ("Description");
! gtk_widget_ref (label);
! gtk_object_set_data_full (GTK_OBJECT (window), "label", label,
(GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (label);
! gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
! gtk_widget_set_usize (label, 70, -2);
! gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
! gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
!
! scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
! gtk_widget_ref (scrolledwindow);
! gtk_object_set_data_full (GTK_OBJECT (window), "scrolledwindow",
scrolledwindow, (GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (scrolledwindow);
! gtk_table_attach (GTK_TABLE (table), scrolledwindow, 1, 2, 1, 2,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND |
GTK_FILL), 0, 0);
! gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
!
! description = gtk_text_new (NULL, NULL);
! gtk_widget_ref (description);
! gtk_object_set_data_full (GTK_OBJECT (window), "description",
description, (GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (description);
! gtk_container_add (GTK_CONTAINER (scrolledwindow), description);
! gtk_tooltips_set_tip (tooltips, description, "Here goes a description of
the dialogue", NULL);
! gtk_text_set_editable (GTK_TEXT (description), TRUE);
!
! project = gtk_option_menu_new ();
gtk_widget_ref (project);
gtk_object_set_data_full (GTK_OBJECT (window), "project", project,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (project);
! gtk_table_attach (GTK_TABLE (table), project, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
! gtk_tooltips_set_tip (tooltips, project, "The project this dialogue
belongs to", NULL);
! project_menu = gtk_menu_new ();
! gtk_option_menu_set_menu (GTK_OPTION_MENU (project), project_menu);
!
! frame = gtk_frame_new ("Project Settings");
! gtk_widget_ref (frame);
! gtk_object_set_data_full (GTK_OBJECT (window), "frame", frame,
(GtkDestroyNotify) gtk_widget_unref);
! gtk_widget_show (frame);
! gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
! gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
+ hbox = gtk_hbox_new (FALSE, 8);
+ gtk_widget_ref (hbox);
+ gtk_object_set_data_full (GTK_OBJECT (window), "hbox", hbox,
(GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_show (hbox);
+ gtk_container_add (GTK_CONTAINER (frame), hbox);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
+
+ // base dir entry
+ label = gtk_label_new ("Base dir");
+ gtk_widget_ref (label);
+ gtk_object_set_data_full (GTK_OBJECT (window), "label", label,
(GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_widget_set_usize (label, 70, -2);
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
+ gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
+
+ basedir = gtk_entry_new ();
+ gtk_widget_ref (basedir);
+ gtk_object_set_data_full (GTK_OBJECT (window), "basedir", basedir,
(GtkDestroyNotify) gtk_widget_unref);
+ gtk_widget_show (basedir);
+ gtk_box_pack_start (GTK_BOX (hbox), basedir, TRUE, TRUE, 0);
+ gtk_tooltips_set_tip (tooltips, basedir, "The directory root of dialogue
sources belonging to above project", NULL);
+
+ // browse for base dir
button = gtk_button_new_with_label ("...");
gtk_widget_ref (button);
gtk_object_set_data_full (GTK_OBJECT (window), "button", button,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button);
! gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_set_usize (button, 30, -2);
! gtk_tooltips_set_tip (tooltips, button, "Browse your file system for the
base directory", NULL);
! gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC
(on_browse_basedir_clicked), basedir);
hseparator = gtk_hseparator_new ();
gtk_widget_ref (hseparator);
***************
*** 141,145 ****
gtk_box_pack_start (GTK_BOX (vbox), hseparator, FALSE, FALSE, 0);
- // OK and Cancel buttons
hbuttonbox = gtk_hbutton_box_new ();
gtk_widget_ref (hbuttonbox);
--- 219,222 ----
***************
*** 166,174 ****
gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC
(on_ok_button_clicked), NULL);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC
(on_close_settings), NULL);
gtk_object_set_data (GTK_OBJECT (window), "tooltips", tooltips);
// set transient for dialogue editor main window
! gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW
(GuiDlgedit::window->getWindow ()));
dialog = this;
--- 243,250 ----
gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC
(on_ok_button_clicked), NULL);
gtk_object_set_data (GTK_OBJECT (window), "tooltips", tooltips);
// set transient for dialogue editor main window
! gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW
(GuiDlgedit::window->getWindow ()));
dialog = this;
***************
*** 184,200 ****
// display the dialog
! void GuiSettings::display (DlgModuleEntry *e, const std::string &name)
{
if (entry != e)
{
entry = e;
!
// display the contents of the module
! gtk_entry_set_text (GTK_ENTRY (project), entry->project ().c_str ());
}
!
// set the title
! gchar *title = g_strjoin (NULL, "Settings - [",
! name.c_str (), "]", NULL);
gtk_window_set_title (GTK_WINDOW (window), title);
--- 260,275 ----
// display the dialog
! void GuiSettings::display (DlgModuleEntry * e, const std::string & name)
{
if (entry != e)
{
entry = e;
!
// display the contents of the module
! // gtk_entry_set_text (GTK_ENTRY (project), entry->project ().c_str
());
}
!
// set the title
! gchar *title = g_strjoin (NULL, "Settings - [", name.c_str (), "]",
NULL);
gtk_window_set_title (GTK_WINDOW (window), title);
Index: gui_settings.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_settings.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** gui_settings.h 12 Oct 2002 18:51:34 -0000 1.3
--- gui_settings.h 20 Oct 2002 20:22:57 -0000 1.4
***************
*** 49,53 ****
/**
! * Show the dialog and display the settings of the given module.
* @param entry the settings of a certain DlgModule to be edited.
* @param name name of the dialogue whose settings are being edited.
--- 49,53 ----
/**
! * Show the dialog and display the settings of the given module.
* @param entry the settings of a certain DlgModule to be edited.
* @param name name of the dialogue whose settings are being edited.
***************
*** 63,67 ****
DlgModuleEntry *entry; // The module's settings
GtkWidget *window; // The dialog window
! GtkWidget *project; // Text entry for the project
};
--- 63,69 ----
DlgModuleEntry *entry; // The module's settings
GtkWidget *window; // The dialog window
! GtkWidget *project; // Dropdown list for the project
! GtkWidget *description; // Entry for the dialogue's description
! GtkWidget *basedir; // Entry for the project's base directory
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-commits] CVS: adonthell/src/tools/dlgedit cfg_data.cc,1.1,1.2 cfg_project.h,1.1,1.2 gui_settings.cc,1.5,1.6 gui_settings.h,1.3,1.4,
Kai Sterker <address@hidden> <=
- Prev by Date:
[Adonthell-commits] CVS: adonthell/src/tools/dlgedit cfg_io.cc,NONE,1.1 cfg_io.h,NONE,1.1 loadcfg.l,NONE,1.1 Makefile.am,1.47,1.48 dlg_circle.cc,1.4,1.5 dlg_circle.h,1.4,1.5 dlg_types.h,1.4,1.5 gui_graph.cc,1.5,1.6 kb_traverse.cc,1.1,1.2 main.cc,1.58,1.59
- Next by Date:
[Adonthell-commits] CVS: adonthell/src/gui bin.cc,1.1.2.3,1.1.2.4 border_ui.cc,1.1.2.2,1.1.2.3 box.cc,1.1.2.3,1.1.2.4 box.h,1.1.2.2,1.1.2.3 button.cc,1.1.2.2,1.1.2.3 button_ui.cc,1.1.2.1,1.1.2.2 container.cc,1.1.2.3,1.1.2.4 widget.cc,1.1.2.3,1.1.2.4 widget.h,1.1.2.3,1.1.2.4
- Previous by thread:
[Adonthell-commits] CVS: adonthell/src/tools/dlgedit cfg_io.cc,NONE,1.1 cfg_io.h,NONE,1.1 loadcfg.l,NONE,1.1 Makefile.am,1.47,1.48 dlg_circle.cc,1.4,1.5 dlg_circle.h,1.4,1.5 dlg_types.h,1.4,1.5 gui_graph.cc,1.5,1.6 kb_traverse.cc,1.1,1.2 main.cc,1.58,1.59
- Next by thread:
[Adonthell-commits] CVS: adonthell/src/gui bin.cc,1.1.2.3,1.1.2.4 border_ui.cc,1.1.2.2,1.1.2.3 box.cc,1.1.2.3,1.1.2.4 box.h,1.1.2.2,1.1.2.3 button.cc,1.1.2.2,1.1.2.3 button_ui.cc,1.1.2.1,1.1.2.2 container.cc,1.1.2.3,1.1.2.4 widget.cc,1.1.2.3,1.1.2.4 widget.h,1.1.2.3,1.1.2.4
- Index(es):