Commit 97cbbe7d authored by Claes Sjofors's avatar Claes Sjofors

Wb history log, recall in input entry added

parent 0698cb78
......@@ -1347,9 +1347,17 @@ static gboolean modaldia_keypress_cb( GtkWidget *w, GdkEvent *event, gpointer da
return sts;
}
static gboolean modaldia_activate_cb( GtkWidget *w, gpointer data)
{
*(int *)data = wow_eModalDialogReturn_ReturnPressed;
gtk_main_quit();
return FALSE;
}
wow_sModalInputDialog *CoWowGtk::CreateModalInputDialog( const char *title, const char *text, const char *button1,
const char *button2, const char *button3,
const char *image, int input_length)
const char *image, int input_length,
CoWowRecall *recall)
{
int status = 0;
GtkWidget *image_w;
......@@ -1380,9 +1388,18 @@ wow_sModalInputDialog *CoWowGtk::CreateModalInputDialog( const char *title, cons
NULL);
}
GtkWidget *textinput = gtk_entry_new_with_max_length( input_length);
g_signal_connect( textinput, "key-press-event",
G_CALLBACK(modaldia_keypress_cb), &status);
GtkWidget *textinput;
if ( !recall) {
textinput = gtk_entry_new_with_max_length( input_length);
g_signal_connect( textinput, "key-press-event",
G_CALLBACK(modaldia_keypress_cb), &status);
}
else {
CoWowEntryGtk *entry = new CoWowEntryGtk( recall);
textinput = entry->widget();
g_signal_connect( textinput, "activate",
G_CALLBACK(modaldia_activate_cb), &status);
}
GtkWidget *hboxtext = gtk_hbox_new( FALSE, 0);
gtk_box_pack_start( GTK_BOX(hboxtext), image_w, FALSE, FALSE, 15);
......
......@@ -147,7 +147,8 @@ class CoWowGtk : public CoWow {
wow_sModalInputDialog *CreateModalInputDialog( const char *title, const char *text,
const char *button1, const char *button2,
const char *button3, const char *image,
int input_length);
int input_length,
CoWowRecall *recall = 0);
int DisplayWarranty();
void DisplayLicense();
pwr_tStatus CreateMenuItem( const char *name, void *menu, int pixmap, int append, void *w);
......
......@@ -68,7 +68,8 @@ void CoLog::log( const char *category, const char *str, const char *cmt, unsigne
else if ( m_level == 1 && m_wow && opt & log_mOption_Comment) {
wow_sModalInputDialog *ret;
ret = m_wow->CreateModalInputDialog( "Log Comment", "Comment", "Ok", "Cancel", 0, 0, sizeof(comment)-1);
ret = m_wow->CreateModalInputDialog( "Log Comment", "Comment", "Ok", "Cancel", 0, 0, sizeof(comment)-1,
m_recall);
if ( ret->status == wow_eModalDialogReturn_Button1 ||
ret->status == wow_eModalDialogReturn_ReturnPressed)
strncpy( comment, ret->input_str, sizeof(comment));
......
......@@ -41,6 +41,7 @@
#include "pwr.h"
#include "co_dcli.h"
#include "co_syi.h"
#include "cow_wow.h"
typedef enum {
log_mOption_Comment = 1
......@@ -57,13 +58,19 @@ class CoLog
CoWow *m_wow;
static CoLog *m_default_log;
int m_level;
CoWowRecall *m_recall;
public:
CoLog( const char *filename) : m_wow(0), m_level(1)
{ dcli_translate_filename( m_filename, filename);
strncpy(m_pid,syi_ProcessId(),sizeof(m_pid));}
~CoLog() { if ( this == m_default_log) m_default_log = 0;}
CoLog( const char *filename) : m_wow(0), m_level(1) {
dcli_translate_filename( m_filename, filename);
strncpy(m_pid,syi_ProcessId(),sizeof(m_pid));
m_recall = new CoWowRecall();
}
~CoLog() {
if ( this == m_default_log)
m_default_log = 0;
delete m_recall;
}
void set_default() { m_default_log = this;}
void log( const char *category, const char *str, const char *cmt, unsigned int opt = 0);
......
......@@ -137,7 +137,8 @@ class CoWow {
virtual wow_sModalInputDialog *CreateModalInputDialog( const char *title, const char *text,
const char *button1, const char *button2,
const char *button3, const char *image,
int input_length) { return 0;}
int input_length,
CoWowRecall *recall = 0) { return 0;}
virtual void Wait( float time) {}
static int HideWarranty();
......
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