Commit 1ca88cff authored by Christoffer Ackelman's avatar Christoffer Ackelman

Simplified WB Uted slightly.

parent c8101b1e
......@@ -155,85 +155,11 @@ void WUtedGtk::commandchanged(GtkWidget* w, gpointer data)
{
}
void WUtedGtk::activate_present1(GtkWidget* w, gpointer data)
void WUtedGtk::activate_present(GtkWidget* w, gpointer data)
{
WUted* uted = (WUted*)data;
uted->message("");
uted->present_sts[0]
= (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
}
void WUtedGtk::activate_present2(GtkWidget* w, gpointer data)
{
WUted* uted = (WUted*)data;
uted->message("");
uted->present_sts[1]
= (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
}
void WUtedGtk::activate_present3(GtkWidget* w, gpointer data)
{
WUted* uted = (WUted*)data;
uted->message("");
uted->present_sts[2]
= (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
}
void WUtedGtk::activate_present4(GtkWidget* w, gpointer data)
{
WUted* uted = (WUted*)data;
uted->message("");
uted->present_sts[3]
= (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
}
void WUtedGtk::activate_present5(GtkWidget* w, gpointer data)
{
WUted* uted = (WUted*)data;
uted->message("");
uted->present_sts[4]
= (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
}
void WUtedGtk::activate_present6(GtkWidget* w, gpointer data)
{
WUted* uted = (WUted*)data;
uted->message("");
uted->present_sts[5]
= (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
}
void WUtedGtk::activate_present7(GtkWidget* w, gpointer data)
{
WUted* uted = (WUted*)data;
uted->message("");
uted->present_sts[6]
= (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
}
void WUtedGtk::activate_present8(GtkWidget* w, gpointer data)
{
WUted* uted = (WUted*)data;
uted->message("");
uted->present_sts[7]
= (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
}
void WUtedGtk::activate_present9(GtkWidget* w, gpointer data)
{
WUted* uted = (WUted*)data;
uted->message("");
uted->present_sts[8]
= (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
}
void WUtedGtk::activate_present10(GtkWidget* w, gpointer data)
{
WUted* uted = (WUted*)data;
uted->message("");
uted->present_sts[9]
= (int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
}
//
......@@ -455,25 +381,25 @@ WUtedGtk::WUtedGtk(void* wu_parent_ctx, GtkWidget* wu_parent_wid,
}
g_signal_connect(
widgets.present[0], "toggled", G_CALLBACK(activate_present1), this);
widgets.present[0], "toggled", G_CALLBACK(activate_present), this);
g_signal_connect(
widgets.present[1], "toggled", G_CALLBACK(activate_present2), this);
widgets.present[1], "toggled", G_CALLBACK(activate_present), this);
g_signal_connect(
widgets.present[2], "toggled", G_CALLBACK(activate_present3), this);
widgets.present[2], "toggled", G_CALLBACK(activate_present), this);
g_signal_connect(
widgets.present[3], "toggled", G_CALLBACK(activate_present4), this);
widgets.present[3], "toggled", G_CALLBACK(activate_present), this);
g_signal_connect(
widgets.present[4], "toggled", G_CALLBACK(activate_present5), this);
widgets.present[4], "toggled", G_CALLBACK(activate_present), this);
g_signal_connect(
widgets.present[5], "toggled", G_CALLBACK(activate_present6), this);
widgets.present[5], "toggled", G_CALLBACK(activate_present), this);
g_signal_connect(
widgets.present[6], "toggled", G_CALLBACK(activate_present7), this);
widgets.present[6], "toggled", G_CALLBACK(activate_present), this);
g_signal_connect(
widgets.present[7], "toggled", G_CALLBACK(activate_present8), this);
widgets.present[7], "toggled", G_CALLBACK(activate_present), this);
g_signal_connect(
widgets.present[8], "toggled", G_CALLBACK(activate_present9), this);
widgets.present[8], "toggled", G_CALLBACK(activate_present), this);
g_signal_connect(
widgets.present[9], "toggled", G_CALLBACK(activate_present10), this);
widgets.present[9], "toggled", G_CALLBACK(activate_present), this);
// Command label
GtkWidget* cmdlabel = gtk_label_new("Command");
......@@ -555,6 +481,11 @@ void WUtedGtk::get_value(int idx, char* str, int len)
g_free(value);
}
bool WUtedGtk::get_present(int idx)
{
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets.present[idx]));
}
//
// Hide all qualifiers.
//
......@@ -566,7 +497,6 @@ void WUtedGtk::reset_qual()
g_object_set(widgets.qualifier[i], "visible", FALSE, NULL);
g_object_set(widgets.value[i], "visible", FALSE, NULL);
g_object_set(widgets.present[i], "visible", FALSE, NULL);
present_sts[i] = 0;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets.present[i]), FALSE);
gtk_editable_delete_text(GTK_EDITABLE(widgets.value[i]), 0, -1);
}
......
......@@ -84,6 +84,7 @@ public:
void configure_quals(const char* label);
void enable_entries(int enable);
void get_value(int idx, char* str, int len);
bool get_present(int idx);
void questionbox(char* question_title, char* question_text,
void (*yes_procedure)(WUted*), void (*no_procedure)(WUted*),
void (*cancel_procedure)(WUted*), pwr_tBoolean cancel);
......@@ -101,16 +102,7 @@ public:
static void activate_show_cmd(GtkWidget* w, gpointer data);
static void activate_cmd_wind(GtkWidget* w, gpointer data);
static void commandchanged(GtkWidget* w, gpointer data);
static void activate_present1(GtkWidget* w, gpointer data);
static void activate_present2(GtkWidget* w, gpointer data);
static void activate_present3(GtkWidget* w, gpointer data);
static void activate_present4(GtkWidget* w, gpointer data);
static void activate_present5(GtkWidget* w, gpointer data);
static void activate_present6(GtkWidget* w, gpointer data);
static void activate_present7(GtkWidget* w, gpointer data);
static void activate_present8(GtkWidget* w, gpointer data);
static void activate_present9(GtkWidget* w, gpointer data);
static void activate_present10(GtkWidget* w, gpointer data);
static void activate_present(GtkWidget* w, gpointer data);
static void qbox_cr(GtkWidget* w, gpointer data);
static void qbox_yes_cb(GtkWidget* w, gpointer data);
static void qbox_no_cb(GtkWidget* w, gpointer data);
......
......@@ -263,65 +263,10 @@ void WUtedMotif::commandchanged(
}
}
void WUtedMotif::activate_present1(
void WUtedMotif::activate_present(
Widget w, WUted* uted, XmToggleButtonCallbackStruct* data)
{
uted->message("");
uted->present_sts[0] = data->set;
}
void WUtedMotif::activate_present2(
Widget w, WUted* uted, XmToggleButtonCallbackStruct* data)
{
uted->message("");
uted->present_sts[1] = data->set;
}
void WUtedMotif::activate_present3(
Widget w, WUted* uted, XmToggleButtonCallbackStruct* data)
{
uted->message("");
uted->present_sts[2] = data->set;
}
void WUtedMotif::activate_present4(
Widget w, WUted* uted, XmToggleButtonCallbackStruct* data)
{
uted->message("");
uted->present_sts[3] = data->set;
}
void WUtedMotif::activate_present5(
Widget w, WUted* uted, XmToggleButtonCallbackStruct* data)
{
uted->message("");
uted->present_sts[4] = data->set;
}
void WUtedMotif::activate_present6(
Widget w, WUted* uted, XmToggleButtonCallbackStruct* data)
{
uted->message("");
uted->present_sts[5] = data->set;
}
void WUtedMotif::activate_present7(
Widget w, WUted* uted, XmToggleButtonCallbackStruct* data)
{
uted->message("");
uted->present_sts[6] = data->set;
}
void WUtedMotif::activate_present8(
Widget w, WUted* uted, XmToggleButtonCallbackStruct* data)
{
uted->message("");
uted->present_sts[7] = data->set;
}
void WUtedMotif::activate_present9(
Widget w, WUted* uted, XmToggleButtonCallbackStruct* data)
{
uted->message("");
uted->present_sts[8] = data->set;
}
void WUtedMotif::activate_present10(
Widget w, WUted* uted, XmToggleButtonCallbackStruct* data)
{
uted->message("");
uted->present_sts[9] = data->set;
}
void WUtedMotif::create_label(Widget w, WUted* uted, XmAnyCallbackStruct* data)
......@@ -656,43 +601,43 @@ WUtedMotif::WUtedMotif(void* wu_parent_ctx, Widget wu_parent_wid,
{ (char*)"uted_create_timevalue", (caddr_t)create_timevalue },
{ (char*)"uted_create_qualifier1", (caddr_t)create_qualifier1 },
{ (char*)"uted_create_value1", (caddr_t)create_value1 },
{ (char*)"uted_activate_present1", (caddr_t)activate_present1 },
{ (char*)"uted_activate_present1", (caddr_t)activate_present },
{ (char*)"uted_create_present1", (caddr_t)create_present1 },
{ (char*)"uted_create_qualifier2", (caddr_t)create_qualifier2 },
{ (char*)"uted_create_value2", (caddr_t)create_value2 },
{ (char*)"uted_activate_present2", (caddr_t)activate_present2 },
{ (char*)"uted_activate_present2", (caddr_t)activate_present },
{ (char*)"uted_create_present2", (caddr_t)create_present2 },
{ (char*)"uted_create_qualifier3", (caddr_t)create_qualifier3 },
{ (char*)"uted_create_value3", (caddr_t)create_value3 },
{ (char*)"uted_activate_present3", (caddr_t)activate_present3 },
{ (char*)"uted_activate_present3", (caddr_t)activate_present },
{ (char*)"uted_create_present3", (caddr_t)create_present3 },
{ (char*)"uted_create_qualifier4", (caddr_t)create_qualifier4 },
{ (char*)"uted_create_value4", (caddr_t)create_value4 },
{ (char*)"uted_activate_present4", (caddr_t)activate_present4 },
{ (char*)"uted_activate_present4", (caddr_t)activate_present },
{ (char*)"uted_create_present4", (caddr_t)create_present4 },
{ (char*)"uted_create_qualifier5", (caddr_t)create_qualifier5 },
{ (char*)"uted_create_value5", (caddr_t)create_value5 },
{ (char*)"uted_activate_present5", (caddr_t)activate_present5 },
{ (char*)"uted_activate_present5", (caddr_t)activate_present },
{ (char*)"uted_create_present5", (caddr_t)create_present5 },
{ (char*)"uted_create_qualifier6", (caddr_t)create_qualifier6 },
{ (char*)"uted_create_value6", (caddr_t)create_value6 },
{ (char*)"uted_activate_present6", (caddr_t)activate_present6 },
{ (char*)"uted_activate_present6", (caddr_t)activate_present },
{ (char*)"uted_create_present6", (caddr_t)create_present6 },
{ (char*)"uted_create_qualifier7", (caddr_t)create_qualifier7 },
{ (char*)"uted_create_value7", (caddr_t)create_value7 },
{ (char*)"uted_activate_present7", (caddr_t)activate_present7 },
{ (char*)"uted_activate_present7", (caddr_t)activate_present },
{ (char*)"uted_create_present7", (caddr_t)create_present7 },
{ (char*)"uted_create_qualifier8", (caddr_t)create_qualifier8 },
{ (char*)"uted_create_value8", (caddr_t)create_value8 },
{ (char*)"uted_activate_present8", (caddr_t)activate_present8 },
{ (char*)"uted_activate_present8", (caddr_t)activate_present },
{ (char*)"uted_create_present8", (caddr_t)create_present8 },
{ (char*)"uted_create_qualifier9", (caddr_t)create_qualifier9 },
{ (char*)"uted_create_value9", (caddr_t)create_value9 },
{ (char*)"uted_activate_present9", (caddr_t)activate_present9 },
{ (char*)"uted_activate_present9", (caddr_t)activate_present },
{ (char*)"uted_create_present9", (caddr_t)create_present9 },
{ (char*)"uted_create_qualifier10", (caddr_t)create_qualifier10 },
{ (char*)"uted_create_value10", (caddr_t)create_value10 },
{ (char*)"uted_activate_present10", (caddr_t)activate_present10 },
{ (char*)"uted_activate_present10", (caddr_t)activate_present },
{ (char*)"uted_create_present10", (caddr_t)create_present10 },
{ (char*)"uted_activate_helputils", (caddr_t)activate_helputils },
{ (char*)"uted_activate_helppwr_plc", (caddr_t)activate_helppwr_plc },
......@@ -832,6 +777,11 @@ void WUtedMotif::get_value(int idx, char* str, int len)
XtFree(value);
}
bool WUtedMotif::get_present(int idx)
{
return XmToggleButtonGetState(widgets.present[idx]);
}
//
// Hide all qualifiers.
//
......@@ -844,7 +794,6 @@ void WUtedMotif::reset_qual()
XtUnmanageChild(widgets.qualifier[i]);
XtUnmanageChild(widgets.value[i]);
XtUnmanageChild(widgets.present[i]);
present_sts[i] = 0;
XmToggleButtonSetState(widgets.present[i], 0, 0);
XmTextSetString(widgets.value[i], (char*)"");
}
......
......@@ -84,6 +84,7 @@ public:
void configure_quals(const char* label);
void enable_entries(int enable);
void get_value(int idx, char* str, int len);
bool get_present(int idx);
void questionbox(char* question_title, char* question_text,
void (*yes_procedure)(WUted*), void (*no_procedure)(WUted*),
void (*cancel_procedure)(WUted*), pwr_tBoolean cancel);
......@@ -113,25 +114,7 @@ public:
Widget w, WUted* utedctx, XmToggleButtonCallbackStruct* data);
static void commandchanged(
Widget w, WUted* utedctx, XmCommandCallbackStruct* data);
static void activate_present1(
Widget w, WUted* utedctx, XmToggleButtonCallbackStruct* data);
static void activate_present2(
Widget w, WUted* utedctx, XmToggleButtonCallbackStruct* data);
static void activate_present3(
Widget w, WUted* utedctx, XmToggleButtonCallbackStruct* data);
static void activate_present4(
Widget w, WUted* utedctx, XmToggleButtonCallbackStruct* data);
static void activate_present5(
Widget w, WUted* utedctx, XmToggleButtonCallbackStruct* data);
static void activate_present6(
Widget w, WUted* utedctx, XmToggleButtonCallbackStruct* data);
static void activate_present7(
Widget w, WUted* utedctx, XmToggleButtonCallbackStruct* data);
static void activate_present8(
Widget w, WUted* utedctx, XmToggleButtonCallbackStruct* data);
static void activate_present9(
Widget w, WUted* utedctx, XmToggleButtonCallbackStruct* data);
static void activate_present10(
static void activate_present(
Widget w, WUted* utedctx, XmToggleButtonCallbackStruct* data);
static void create_label(Widget w, WUted* utedctx, XmAnyCallbackStruct* data);
static void create_adb(Widget w, WUted* utedctx, XmAnyCallbackStruct* data);
......
......@@ -72,7 +72,6 @@ void WUtedQt::remove_command_window()
void WUtedQtWidget::closeEvent(QCloseEvent* event)
{
debug_print("WUtedQtWidget::closeEvent\n");
delete uted;
QWidget::closeEvent(event);
}
......@@ -137,8 +136,6 @@ void WUtedQtWidget::commandchanged()
void WUtedQtWidget::activate_present(bool set)
{
uted->message("");
int idx = ((QAction*)sender())->data().toInt();
uted->present_sts[idx] = set;
}
void WUtedQt::update_title(int editmode)
......@@ -154,7 +151,6 @@ WUtedQt::WUtedQt(void* wu_parent_ctx, QWidget* wu_parent_wid,
wu_editmode, wu_quit_cb, status)
{
toplevel = new WUtedQtWidget(this, wu_parent_wid);
toplevel->setToolTip(fl("wb_uted widget"));
toplevel->setMinimumSize(800, 400);
toplevel->setWindowTitle(fl("Wb Utilities"));
toplevel->setAttribute(Qt::WA_DeleteOnClose);
......@@ -305,7 +301,6 @@ WUtedQt::WUtedQt(void* wu_parent_ctx, QWidget* wu_parent_wid,
// Destroys the widget and frees allocated memory for the context.
WUtedQt::~WUtedQt()
{
debug_print("WUtedQt::~WUtedQt\n");
if (quit_cb) {
(quit_cb)(parent_ctx);
}
......@@ -317,6 +312,11 @@ void WUtedQt::get_value(int idx, char* str, int len)
strncpy(str, qPrintableLatin1(value[idx]->text()), len);
}
bool WUtedQt::get_present(int idx)
{
return present[idx]->isChecked();
}
// Hide all qualifiers.
void WUtedQt::reset_qual()
{
......@@ -326,7 +326,6 @@ void WUtedQt::reset_qual()
qualifier[i]->setVisible(false);
value[i]->setVisible(false);
present[i]->setVisible(false);
present_sts[i] = 0;
present[i]->setChecked(false);
value[i]->setText("");
}
......
......@@ -71,6 +71,7 @@ public:
void configure_quals(const char* label);
void enable_entries(int enable);
void get_value(int idx, char* str, int len);
bool get_present(int idx);
void questionbox(char* question_title, char* question_text,
void (*yes_procedure)(WUted*), void (*no_procedure)(WUted*),
void (*cancel_procedure)(WUted*), pwr_tBoolean cancel);
......
......@@ -477,7 +477,6 @@ WdaQt::WdaQt(QWidget* wa_parent_wid, void* wa_parent_ctx,
int sts;
toplevel = new WdaQtWidget(this, wa_parent_wid);
toplevel->setToolTip(fl("wb_wda widget"));
toplevel->setFixedSize(700, 700);
toplevel->setWindowTitle(fl("Spreadsheet Editor"));
toplevel->setAttribute(Qt::WA_DeleteOnClose);
......
......@@ -214,7 +214,6 @@ WGeQt::WGeQt(QWidget* wge_parent_wid, void* wge_parent_ctx, char* wge_name,
// Qt
toplevel = new WGeQtWidget(this, wge_parent_wid);
toplevel->setToolTip(fl("wb_wge widget"));
toplevel->setMinimumSize(window_width, window_height);
toplevel->setWindowTitle(fl(title));
toplevel->setAttribute(Qt::WA_DeleteOnClose);
......
......@@ -168,7 +168,6 @@ WRevQt::WRevQt(
int sts;
toplevel = new WRevQtWidget(this, wa_parent_wid);
toplevel->setToolTip(fl("wb_wrev widget"));
toplevel->setMinimumSize(700, 300);
toplevel->setWindowTitle(fl("Revisions"));
toplevel->setAttribute(Qt::WA_DeleteOnClose);
......
......@@ -373,7 +373,7 @@ int WUted::execute(int show)
qual_ptr = &commands[index].qualifier[0];
while (qual_ptr->qual[0] != 0) {
if (qual_ptr->present) {
if (present_sts[i]) {
if (get_present(i)) {
if (qual_ptr->type == UTED_QUAL_QUAL) {
strcat(cmd, "/");
strcat(cmd, qual_ptr->qual);
......
......@@ -83,7 +83,6 @@ public:
void* parent_ctx;
char name[80];
int current_index;
int present_sts[UTED_QUALS];
int batch_sts;
ldh_tWBContext ldhwb;
ldh_tSesContext ldhses;
......@@ -131,9 +130,8 @@ public:
virtual void enable_entries(int enable)
{
}
virtual void get_value(int idx, char* str, int len)
{
}
virtual void get_value(int idx, char* str, int len) = 0;
virtual bool get_present(int idx) = 0;
virtual void questionbox(char* question_title, char* question_text,
void (*yes_procedure)(WUted*), void (*no_procedure)(WUted*),
void (*cancel_procedure)(WUted*), pwr_tBoolean cancel)
......
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