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
<t>create subgraph <link>gecmd_create_subgraph
<t>create bar <link>gecmd_create_bar
exit <link>gecmd_exit
filter navigator <link>gecmd_filter_navigator
group <link>gecmd_group
move <link>gecmd_move
<t>move currentobject <link>gecmd_move_currentobject
......@@ -5428,6 +5429,27 @@ Save the current graph and close Ge.
<c>ge> exit ['filename']
</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
group
......
......@@ -5156,6 +5156,7 @@ create <link>gecmd_create
<t>create text <link>gecmd_create_text
<t>create subgraph <link>gecmd_create_subgraph
exit <link>gecmd_exit
filter navigator <link>gecmd_filter_navigator
group <link>gecmd_group
move <link>gecmd_move
<t>move currentobject <link>gecmd_move_currentobject
......@@ -5345,6 +5346,26 @@ Avsluta ge och spara aktuell graf f
<c>ge> exit ['filename']
</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
group
......
......@@ -1719,7 +1719,7 @@ GeGtk::GeGtk( void *x_parent_ctx,
int path_cnt;
char *path;
char systemname[80];
const int window_width = 900;
const int window_width = 980;
const int window_height = 800;
const int palette_width = 200;
pwr_tFileName fname;
......@@ -3305,7 +3305,7 @@ GeGtk::GeGtk( void *x_parent_ctx,
g_object_set( hpaned3, "visible", FALSE, NULL);
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(vpaned2), window_height - 290);
......
......@@ -105,6 +105,7 @@ class Attr {
void set_graph( Graph *g) { attrnav->graph = g;}
void set_inputfocus( int focus) { if ( focus) attrnav->set_inputfocus();}
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_current_colors_c( void *attr_ctx, glow_eDrawType *fill_color,
glow_eDrawType *border_color,
......
......@@ -1567,7 +1567,8 @@ AttrNav::AttrNav( void *xn_parent_ctx,
parent_ctx(xn_parent_ctx), type(xn_type),
itemlist(xn_itemlist),item_cnt(xn_item_cnt),
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);
*status = 1;
......@@ -2955,6 +2956,20 @@ void AttrNav::refresh_objects( unsigned int type)
default:
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);
// Open previously open objects
......@@ -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 *blist;
......
......@@ -95,6 +95,12 @@ typedef enum {
attr_eType_ObjectTree
} attr_eType;
typedef enum {
attr_eFilterType_No,
attr_eFilterType_Name,
attr_eFilterType_Class
} attr_eFilterType;
typedef enum {
attrnav_eItemType_Local,
attrnav_eItemType_Enum,
......@@ -181,6 +187,8 @@ class AttrNav {
Graph *graph;
brow_tObject last_selected;
grow_tObject last_selected_id;
attr_eFilterType filter_type;
char filter_pattern[80];
void (*message_cb)( void *, int, char, const char *);
void (*change_value_cb)( void *);
int (*get_subgraph_info_cb)( void *, char *, attr_sItem **, int *);
......@@ -204,6 +212,7 @@ class AttrNav {
void refresh_objects( unsigned int type);
void object_open_check( AItemObject *item, grow_tObject *open_list, int *open_type, int open_cnt);
brow_tObject gobject_to_bobject( grow_tObject gobject);
void filter( int type, char *pattern);
virtual void set_inputfocus() {}
virtual void trace_start() {}
static int init_brow_cb( FlowCtx *fctx, void *client_data);
......
......@@ -1308,6 +1308,7 @@ void Graph::select_all_objects()
}
object_p++;
}
refresh_objects( attr_mRefresh_Select);
}
void Graph::select_object( grow_tObject o)
......@@ -1367,6 +1368,7 @@ void Graph::select_nextobject( glow_eDirection dir)
if ( !grow_IsVisible( grow->ctx, next, glow_eVisible_Partial))
grow_CenterObject( grow->ctx, next);
}
refresh_objects( attr_mRefresh_Select);
}
int Graph::get_selected_object( grow_tObject *object)
......@@ -2385,8 +2387,10 @@ void Graph::reset_mode( bool select_clear, bool keep)
grow_SetMoveRestrictions( grow->ctx, glow_eMoveRestriction_No, 0, 0, NULL);
grow_SetScaleEqual( grow->ctx, 0);
keep_mode = keep;
if ( select_clear)
if ( select_clear) {
grow_SelectClear( grow->ctx);
refresh_objects( attr_mRefresh_Select);
}
}
//
// Callbacks from grow
......
......@@ -121,6 +121,8 @@ static int graph_customcolor_func( void *client_data,
void *client_flag);
static int graph_search_func( void *client_data,
void *client_flag);
static int graph_filter_func( void *client_data,
void *client_flag);
dcli_tCmdTable graph_command_table[] = {
{
......@@ -253,6 +255,11 @@ dcli_tCmdTable graph_command_table[] = {
&graph_search_func,
{"dcli_arg", "dcli_arg2", "/NAME", ""}
},
{
"FILTER",
&graph_filter_func,
{"dcli_arg", "/RESET", "/TYPE", "/PATTERN", ""}
},
{"",}};
static void graph_store_graph( Graph *graph)
......@@ -480,6 +487,57 @@ static int graph_search_func(void *client_data,
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,
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