Commit 859097a5 authored by Claes Sjofors's avatar Claes Sjofors Committed by Christoffer Ackelman

Ge object navigator filtering added

parent f7ae8e53
...@@ -5211,6 +5211,7 @@ create <link>gecmd_create ...@@ -5211,6 +5211,7 @@ create <link>gecmd_create
<t>create subgraph <link>gecmd_create_subgraph <t>create subgraph <link>gecmd_create_subgraph
<t>create bar <link>gecmd_create_bar <t>create bar <link>gecmd_create_bar
exit <link>gecmd_exit exit <link>gecmd_exit
filter navigator <link>gecmd_filter_navigator
group <link>gecmd_group group <link>gecmd_group
move <link>gecmd_move move <link>gecmd_move
<t>move currentobject <link>gecmd_move_currentobject <t>move currentobject <link>gecmd_move_currentobject
...@@ -5428,6 +5429,27 @@ Save the current graph and close Ge. ...@@ -5428,6 +5429,27 @@ Save the current graph and close Ge.
<c>ge> exit ['filename'] <c>ge> exit ['filename']
</topic> </topic>
<topic>gecmd_filter_navigator
filter navigator
Filter objects in the object navigator.
Filtering can be made on object name or subgraph with
wildcard pattern.
<b>Syntax
<c>ge> filter navigator /type= /pattern=
<c>ge> filter navigator /reset
/reset <t>Reset filter and show all objects.
/type <t>'name' or 'class'. Name will filter on object name
<t>and class on subgraph.
/pattern <t>Filter pattern. Can contain wildcard (*).
<b>Example
<c>ge> filter navigator /type=class /pattern=*button*
</topic>
<topic>gecmd_group <style>function <topic>gecmd_group <style>function
group group
......
...@@ -5156,6 +5156,7 @@ create <link>gecmd_create ...@@ -5156,6 +5156,7 @@ create <link>gecmd_create
<t>create text <link>gecmd_create_text <t>create text <link>gecmd_create_text
<t>create subgraph <link>gecmd_create_subgraph <t>create subgraph <link>gecmd_create_subgraph
exit <link>gecmd_exit exit <link>gecmd_exit
filter navigator <link>gecmd_filter_navigator
group <link>gecmd_group group <link>gecmd_group
move <link>gecmd_move move <link>gecmd_move
<t>move currentobject <link>gecmd_move_currentobject <t>move currentobject <link>gecmd_move_currentobject
...@@ -5345,6 +5346,26 @@ Avsluta ge och spara aktuell graf f ...@@ -5345,6 +5346,26 @@ Avsluta ge och spara aktuell graf f
<c>ge> exit ['filename'] <c>ge> exit ['filename']
</topic> </topic>
<topic>gecmd_filter_navigator
filter navigator
Filtrera objekt i objektsnavigatorn.
Filtrering kan göras på objektsnamn eller subgraf med wildcard.
<b>Syntax
<c>ge> filter navigator /type= /pattern=
<c>ge> filter navigator /reset
/reset <t>Återställer filtreringen och visar alla objekt.
/type <t>'name' eller 'class'. Name filtrerar på objektsnamn
<t>och class på subgraf.
/pattern <t>Filter mönster. Kan innehålla wildcard (*).
<b>Exempel
<c>ge> filter navigator /type=class /pattern=*button*
</topic>
<topic>gecmd_group <style>function <topic>gecmd_group <style>function
group group
......
...@@ -1719,7 +1719,7 @@ GeGtk::GeGtk( void *x_parent_ctx, ...@@ -1719,7 +1719,7 @@ GeGtk::GeGtk( void *x_parent_ctx,
int path_cnt; int path_cnt;
char *path; char *path;
char systemname[80]; char systemname[80];
const int window_width = 900; const int window_width = 980;
const int window_height = 800; const int window_height = 800;
const int palette_width = 200; const int palette_width = 200;
pwr_tFileName fname; pwr_tFileName fname;
...@@ -3305,7 +3305,7 @@ GeGtk::GeGtk( void *x_parent_ctx, ...@@ -3305,7 +3305,7 @@ GeGtk::GeGtk( void *x_parent_ctx,
g_object_set( hpaned3, "visible", FALSE, NULL); g_object_set( hpaned3, "visible", FALSE, NULL);
gtk_paned_set_position( GTK_PANED(hpaned2), 150); gtk_paned_set_position( GTK_PANED(hpaned2), 150);
gtk_paned_set_position( GTK_PANED(hpaned), window_width - palette_width - 45); gtk_paned_set_position( GTK_PANED(hpaned), window_width - palette_width - 175);
gtk_paned_set_position( GTK_PANED(vpaned1), window_height - 380); gtk_paned_set_position( GTK_PANED(vpaned1), window_height - 380);
gtk_paned_set_position( GTK_PANED(vpaned2), window_height - 290); gtk_paned_set_position( GTK_PANED(vpaned2), window_height - 290);
......
...@@ -105,6 +105,7 @@ class Attr { ...@@ -105,6 +105,7 @@ class Attr {
void set_graph( Graph *g) { attrnav->graph = g;} void set_graph( Graph *g) { attrnav->graph = g;}
void set_inputfocus( int focus) { if ( focus) attrnav->set_inputfocus();} void set_inputfocus( int focus) { if ( focus) attrnav->set_inputfocus();}
int set_attr_value( char *value_str); int set_attr_value( char *value_str);
void filter( int type, char *pattern) { attrnav->filter( type, pattern);}
static int get_plant_select_c( void *attr_ctx, char *value, int size); static int get_plant_select_c( void *attr_ctx, char *value, int size);
static int get_current_colors_c( void *attr_ctx, glow_eDrawType *fill_color, static int get_current_colors_c( void *attr_ctx, glow_eDrawType *fill_color,
glow_eDrawType *border_color, glow_eDrawType *border_color,
......
...@@ -1567,7 +1567,8 @@ AttrNav::AttrNav( void *xn_parent_ctx, ...@@ -1567,7 +1567,8 @@ AttrNav::AttrNav( void *xn_parent_ctx,
parent_ctx(xn_parent_ctx), type(xn_type), parent_ctx(xn_parent_ctx), type(xn_type),
itemlist(xn_itemlist),item_cnt(xn_item_cnt), itemlist(xn_itemlist),item_cnt(xn_item_cnt),
trace_started(0), graph(0), last_selected(0), last_selected_id(0), trace_started(0), graph(0), last_selected(0), last_selected_id(0),
message_cb(NULL), get_object_list_cb(0), set_inputfocus_cb(0), traverse_inputfocus_cb(0) filter_type(attr_eFilterType_No), message_cb(NULL), get_object_list_cb(0),
set_inputfocus_cb(0), traverse_inputfocus_cb(0)
{ {
strcpy( name, xn_name); strcpy( name, xn_name);
*status = 1; *status = 1;
...@@ -2955,6 +2956,20 @@ void AttrNav::refresh_objects( unsigned int type) ...@@ -2955,6 +2956,20 @@ void AttrNav::refresh_objects( unsigned int type)
default: default:
strcpy( ncname, ""); strcpy( ncname, "");
} }
switch ( filter_type) {
case attr_eFilterType_No:
break;
case attr_eFilterType_Name:
if ( dcli_wildcard( filter_pattern, oname) != 0)
continue;
break;
case attr_eFilterType_Class:
if ( dcli_wildcard( filter_pattern, ncname) != 0)
continue;
break;
}
item = new AItemObject( this, oname, otype, list[i], ncname, NULL, flow_eDest_IntoLast); item = new AItemObject( this, oname, otype, list[i], ncname, NULL, flow_eDest_IntoLast);
// Open previously open objects // Open previously open objects
...@@ -3059,6 +3074,16 @@ void AttrNav::object_open_check( AItemObject *item, grow_tObject *open_list, int ...@@ -3059,6 +3074,16 @@ void AttrNav::object_open_check( AItemObject *item, grow_tObject *open_list, int
} }
} }
void AttrNav::filter( int type, char *pattern)
{
filter_type = (attr_eFilterType) type;
if ( filter_type == attr_eFilterType_No)
strcpy( filter_pattern, "");
else
strncpy( filter_pattern, pattern, sizeof(filter_pattern));
refresh_objects( attr_mRefresh_Objects);
}
brow_tObject AttrNav::gobject_to_bobject( grow_tObject gobject) brow_tObject AttrNav::gobject_to_bobject( grow_tObject gobject)
{ {
brow_tObject *blist; brow_tObject *blist;
......
...@@ -95,6 +95,12 @@ typedef enum { ...@@ -95,6 +95,12 @@ typedef enum {
attr_eType_ObjectTree attr_eType_ObjectTree
} attr_eType; } attr_eType;
typedef enum {
attr_eFilterType_No,
attr_eFilterType_Name,
attr_eFilterType_Class
} attr_eFilterType;
typedef enum { typedef enum {
attrnav_eItemType_Local, attrnav_eItemType_Local,
attrnav_eItemType_Enum, attrnav_eItemType_Enum,
...@@ -181,6 +187,8 @@ class AttrNav { ...@@ -181,6 +187,8 @@ class AttrNav {
Graph *graph; Graph *graph;
brow_tObject last_selected; brow_tObject last_selected;
grow_tObject last_selected_id; grow_tObject last_selected_id;
attr_eFilterType filter_type;
char filter_pattern[80];
void (*message_cb)( void *, int, char, const char *); void (*message_cb)( void *, int, char, const char *);
void (*change_value_cb)( void *); void (*change_value_cb)( void *);
int (*get_subgraph_info_cb)( void *, char *, attr_sItem **, int *); int (*get_subgraph_info_cb)( void *, char *, attr_sItem **, int *);
...@@ -204,6 +212,7 @@ class AttrNav { ...@@ -204,6 +212,7 @@ class AttrNav {
void refresh_objects( unsigned int type); void refresh_objects( unsigned int type);
void object_open_check( AItemObject *item, grow_tObject *open_list, int *open_type, int open_cnt); void object_open_check( AItemObject *item, grow_tObject *open_list, int *open_type, int open_cnt);
brow_tObject gobject_to_bobject( grow_tObject gobject); brow_tObject gobject_to_bobject( grow_tObject gobject);
void filter( int type, char *pattern);
virtual void set_inputfocus() {} virtual void set_inputfocus() {}
virtual void trace_start() {} virtual void trace_start() {}
static int init_brow_cb( FlowCtx *fctx, void *client_data); static int init_brow_cb( FlowCtx *fctx, void *client_data);
......
...@@ -1308,6 +1308,7 @@ void Graph::select_all_objects() ...@@ -1308,6 +1308,7 @@ void Graph::select_all_objects()
} }
object_p++; object_p++;
} }
refresh_objects( attr_mRefresh_Select);
} }
void Graph::select_object( grow_tObject o) void Graph::select_object( grow_tObject o)
...@@ -1367,6 +1368,7 @@ void Graph::select_nextobject( glow_eDirection dir) ...@@ -1367,6 +1368,7 @@ void Graph::select_nextobject( glow_eDirection dir)
if ( !grow_IsVisible( grow->ctx, next, glow_eVisible_Partial)) if ( !grow_IsVisible( grow->ctx, next, glow_eVisible_Partial))
grow_CenterObject( grow->ctx, next); grow_CenterObject( grow->ctx, next);
} }
refresh_objects( attr_mRefresh_Select);
} }
int Graph::get_selected_object( grow_tObject *object) int Graph::get_selected_object( grow_tObject *object)
...@@ -2385,8 +2387,10 @@ void Graph::reset_mode( bool select_clear, bool keep) ...@@ -2385,8 +2387,10 @@ void Graph::reset_mode( bool select_clear, bool keep)
grow_SetMoveRestrictions( grow->ctx, glow_eMoveRestriction_No, 0, 0, NULL); grow_SetMoveRestrictions( grow->ctx, glow_eMoveRestriction_No, 0, 0, NULL);
grow_SetScaleEqual( grow->ctx, 0); grow_SetScaleEqual( grow->ctx, 0);
keep_mode = keep; keep_mode = keep;
if ( select_clear) if ( select_clear) {
grow_SelectClear( grow->ctx); grow_SelectClear( grow->ctx);
refresh_objects( attr_mRefresh_Select);
}
} }
// //
// Callbacks from grow // Callbacks from grow
......
...@@ -121,6 +121,8 @@ static int graph_customcolor_func( void *client_data, ...@@ -121,6 +121,8 @@ static int graph_customcolor_func( void *client_data,
void *client_flag); void *client_flag);
static int graph_search_func( void *client_data, static int graph_search_func( void *client_data,
void *client_flag); void *client_flag);
static int graph_filter_func( void *client_data,
void *client_flag);
dcli_tCmdTable graph_command_table[] = { dcli_tCmdTable graph_command_table[] = {
{ {
...@@ -253,6 +255,11 @@ dcli_tCmdTable graph_command_table[] = { ...@@ -253,6 +255,11 @@ dcli_tCmdTable graph_command_table[] = {
&graph_search_func, &graph_search_func,
{"dcli_arg", "dcli_arg2", "/NAME", ""} {"dcli_arg", "dcli_arg2", "/NAME", ""}
}, },
{
"FILTER",
&graph_filter_func,
{"dcli_arg", "/RESET", "/TYPE", "/PATTERN", ""}
},
{"",}}; {"",}};
static void graph_store_graph( Graph *graph) static void graph_store_graph( Graph *graph)
...@@ -480,6 +487,57 @@ static int graph_search_func(void *client_data, ...@@ -480,6 +487,57 @@ static int graph_search_func(void *client_data,
return GE__SUCCESS; return GE__SUCCESS;
} }
static int graph_filter_func(void *client_data,
void *client_flag)
{
Graph *graph = (Graph *)client_data;
char arg1_str[80];
int arg1_sts;
int sts;
arg1_sts = dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str));
if ( cdh_NoCaseStrncmp( arg1_str, "NAVIGATOR", strlen( arg1_str)) == 0) {
// Command is "FILTER NAVIGATOR"
char type_str[80];
char pattern_str[80];
int type;
if ( ODD( dcli_get_qualifier( "/RESET", 0, 0))) {
((Ge *)graph->parent_ctx)->objectnav->filter( 0, 0);
return GE__SUCCESS;
}
sts = dcli_get_qualifier( "/TYPE", type_str, sizeof(type_str));
if ( EVEN(sts)) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
if ( cdh_NoCaseStrcmp( type_str, "name") == 0)
type = 1;
else if ( cdh_NoCaseStrcmp( type_str, "class") == 0)
type = 2;
else {
graph->message('E', "Syntax error in filter type");
return GE__SYNTAX;
}
sts = dcli_get_qualifier( "/PATTERN", pattern_str, sizeof(pattern_str));
if ( EVEN(sts)) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
((Ge *)graph->parent_ctx)->objectnav->filter( type, pattern_str);;
}
else {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
return GE__SUCCESS;
}
static int graph_exit_func(void *client_data, static int graph_exit_func(void *client_data,
void *client_flag) void *client_flag)
{ {
......
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