Commit 0cf9d9ce authored by Claes Sjofors's avatar Claes Sjofors

Variable textsize in Wow::CreateList

parent 3e7f9be0
......@@ -123,3 +123,4 @@
091005 cs gdh Bugfix in DetachedVolume. Attaching objects on a remote node didn't work.
091005 cs statusmon Change node dialog and language support added. Some documentation.
091014 cs doc Links in Designer's Guide updated and code format added in html version.
091020 cs co wow_CreateList now with variable text size.
\ No newline at end of file
......@@ -220,6 +220,7 @@ class WowListCtx {
GtkWidget *toplevel;
GtkWidget *list;
char *texts;
int textsize;
void (* action_cb) ( void *, char *);
void (* cancel_cb) ( void *);
void *parent_ctx;
......@@ -240,7 +241,7 @@ void CoWowGtk::list_apply_cb (
{
WowListCtx *ctx = (WowListCtx *) data;
char *text;
static char selected_text[80];
static char selected_text[512];
GtkTreeIter iter;
GtkTreeModel *store;
......@@ -307,6 +308,7 @@ static gboolean list_delete_event( GtkWidget *w, GdkEvent *event, gpointer data)
void *CoWowGtk::CreateList (
const char *title,
const char *texts,
int textsize,
void (action_cb)( void *, char *),
void (cancel_cb)( void *),
void *parent_ctx,
......@@ -345,7 +347,7 @@ void *CoWowGtk::CreateList (
gtk_list_store_append( store, &iter);
gtk_list_store_set( store, &iter, 0, nameutf8, -1);
name_p += 80;
name_p += textsize;
i++;
g_free( nameutf8);
}
......@@ -409,8 +411,9 @@ void *CoWowGtk::CreateList (
// GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(ctx->list));
// gtk_tree_selection_set_mode( selection, GTK_SELECTION_SINGLE);
ctx->texts = (char *) calloc( i+1, 80);
memcpy( ctx->texts, texts, (i+1) * 80);
ctx->texts = (char *) calloc( i+1, textsize);
memcpy( ctx->texts, texts, (i+1) * textsize);
ctx->textsize = textsize;
// Set input focus to the scrolled list widget
gtk_widget_grab_focus( ctx->list);
......
......@@ -96,7 +96,7 @@ class CoWowGtk : public CoWow {
void *data);
void DisplayError( const char *title, const char *text);
void DisplayText( const char *title, const char *text);
void *CreateList( const char *title, const char *texts,
void *CreateList( const char *title, const char *texts, int textsize,
void (action_cb)( void *, char *),
void (cancel_cb)( void *),
void *ctx,
......
......@@ -242,11 +242,11 @@ void CoWowMotif::list_ok_cb( Widget w, XtPointer data,
{
wow_tListCtx ctx = (wow_tListCtx) data;
int *pos_list, pos_cnt;
static char selected_text[80];
static char selected_text[512];
if ( ctx->action_cb) {
if (XmListGetSelectedPos( ctx->list, &pos_list, &pos_cnt)) {
strcpy( selected_text, ctx->texts + (pos_list[0] - 1) * 80);
strcpy( selected_text, ctx->texts + (pos_list[0] - 1) * ctx->textsize);
(ctx->action_cb)( ctx->parent_ctx, selected_text);
XtFree( (char *)pos_list);
......@@ -276,7 +276,7 @@ void CoWowMotif::list_action_cb( Widget w, XtPointer data,
{
wow_tListCtx ctx = (wow_tListCtx) data;
char *item_str;
static char action_text[80];
static char action_text[512];
if ( cbs->event->type == KeyPress)
// The ok callback will be called later
......@@ -295,7 +295,7 @@ void CoWowMotif::list_action_cb( Widget w, XtPointer data,
free( ctx);
}
void *CoWowMotif::CreateList( const char *title, const char *texts,
void *CoWowMotif::CreateList( const char *title, const char *texts, int textsize,
void (action_cb)( void *, char *),
void (cancel_cb)( void *),
void *parent_ctx,
......@@ -412,12 +412,13 @@ void *CoWowMotif::CreateList( const char *title, const char *texts,
cstr = XmStringCreateSimple( name_p);
XmListAddItemUnselected( ctx->list, cstr, 0);
XmStringFree(cstr);
name_p += 80;
name_p += textsize;
i++;
}
ctx->texts = (char *) calloc( i+1, 80);
memcpy( ctx->texts, texts, (i+1) * 80);
ctx->texts = (char *) calloc( i+1, textsize);
ctx->textsize = textsize;
memcpy( ctx->texts, texts, (i+1) * textsize);
XtPopup( ctx->toplevel, XtGrabNone);
// Set input focus to the scrolled list widget
......
......@@ -32,6 +32,7 @@ typedef struct {
Widget toplevel;
Widget list;
char *texts;
int textsize;
void (* action_cb) ( void *, char *);
void (* cancel_cb) ( void *);
void *parent_ctx;
......
......@@ -91,7 +91,7 @@ class CoWow {
void *data) {}
virtual void DisplayError( const char *title, const char *text) {}
virtual void DisplayText( const char *title, const char *text) {}
virtual void *CreateList( const char *title, const char *texts,
virtual void *CreateList( const char *title, const char *texts, int textsize,
void (action_cb)( void *, char *),
void (cancel_cb)( void *),
void *ctx,
......
......@@ -91,7 +91,7 @@ pwr_tStatus WCast::open_castlist()
}
strcpy( class_vect[class_cnt], "");
wow->CreateList( name, (char *)class_vect, selected_cb, 0, (void *)this);
wow->CreateList( name, (char *)class_vect, 80, selected_cb, 0, (void *)this);
return 1;
}
......
......@@ -175,7 +175,7 @@ void Wda::open_attr_dialog()
strcpy( attr_vect[attr_cnt], "");
wow->CreateList( "Attributes", (char *)attr_vect,
wow->CreateList( "Attributes", (char *)attr_vect, 80,
set_attr_cb, 0, (void *)this);
}
......
......@@ -146,3 +146,4 @@
090916 cs xtt New xtt command 'show objectlist /class='.
090916 cs xtt New xtt commands 'create opmenuitem' and 'delete opmenuitem' to modify operator window menu..
090930 cs ge Java compile problems for subgraphs with multiple annotations fixed.
091020 cs xtt Buggfix in System Messages, zip-files >= version 10 was not opened in the correct order in next/prev file.
\ No newline at end of file
......@@ -714,7 +714,7 @@ void Xtt::list_opplace()
}
else
// Select oplace from list
wow->CreateList( "Select Operator Place", (char *)texts, opplace_selected_cb, 0, this);
wow->CreateList( "Select Operator Place", (char *)texts, 80, opplace_selected_cb, 0, this);
}
......
......@@ -109,7 +109,7 @@ void GeGtk::create_list( const char *title, const char *texts,
void (action_cb)( void *, char *), void *ctx)
{
CoWowGtk wow( toplevel);
wow.CreateList( title, texts, action_cb, 0, ctx, 1);
wow.CreateList( title, texts, 80, action_cb, 0, ctx, 1);
}
void GeGtk::subgraphs_new()
......
......@@ -78,7 +78,7 @@ void GeMotif::create_list( const char *title, const char *texts,
void (action_cb)( void *, char *), void *ctx)
{
CoWowMotif wow( toplevel);
wow.CreateList( title, texts, action_cb, 0, ctx);
wow.CreateList( title, texts, 80, action_cb, 0, ctx);
}
void GeMotif::subgraphs_new()
......
......@@ -310,7 +310,7 @@ void CLogGtk::activate_select_file( GtkWidget *w, gpointer data)
strcat( str[i], clog->clognav->file_list[i].name);
}
clog->wow->CreateList( "Select File", (char *)str, file_selected_cb, 0, clog);
clog->wow->CreateList( "Select File", (char *)str, 80, file_selected_cb, 0, clog);
free( str);
}
......
......@@ -373,9 +373,10 @@ void CLogNav::get_files()
}
dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_END);
sprintf( file_spec, "$pwrp_log/pwr_%s.log.*.gz", nodename);
for ( int i = 1; i < 21; i++) {
sprintf( file_spec, "$pwrp_log/pwr_%s.log.%d.gz", nodename, i);
sts = dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_INIT);
while ( ODD(sts)) {
if ( ODD(sts)) {
stat( found_file, &info);
time.tv_sec = info.st_ctime;
......@@ -384,9 +385,9 @@ void CLogNav::get_files()
file_list.push_back( *cf);
delete cf;
sts = dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_NEXT);
}
dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_END);
}
}
......
......@@ -1948,7 +1948,7 @@ static int xnav_show_func( void *client_data,
int cnt = 0;
pwr_tObjName class_str;
char title_str[80];
pwr_tString80 *names;
pwr_tOName *names;
xnav_sObjectList *ctx;
pwr_tCid cid;
......@@ -1968,14 +1968,14 @@ static int xnav_show_func( void *client_data,
sts = gdh_GetNextAttrRef( cid, &aref, &aref)) {
cnt++;
}
names = (pwr_tString80 *)calloc( cnt, sizeof(pwr_tString80));
names = (pwr_tOName *)calloc( cnt, sizeof(pwr_tOName));
int idx = 0;
for ( sts = gdh_GetClassListAttrRef( cid, &aref);
ODD(sts);
sts = gdh_GetNextAttrRef( cid, &aref, &aref)) {
sts = gdh_AttrrefToName( &aref, names[idx], sizeof(names[0]),
cdh_mName_volumeStrict);
cdh_mNName /* cdh_mName_volumeStrict */ );
if ( EVEN(sts)) continue;
idx++;
......@@ -1995,7 +1995,7 @@ static int xnav_show_func( void *client_data,
ctx->cid = cid;
ctx->xnav = xnav;
xnav->wow->CreateList( title_str, (char *)names, xnav_show_objectlist_cb,
xnav->wow->CreateList( title_str, (char *)names, sizeof(names[0]), xnav_show_objectlist_cb,
xnav_show_objectlist_cancel_cb, ctx);
free( names);
}
......@@ -3089,7 +3089,8 @@ static int xnav_open_func( void *client_data,
ctx = (xnav_sHistList *) calloc( 1, sizeof(xnav_sHistList));
ctx->oid = oid;
ctx->xnav = xnav;
xnav->wow->CreateList( "History List", (char *)cname, xnav_open_shist_cb, xnav_open_shist_cancel_cb, ctx);
xnav->wow->CreateList( "History List", (char *)cname, sizeof(cname[0]), xnav_open_shist_cb,
xnav_open_shist_cancel_cb, ctx);
}
else if ( strncmp( arg1_str, "HISTORY", strlen( arg1_str)) == 0)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment