API Update for gtk-- stuff and minor changes and additions

This commit is contained in:
Predrag "Pele" Balorda 1999-12-28 16:22:47 +00:00
parent d92d403a76
commit c2005f9a7a
13 changed files with 234 additions and 117 deletions

View file

@ -1,4 +1,8 @@
ChangeLog for gtk-tool
28/12/1999 - Pele
* Updated Gtk-- API from 1.0 to 1.1
* Added -d switch (for debugging info)
* Added "Options" menu
12/01/1999 - Pele
* Added some defines for U-MICH compatibility

View file

@ -33,24 +33,31 @@ void Gtk_LdapServer::setType(int t) {
Gtk_Label *label;
char *c = NULL;
if (this->get_child() != NULL) {
xpm_label = new Gtk_HBox(GTK_HBOX(this->get_child()->gtkobj()));
this->remove();
/*
//xpm_label = new Gtk_HBox(GTK_HBOX(this->get_child()->gtkobj()));
xpm_label = new Gtk_HBox(this->get_child());
xpm_label->remove_c(xpm_label->children()->nth_data(0));
xpm_label->remove_c(xpm_label->children()->nth_data(0));
*/
}
else xpm_label = new Gtk_HBox();
xpm_label = new Gtk_HBox();
debug(this->hostname);
if (strcasecmp(this->hostname,"localhost") == 0)
xpm_icon=new Gtk_Pixmap(*xpm_label, local_server);
else xpm_icon=new Gtk_Pixmap(*xpm_label, remote_server);
//xpm_icon=new Gtk_Pixmap(*xpm_label, local_server);
xpm_icon=new Gtk_Pixmap(local_server);
else //xpm_icon=new Gtk_Pixmap(*xpm_label, remote_server);
xpm_icon=new Gtk_Pixmap(remote_server);
// sprintf(c, "%s:%i", this->hostname, this->port);
// printf("%s\n", c);
label = new Gtk_Label(this->hostname);
xpm_label->pack_start(*xpm_icon, false, false, 1);
xpm_label->pack_start(*label, false, false, 1);
if (this->get_child() == NULL) this->add(xpm_label);
label->show();
xpm_label->show();
xpm_icon->show();
if (this->get_child() == NULL) this->add(*xpm_label);
//label->show();
//xpm_label->show();
//xpm_icon->show();
this->show_all();
}
int Gtk_LdapServer::showDetails() {
@ -60,15 +67,16 @@ int Gtk_LdapServer::showDetails() {
debug("Have a notebook here");
if (par->viewport2->get_child() != NULL) {
debug(" and viewport has children");
par->viewport2->remove(par->viewport2->get_child());
debug(" which have been removed");
par->viewport2->remove(); //par->viewport2->get_child());
debug(" which have been removed\n");
}
else debug(" and viewport without children");
par->viewport2->add(this->notebook);
this->notebook->show();
par->viewport2->show();
return 0;
else debug(" and viewport without children\n");
par->viewport2->add(*this->notebook);
//this->notebook->show();
//par->viewport2->show();
//return 0;
}
this->show_all();
debug("done\n");
return 0;
}
@ -96,15 +104,19 @@ int Gtk_LdapServer::getConfig() {
debug("Attrib: %s\n", attribute);
if (strcasecmp(attribute, "database") == 0) {
debug("have database here\n");
this->databases = new G_List<char>;
//this->databases = new GList<char>;
this->databases = NULL;
t = ldap_get_values(this->ld, entry, attribute);
for (int i=0; i<ldap_count_values(t); i++) {
this->databases->append(strdup(t[i]));
this->databases = g_list_append(this->databases, strdup(t[i]));
//this->databases->push_back(*strdup(t[i]));
}
ldap_value_free(t);
debug("databases loaded\n");
for (int i=0; i<this->databases->length(); i++) {
debug("database(%i) %s\n", i, this->databases->nth_data(i));
GList *t;
for (int i=0;i>g_list_length(this->databases);i++) {
t = g_list_nth(this->databases, i);
// debug("database(%i) %s\n", i, ((gchar*) t->data));
}
}
}
@ -182,8 +194,9 @@ int Gtk_LdapServer::getOptions() {
label = new Gtk_Label("This tool has been compiled with (old) U-MICH API (no LDAP_GET_OPT)\nCompile with the latest -devel (from OpenLDAP cvs tree)\nto get some nice options here");
this->notebook = new Gtk_Frame("LDAP Options");
this->notebook->add(*label);
label->show();
this->notebook->show();
//label->show();
//this->notebook->show();
this->notebook->show_all();
return 0;
#else
LDAPAPIInfo api;
@ -219,7 +232,6 @@ int Gtk_LdapServer::getOptions() {
this->getSubtree();
} */
// debug("getting ldap options");
// vbox = new Gtk_VBox();
table = new Gtk_Table(10, 1, TRUE);
@ -254,21 +266,23 @@ int Gtk_LdapServer::getOptions() {
break;
case 2:
ldap_get_option(this->ld, things[i], &i_value);
radio1 = new Gtk_RadioButton(static_cast<GSList*>(0), "Enabled");
radio2 = new Gtk_RadioButton(*radio1, "Disabled");
radio1 = new Gtk_RadioButton("Enabled");
radio2 = new Gtk_RadioButton("Disabled");
radio2->set_group(radio1->group());
if (i_value == 1) radio1->set_active(true);
else radio2->set_active(true);
mini_hbox = new Gtk_HBox(FALSE, 2);
mini_hbox->set_border_width(2);
mini_hbox->pack_start(*radio1);
radio1->show();
//radio1->show();
mini_hbox->pack_end(*radio2);
radio2->show();
//radio2->show();
hbox->pack_end(*mini_hbox);
mini_hbox->show();
//mini_hbox->show();
break;
case 3:
ldap_get_option(this->ld, things[i], &i_value);
debug("i_value: %s\n", i_value);
adjustment = new Gtk_Adjustment(i_value, 1.0, 20.0, 1.0, 1.0, 0.0);
scale = new Gtk_HScale(*adjustment);
scale->set_update_policy(GTK_UPDATE_CONTINUOUS);
@ -276,7 +290,7 @@ int Gtk_LdapServer::getOptions() {
scale->set_digits(0);
scale->set_draw_value(true);
hbox->pack_end(*scale);
scale->show();
//scale->show();
break;
case 4:
#ifdef LDAP_API_INFO_VERSION
@ -293,25 +307,26 @@ int Gtk_LdapServer::getOptions() {
label->set_justify(GTK_JUSTIFY_LEFT);
label->set_alignment(0, 0);
hbox->pack_end(*label);
label->show();
//label->show();
break;
default:
label = new Gtk_Label("Not implemented (yet)");
label->set_justify(GTK_JUSTIFY_LEFT);
label->set_alignment(0, 0);
hbox->pack_end(*label);
label->show();
//label->show();
break;
}
// hbox->pack_end(*label);
// label->show();
table->attach_defaults(*hbox, 0, 1, i, i+1);
table->attach(*hbox, 0, 1, i, i+1);
hbox->show();
}
table->set_border_width(2);
this->notebook = new Gtk_Frame("LDAP Options");
this->notebook->add(*table);
table->show();
//table->show();
this->notebook->show_all();
return 0;
#endif /* LDAP_GET_OPT */
}
@ -328,12 +343,13 @@ Gtk_Tree* Gtk_LdapServer::getSubtree() {
char *c;
char *tok;
int len = this->databases->length();
int len = g_list_length(this->databases);
debug("this->databases->length()=%i\n", len);
tree = new Gtk_LdapTree();
for (int i=0; i<len; i++) {
tok = strdup(this->databases->nth_data(i));
GList *t = g_list_nth(this->databases, i);
tok = strdup((char*)t->data);
tok = strtok(tok, ":");
// c = strtok(NULL, " ");
c = strtok(NULL, "\0");

View file

@ -30,7 +30,7 @@ public:
Gtk_HBox *xpm_label;
// Gtk_Tree *subtree;
Gtk_Menu *popup;
G_List<char> *databases;
GList *databases;
Gtk_LdapServer();
Gtk_LdapServer(My_Window *w, char *c, int p);
Gtk_LdapServer(GtkTreeItem *t);

View file

@ -1,14 +1,15 @@
#include <Gtk_LdapTree.h>
void Gtk_LdapTree::show_impl() {
debug("tree show\n");
Gtk_LdapTree *tree = NULL;
debug("Gtk_LdapTree::show_impl()\n");
Gtk_LdapTree *tree;
Gtk_LdapTreeItem *item = NULL;
Gtk_LdapTree::iterator i;
Gtk_LdapTree::ItemList &items = this->tree();
Gtk_LdapTree::ItemList::iterator i = items.begin();
debug("iterator\n");
for (i=this->begin(); i!=this->end();i++) {
// item = (Gtk_LdapTreeItem *)GTK_TREE_ITEM((*i));
for (i=items.begin(); i!=items.end();i++) {
item = (Gtk_LdapTreeItem *)(*i);
debug("new item\n");
debug("#%s#\n", item->dn);
if (item->get_subtree() == NULL) {
debug("ding!\n");

View file

@ -28,7 +28,8 @@ Gtk_LdapTree* Gtk_LdapTreeItem::getSubtree(LDAP *ld, int counter) {
debug("Gtk_LdapTreeItem::getSubtree(%s)\n", this->dn);
if (counter <= 0) return NULL;
if (this->gtkobj()->subtree != NULL) {
return (Gtk_LdapTree *)GTK_TREE(this->gtkobj()->subtree);
//return (Gtk_LdapTree *)GTK_TREE(this->gtkobj()->subtree);
return (Gtk_LdapTree *)this->get_subtree(); //gtkobj()->subtree);
}
counter--;
Gtk_LdapTree *subtree = NULL, *tree = NULL;
@ -83,29 +84,49 @@ void Gtk_LdapTreeItem::setType(int t) {
Gtk_Pixmap *xpm_icon;
Gtk_Label *label;
if (this->get_child() != NULL) {
xpm_label = new Gtk_HBox(GTK_HBOX(this->get_child()->gtkobj()));
xpm_label->remove_c(xpm_label->children()->nth_data(0));
xpm_label->remove_c(xpm_label->children()->nth_data(0));
debug("got a child here");
//xpm_label = new Gtk_HBox(this->get_child());
this->remove();
/*
//xpm_label = new Gtk_HBox(*GTK_HBOX(this->get_child()->gtkobj()));
xpm_label = new Gtk_HBox(this->get_child()); //->gtkobj());
//xpm_label->remove_c(xpm_label->children().nth_data(0));
Gtk_HBox::BoxList &list = xpm_label->children();
Gtk_HBox::BoxList::iterator i = list.begin();
xpm_label->remove(*i);
//xpm_label->remove_c(xpm_label->children().nth_data(0));
xpm_label->remove(*xpm_label->children().begin());
*/
}
else xpm_label = new Gtk_HBox();
xpm_label = new Gtk_HBox();
if (strcasecmp(this->objectClass,"organization") == 0)
xpm_icon=new Gtk_Pixmap(*xpm_label, root_node);
//xpm_icon=new Gtk_Pixmap(*xpm_label, root_node);
xpm_icon=new Gtk_Pixmap(root_node);
else if (strcasecmp(this->objectClass,"organizationalunit") == 0)
xpm_icon=new Gtk_Pixmap(*xpm_label, branch_node);
//xpm_icon=new Gtk_Pixmap(*xpm_label, branch_node);
xpm_icon=new Gtk_Pixmap(branch_node);
else if (strcasecmp(this->objectClass,"person") == 0)
xpm_icon=new Gtk_Pixmap(*xpm_label, leaf_node);
//xpm_icon=new Gtk_Pixmap(*xpm_label, leaf_node);
xpm_icon=new Gtk_Pixmap(leaf_node);
else if (strcasecmp(this->objectClass,"alias") == 0)
xpm_icon=new Gtk_Pixmap(*xpm_label, alias_node);
//xpm_icon=new Gtk_Pixmap(*xpm_label, alias_node);
xpm_icon=new Gtk_Pixmap(alias_node);
else if (strcasecmp(this->objectClass,"rfc822mailgroup") == 0)
xpm_icon=new Gtk_Pixmap(*xpm_label, rfc822mailgroup_node);
else xpm_icon=new Gtk_Pixmap(*xpm_label, general_node);
//xpm_icon=new Gtk_Pixmap(*xpm_label, rfc822mailgroup_node);
xpm_icon=new Gtk_Pixmap(rfc822mailgroup_node);
else //xpm_icon=new Gtk_Pixmap(*xpm_label, general_node);
xpm_icon=new Gtk_Pixmap(general_node);
label = new Gtk_Label(this->rdn);
xpm_label->pack_start(*xpm_icon, false, false, 1);
xpm_label->pack_start(*label, false, false, 1);
if (this->get_child() == NULL) this->add(xpm_label);
label->show();
xpm_label->show();
xpm_icon->show();
if (this->get_child() == NULL) {
debug("no children - GREAT!!");
this->add(*xpm_label);
}
//label->show();
//xpm_icon->show();
//xpm_label->show();
show_all();
}
int Gtk_LdapTreeItem::showDetails() {
@ -115,7 +136,8 @@ int Gtk_LdapTreeItem::showDetails() {
debug("Have a notebook here");
if (par->viewport2->get_child() != NULL) {
debug(" and the viewport has children");
par->viewport2->remove(par->viewport2->get_child());
//par->viewport2->remove(par->viewport2->get_child());
par->viewport2->remove();
debug(" which have been removed");
}
else debug(" and viewport has no children");
@ -167,7 +189,7 @@ int Gtk_LdapTreeItem::getDetails() {
label = new Gtk_Label(attrib);
label->set_alignment(0, 0);
label->set_justify(GTK_JUSTIFY_LEFT);
this->notebook->append_page(*table, *label);
this->notebook->pages().push_back(Gtk_Notebook_Helpers::TabElem(*table, *label));
table->show();
label->show();
}

View file

@ -2,7 +2,8 @@ HOME_LOCATION=$(shell pwd)
CPLUS= g++
OPTS=-g #-DDEBUG
INCLUDES=`gtkmm-config --cflags` -I.
LDFLAGS=`gtkmm-config --libs` -L/usr/lib -L/usr/X11/lib -L/usr/local/gnome/lib -L/usr/local/ldap/lib -lldap -llber -L/usr/local/kerberos/lib -lkrb5 -lkrb4
GTKMMLIBS=`gtkmm-config --libs`
LDFLAGS=-L/usr/lib -L/usr/X11/lib -L/usr/local/ldap/lib -lldap -llber -L/usr/local/kerberos/lib -lkrb5 -lkrb4 `gtkmm-config --libs`
LIBS=-lXext -lgtkmm -lX11 -lXt -lXxf86dga
.EXPORT_ALL_VARIABLES:
@ -14,7 +15,7 @@ OBJECTS=My_Window.o Gtk_LdapTree.o Gtk_LdapTreeItem.o Gtk_LdapServer.o utils.o m
all: main
main: $(OBJECTS)
$(CPLUS) $(OBJECTS) -o main $(LDFLAGS)
$(CPLUS) $(OBJECTS) -o main $(LDFLAGS) $(GTKMMLIBS)
exec
main.o: main.cc

View file

@ -5,8 +5,9 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) {
Gtk_VBox *main_hbox;
Gtk_HBox *top_hbox;
Gtk_VBox *bottom_hbox;
Gtk_Menu *menu;
Gtk_MenuItem *file_menu, *menuitem;
Gtk_Menu *menu, *sub_menu;
Gtk_MenuItem *new_menu, *file_menu, *options_menu, *menuitem;
Gtk_CheckMenuItem *check_menuitem;
pane = new Gtk_HPaned();
this->scroller = new Gtk_ScrolledWindow();
@ -26,23 +27,53 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) {
this->viewport2->show();
top_hbox = new Gtk_HBox();
menu = new Gtk_Menu();
sub_menu = new Gtk_Menu();
menuitem = new Gtk_MenuItem("Server");
menuitem->activate.connect(slot(this,&My_Window::addServer));
//connect_to_method(menuitem->activate, this, &addServer);
sub_menu->append(*menuitem);
menuitem->show();
new_menu = new Gtk_MenuItem("New...");
new_menu->set_submenu(*sub_menu);
sub_menu->show();
menu->append(*new_menu);
new_menu->show();
menuitem = new Gtk_MenuItem("Quit");
menuitem->activate.connect(Gtk_Main::quit.slot());
menu->append(*menuitem);
menuitem->show();
this->menubar = new Gtk_MenuBar();
file_menu = new Gtk_MenuItem("File");
file_menu = new Gtk_MenuItem("File (?)");
file_menu->set_submenu(*menu);
this->menubar->append(*file_menu);
menuitem->show();
menu->show();
menu = new Gtk_Menu();
check_menuitem = new Gtk_CheckMenuItem("Show Debug Info");
check_menuitem->toggled.connect(slot(this,&My_Window::setDebug));
//connect_to_method(check_menuitem->toggled, this, &setDebug);
menu->append(*check_menuitem);
check_menuitem->show();
options_menu = new Gtk_MenuItem("Options");
options_menu->set_submenu(*menu);
this->menubar->append(*options_menu);
menu->show();
file_menu->show();
options_menu->show();
// top_hbox->pack_start(*this->menubar, TRUE, TRUE, 1);
this->menubar->show();
this->urlfield = new Gtk_Entry();
top_hbox->pack_start(*this->urlfield, TRUE, TRUE, 1);
this->urlfield->show();
this->display_button = new Gtk_Button("Query Server");
connect_to_method(this->display_button->clicked, this, &getHost);
this->display_button->clicked.connect(slot(this, &My_Window::getHost));
//connect_to_method(this->display_button->clicked, this, &getHost);
top_hbox->pack_end(*this->display_button, FALSE, FALSE, 1);
this->display_button->show();
@ -60,7 +91,8 @@ My_Window::My_Window(GtkWindowType t) : Gtk_Window(t) {
main_hbox->pack_end(*bottom_hbox, TRUE, TRUE, 1);
top_hbox->show();
bottom_hbox->show();
this->add(main_hbox);
this->add(*main_hbox);
this->destroy.connect(Gtk_Main::quit.slot());
main_hbox->show();
}
@ -70,23 +102,23 @@ My_Window::~My_Window() {
}
int My_Window::debug(const char *format,...) {
#ifdef DEBUG
va_list args;
int ret;
char *c;
char buff[50];
unsigned int m_context_id;
va_start(args, format);
ret = vprintf(format, args);
/* if (this->status != NULL) {
m_context_id = this->status->get_context_id("gtk-tool");
ret = vsprintf(c, format, args);
g_snprintf(buff, 50, "Action: %s", c);
this->status->push(m_context_id, buff);
if (debug_level > 1) {
va_list args;
int ret;
char *c;
char buff[50];
unsigned int m_context_id;
va_start(args, format);
ret = vprintf(format, args);
/* if (this->status != NULL) {
m_context_id = this->status->get_context_id("gtk-tool");
ret = vsprintf(c, format, args);
g_snprintf(buff, 50, "Action: %s", c);
this->status->push(m_context_id, buff);
}
*/ va_end(args);
return ret;
}
*/ va_end(args);
return ret;
#endif
}
void My_Window::do_display() {
@ -121,13 +153,30 @@ void My_Window::getHost() {
tree->append(*treeitem);
treeitem->set_subtree(*subtree);
treeitem->show();
this->viewport->add(tree);
this->viewport->add(*tree);
tree->show();
this->viewport->show();
this->scroller->show();
}
void My_Window::setDebug() {
if (debug_level > 0) debug_level = 0;
else debug_level = 1;
}
void My_Window::addServer() {
debug("%s\n", "Creating new server");
Gtk_Entry *entry = new Gtk_Entry();
// entry->connect(slot(entry->activate, this, &getHost));
entry->activate.connect(slot(this,&My_Window::getHost));
this->dialog = new Gtk_InputDialog();
// this->dialog->add(*entry);
// entry->show();
this->dialog->show();
}
gint My_Window::delete_event_impl(GdkEventAny*) {
Gtk_Main::instance()->quit();
//Gtk_Main::instance()->quit();
return 0;
}

View file

@ -5,12 +5,15 @@
#include "Gtk_LdapServer.h"
#include "Gtk_LdapTreeItem.h"
extern int debug_level;
class My_Window : public Gtk_Window {
public:
Gtk_ScrolledWindow *scroller, *scroller2;
Gtk_Viewport *viewport, *viewport2;
Gtk_Entry *urlfield;
Gtk_Button *display_button;
Gtk_InputDialog *dialog;
Gtk_Paned *pane;
Gtk_MenuBar *menubar;
// Gtk_ProgressBar progress;
@ -19,7 +22,9 @@ public:
~My_Window();
int debug(const char *c,...);
void do_display();
void addServer();
void getHost();
void setDebug();
gint delete_event_impl(GdkEventAny *);
};
#endif

View file

@ -9,4 +9,5 @@
#include <error.h>
#include <string.h>
extern int errno;
extern int debug_level;
#endif

View file

@ -6,4 +6,5 @@
#include <fstream.h>
#include <strstream.h>
#include <unistd.h>
#include <stdio.h>
#endif

View file

@ -8,7 +8,7 @@
#include <gtk--/window.h>
#include <gtk--/list.h>
#include <gtk--/main.h>
#include <gtk--sig.h>
/*#include <gtk--sig.h>*/
#include <gtk--/container.h>
#endif

View file

@ -6,26 +6,31 @@
#include <Gtk_LdapItem.h>
#include <Gtk_LdapServer.h>
int debug_level = 0;
int main(int argc, char **argv) {
My_Window *window;
Gtk_LdapItem *treeresult;
Gtk_Tree *tree, *subtree;
Gtk_Tree *machine, *machinetree;
Gtk_LdapServer *treeitem;
Gtk_LdapServer *server;
Gtk_Viewport *viewport;
char *host = NULL, *prt = NULL;
char *base_dn = NULL;
int c, port = 0;
G_List<char> *hosts;
GList *hosts = NULL;
int host_count = 0;
char *pair[2];
hosts = new G_List<char>();
while ((c = getopt(argc, argv, "s:p:h")) != -1) {
//hosts = new G_List<char>();
while ((c = getopt(argc, argv, "d:s:p:h")) != -1) {
switch (c) {
case 'd':
debug_level = atoi(optarg);
break;
case 's':
debug("host\n");
hosts = hosts->append(strdup(optarg));
debug("host\n");
hosts = g_list_append(hosts, (strdup(optarg)));
break;
case 'p':
port = atoi(optarg); break;
@ -34,20 +39,28 @@ int main(int argc, char **argv) {
fprintf(stderr, "Usage: %s ([-s server[:port]])*\n", argv[0]);
exit(-1);
}
fprintf(stderr,"b");
}
debug("%i hosts\n", hosts->length());
for (int f=0; f<hosts->length(); f++) {
debug("%s\n", hosts->nth_data(f));
}
if (hosts->length() == 0) {
#ifdef LDAP_GET_OPT
printf("Supply me with a host please (hint: use -s\n");
exit(0);
#else
debug("%i hosts\n", g_list_length(hosts));
if (g_list_length(hosts) == 0) {
#ifndef LDAP_GET_OPT
ldap_get_option(NULL, LDAP_OPT_HOST_NAME, host);
hosts = hosts->append(host);
#endif /* LDAP_GET_OPT */
}
if (host!=NULL) {
hosts = g_list_append(hosts, host);
debug("Default host: %s\n", host);
} else {
#ifndef LDAP_GET_OPT
fprintf(stderr,"Why isn't your LDAP_OPT_HOST_NAME defined?\n");
#endif
fprintf(stderr,"Supply me with a host please (hint: use -s)\n");
// exit(1);
}
} else {
for (int f=0; f<g_list_length(hosts); f++) {
debug("%s\n", g_list_nth(hosts,f)->data);
}
}
if (port == 0) port = LDAP_PORT;
Gtk_Main m(&argc, &argv);
@ -57,18 +70,18 @@ int main(int argc, char **argv) {
// viewport = new Gtk_Viewport();
if (hosts!=NULL) {
tree = new Gtk_Tree();
for (int f=0; f<hosts->length(); f++) {
host = strtok(hosts->nth_data(f), ":");
for (int f=0; f<g_list_length(hosts); f++) {
host = strtok((char*)g_list_nth(hosts, f)->data, ":");
prt = strtok(NULL, "\0");
if (prt != NULL) port = atoi(prt);
else port = LDAP_PORT;
treeitem = new Gtk_LdapServer(window, host, port);
subtree = treeitem->getSubtree();
tree->append(*treeitem);
treeitem->set_subtree(*subtree);
treeitem->show();
server = new Gtk_LdapServer(window, host, port);
subtree = server->getSubtree();
tree->append(*server);
server->set_subtree(*subtree);
server->show();
}
window->viewport->add(tree);
window->viewport->add(*tree);
tree->show();
}

View file

@ -1,13 +1,17 @@
#include <stdio.h>
#include <stdarg.h>
extern int debug_level;
int debug(const char *format,...) {
#ifdef DEBUG
va_list args;
int ret;
va_start(args, format);
ret = vprintf(format, args);
va_end(args);
return ret;
#endif
if (debug_level > 0) {
//#ifdef DEBUG
va_list args;
int ret;
va_start(args, format);
ret = vprintf(format, args);
va_end(args);
return ret;
//#endif
}
}