Commit 11ef0ffc authored by Claes Sjofors's avatar Claes Sjofors

Ge editor, search object added, and link error in a ge graph also prints object name

parent bf62527f
......@@ -5127,6 +5127,7 @@ save <link>gecmd_save
scale <link>gecmd_scale
<t>scale currentobject <link>gecmd_scale_current
<t>scale selectedobject <link>gecmd_scale_selected
search object <link>gecmd_search_object
select <link>gecmd_select
<t>select currentobject <link>gecmd_select_currentobject
<t>select clear <link>gecmd_select_clear
......@@ -5488,6 +5489,24 @@ Scale the selected object.
/y <t>y coordinate for the reference point of the scaling.
</topic>
<topic>gecmd_search_object
search object
Search for an object.
The found object is selected after the search.
<b>Syntax
<c>ge> search object /name=
/name <t>Object name.
</topic>
<topic>gecmd_select_clear <style>function
select clear
Clear the select list.
</topic>
<topic>gecmd_select <style>function
select
</topic>
......
......@@ -5080,6 +5080,7 @@ save <link>gecmd_save
scale <link>gecmd_scale
<t>scale currentobject <link>gecmd_scale_current
<t>scale selectedobject <link>gecmd_scale_selected
search object <link>gecmd_search_object
select <link>gecmd_select
<t>select currentobject <link>gecmd_select_currentobject
<t>select clear <link>gecmd_select_clear
......@@ -5409,6 +5410,18 @@ Skalar om utvalt objekt.
/y <t>y-koordinat för skalningens referenspunkt.
</topic>
<topic>gecmd_search_object
search object
Sök efter ett objekt.
När sökningen är gjord väljs det hittade objektet ut.
<b>Syntax
<c>ge> search object /name=
/name <t>Objeksnamn.
</topic>
<topic>gecmd_select <style>function
select
</topic>
......
......@@ -414,6 +414,11 @@ void GeGtk::activate_change_name(GtkWidget *w, gpointer gectx)
((Ge *)gectx)->activate_change_name();
}
void GeGtk::activate_search_object(GtkWidget *w, gpointer gectx)
{
((Ge *)gectx)->activate_search_object();
}
void GeGtk::activate_preview_start(GtkWidget *w, gpointer gectx)
{
((Ge *)gectx)->activate_preview_start();
......@@ -1875,7 +1880,11 @@ GeGtk::GeGtk( void *x_parent_ctx,
g_signal_connect( edit_change_name, "activate",
G_CALLBACK(activate_change_name), this);
GtkWidget *edit_objattr_store = gtk_menu_item_new_with_mnemonic( "O_bject Attributes Store");
GtkWidget *edit_search_object = gtk_menu_item_new_with_mnemonic( "_Search Object");
g_signal_connect( edit_search_object, "activate",
G_CALLBACK(activate_search_object), this);
GtkWidget *edit_objattr_store = gtk_menu_item_new_with_mnemonic( "_Object Attributes Store");
g_signal_connect( edit_objattr_store, "activate",
G_CALLBACK(activate_objattr_store), this);
gtk_widget_add_accelerator( edit_objattr_store, "activate", accel_g,
......@@ -1905,6 +1914,7 @@ GeGtk::GeGtk( void *x_parent_ctx,
gtk_menu_shell_append(GTK_MENU_SHELL(edit_menu), edit_create_subgraph);
gtk_menu_shell_append(GTK_MENU_SHELL(edit_menu), edit_change_text);
gtk_menu_shell_append(GTK_MENU_SHELL(edit_menu), edit_change_name);
gtk_menu_shell_append(GTK_MENU_SHELL(edit_menu), edit_search_object);
gtk_menu_shell_append(GTK_MENU_SHELL(edit_menu), edit_objattr_store);
gtk_menu_shell_append(GTK_MENU_SHELL(edit_menu), edit_objattr_recall);
gtk_menu_shell_append(GTK_MENU_SHELL(edit_menu), edit_command);
......
......@@ -131,6 +131,7 @@ class GeGtk : public Ge {
static void activate_create_subgraph(GtkWidget *w, gpointer gectx);
static void activate_change_text( GtkWidget *w, gpointer gectx);
static void activate_change_name( GtkWidget *w, gpointer gectx);
static void activate_search_object( GtkWidget *w, gpointer gectx);
static void activate_preview_start( GtkWidget *w, gpointer gectx);
static void activate_preview_stop( GtkWidget *w, gpointer gectx);
static void activate_delete( GtkWidget *w, gpointer gectx);
......
......@@ -762,6 +762,21 @@ void Ge::activate_change_name()
graph->change_select_name();
}
void Ge::search_object_cb( void *ge_ctx, void *data, char *name)
{
Ge *gectx = (Ge *)ge_ctx;
int sts;
sts = gectx->graph->search_object( name);
if ( EVEN(sts))
gectx->message( 'E', "No such object");
}
void Ge::activate_search_object()
{
wow->CreateInputDialog( this, "Search Object", "Object name", search_object_cb, 0, 80, 0, 0);
}
void Ge::activate_preview_start()
{
int sts;
......
......@@ -160,6 +160,7 @@ class Ge {
void activate_change_text();
void activate_change_name();
void activate_search_object();
void activate_preview_start();
void activate_preview_stop();
void activate_delete();
......@@ -332,6 +333,7 @@ class Ge {
static int create_modal_dialog_cb( void *ge_ctx, const char *title, const char *text,
const char *button1, const char *button2, const char *button3,
const char *image);
static void search_object_cb( void *ge_ctx, void *data, char *name);
};
#endif
This diff is collapsed.
......@@ -4990,7 +4990,8 @@ int Graph::get_reference_name( char *name, char *tname)
}
int Graph::ref_object_info( glow_eCycle cycle, char *name, void **data,
pwr_tSubid *subid, unsigned int size, bool now)
pwr_tSubid *subid, unsigned int size, grow_tObject object,
bool now)
{
pwr_tAName aname;
pwr_tStatus sts;
......@@ -5005,7 +5006,7 @@ int Graph::ref_object_info( glow_eCycle cycle, char *name, void **data,
if ( !now) {
GraphRef gr( aname, subid, size, cycle, data);
GraphRef gr( aname, subid, size, cycle, object, data);
reflist.push_back(gr);
}
else {
......@@ -5069,9 +5070,13 @@ int Graph::ref_object_info_all()
if ( reflist[i].m_cycle == cycle[j]) {
*reflist[i].m_data = oref[refcnt].adrs;
*reflist[i].m_id = refid[refcnt];
if ( EVEN(sts) && cdh_RefIdIsNull( refid[refcnt]))
printf( "** %s\n", reflist[i].m_name);
if ( EVEN(sts) && cdh_RefIdIsNull( refid[refcnt])) {
char oname[80] = "";
if ( reflist[i].m_object != 0)
grow_GetObjectName( reflist[i].m_object, oname);
printf( "** %s, %s\n", oname, reflist[i].m_name);
}
refcnt++;
}
}
......@@ -5533,6 +5538,24 @@ int Graph::get_colortheme_colors( char *file, double **colors, int *size) {
return grow_GetColorThemeColors( file, colors, size);
}
int Graph::search_object( char *name)
{
int sts;
grow_tObject object;
grow_SelectClear( grow->ctx);
sts = grow_FindObjectByName( grow->ctx, name, &object);
if ( EVEN(sts)) return sts;
grow_SelectClear( grow->ctx);
grow_SetHighlight( object, 1);
grow_SelectInsert( grow->ctx, object);
if ( !grow_IsVisible( grow->ctx, object, glow_eVisible_Partial))
grow_CenterObject( grow->ctx, object);
return 1;
}
static void graph_free_dyn( grow_tObject object)
{
......
......@@ -347,14 +347,15 @@ class GraphGbl {
class GraphRef {
public:
GraphRef( pwr_tAName name, pwr_tRefId *id, int size, glow_eCycle cycle, void **data) :
m_id(id), m_size(size), m_cycle(cycle), m_data(data) {
GraphRef( pwr_tAName name, pwr_tRefId *id, int size, glow_eCycle cycle, grow_tObject object, void **data) :
m_id(id), m_size(size), m_cycle(cycle), m_object(object), m_data(data) {
strcpy( m_name, name);
}
pwr_tAName m_name;
pwr_tRefId *m_id;
int m_size;
glow_eCycle m_cycle;
grow_tObject m_object;
void **m_data;
};
......@@ -1267,7 +1268,8 @@ class Graph {
\param size Size of the attribute.
*/
int ref_object_info( glow_eCycle cycle, char *name, void **data,
pwr_tSubid *subid, unsigned int size, bool now = false);
pwr_tSubid *subid, unsigned int size, grow_tObject object,
bool now = false);
//! Subscribe all stored subscriptions.
int ref_object_info_all();
......@@ -1376,6 +1378,12 @@ class Graph {
*/
int export_plcfo( char *filename);
//! Search on object.
/*!
\param name Object name.
*/
int search_object( char *name);
//! Store in journal file.
int journal_store( journal_eAction a, grow_tObject o) {
if (journal) return journal->store( a, o);
......
......@@ -119,6 +119,8 @@ static int graph_build_func( void *client_data,
void *client_flag);
static int graph_customcolor_func( void *client_data,
void *client_flag);
static int graph_search_func( void *client_data,
void *client_flag);
dcli_tCmdTable graph_command_table[] = {
{
......@@ -246,6 +248,11 @@ dcli_tCmdTable graph_command_table[] = {
&graph_customcolor_func,
{"dcli_arg", "/FILE", "/LIGHTNESS", "/ISDEFAULT", ""}
},
{
"SEARCH",
&graph_search_func,
{"dcli_arg", "dcli_arg2", "/NAME", ""}
},
{"",}};
static void graph_store_graph( Graph *graph)
......@@ -440,6 +447,39 @@ static int graph_customcolor_func(void *client_data,
return GE__SUCCESS;
}
static int graph_search_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, "OBJECT", strlen( arg1_str)) == 0) {
// Command is "SEARCH OBJECT"
char name_str[80];
sts = dcli_get_qualifier( "/NAME", name_str, sizeof(name_str));
if ( EVEN(sts))
sts = dcli_get_qualifier( "dcli_arg2", name_str, sizeof(name_str));
if ( EVEN( sts)) {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
sts = graph->search_object( name_str);
if ( EVEN( sts))
graph->message('E', "No such object");
}
else {
graph->message('E', "Syntax error");
return GE__SYNTAX;
}
return GE__SUCCESS;
}
static int graph_exit_func(void *client_data,
void *client_flag)
{
......
......@@ -719,13 +719,13 @@ static int graph_object_dx( Graph *graph, pwr_sAttrRef *arp)
strcat( aname, ".ConvMask1");
graph->ref_object_info( glow_eCycle_Slow, aname, (void **)&od->conv_p, &od->conv_subid,
sizeof(pwr_tBoolean), true);
sizeof(pwr_tBoolean), 0, true);
strcpy( aname, card_name);
strcat( aname, ".InvMask1");
graph->ref_object_info( glow_eCycle_Slow, aname, (void **)&od->inv_p, &od->inv_subid,
sizeof(pwr_tBoolean), true);
sizeof(pwr_tBoolean), 0, true);
od->mask = 1 << chan_idx;
}
......@@ -734,13 +734,13 @@ static int graph_object_dx( Graph *graph, pwr_sAttrRef *arp)
strcat( aname, ".ConvMask2");
graph->ref_object_info( glow_eCycle_Slow, aname, (void **)&od->conv_p, &od->conv_subid,
sizeof(pwr_tBoolean), true);
sizeof(pwr_tBoolean), 0, true);
strcpy( aname, card_name);
strcat( aname, ".InvMask2");
graph->ref_object_info( glow_eCycle_Slow, aname, (void **)&od->inv_p, &od->inv_subid,
sizeof(pwr_tBoolean), true);
sizeof(pwr_tBoolean), 0, true);
od->mask = 1 << (chan_idx - 16);
}
......@@ -762,13 +762,13 @@ static int graph_object_dx( Graph *graph, pwr_sAttrRef *arp)
strcat( aname, ".TestMask1");
graph->ref_object_info( glow_eCycle_Slow, aname, (void **)&od->test_p, &od->test_subid,
sizeof(pwr_tBoolean), true);
sizeof(pwr_tBoolean), 0, true);
strcpy( aname, card_name);
strcat( aname, ".InvMask1");
graph->ref_object_info( glow_eCycle_Slow, aname, (void **)&od->inv_p, &od->inv_subid,
sizeof(pwr_tBoolean), true);
sizeof(pwr_tBoolean), 0, true);
od->mask = 1 << chan_idx;
}
......@@ -777,13 +777,13 @@ static int graph_object_dx( Graph *graph, pwr_sAttrRef *arp)
strcat( aname, ".TestMask2");
graph->ref_object_info( glow_eCycle_Slow, aname, (void **)&od->test_p, &od->test_subid,
sizeof(pwr_tBoolean), true);
sizeof(pwr_tBoolean), 0, true);
strcpy( aname, card_name);
strcat( aname, ".InvMask2");
graph->ref_object_info( glow_eCycle_Slow, aname, (void **)&od->inv_p, &od->inv_subid,
sizeof(pwr_tBoolean), true);
sizeof(pwr_tBoolean), 0, true);
od->mask = 1 << (chan_idx - 16);
}
......@@ -805,21 +805,21 @@ static int graph_object_dx( Graph *graph, pwr_sAttrRef *arp)
strcpy( aname, chan_name);
strcat( aname, ".ConversionOn");
graph->ref_object_info( glow_eCycle_Slow, aname, (void **)&od->conv_p, &od->conv_subid,
sizeof(pwr_tBoolean), true);
sizeof(pwr_tBoolean), 0, true);
}
strcpy( aname, chan_name);
strcat( aname, ".InvertOn");
graph->ref_object_info( glow_eCycle_Slow, aname, (void **)&od->inv_p, &od->inv_subid,
sizeof(pwr_tBoolean), true);
sizeof(pwr_tBoolean), 0, true);
if ( od->cid == pwr_cClass_Do) {
strcpy( aname, chan_name);
strcat( aname, ".TestOn");
graph->ref_object_info( glow_eCycle_Slow, aname, (void **)&od->test_p, &od->test_subid,
sizeof(pwr_tBoolean), true);
sizeof(pwr_tBoolean), 0, true);
if ( od->local_conv_p)
*od->local_conv_p = 1;
......
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