37 aw_message_cb_result =
result;
41 #if defined(TRACE_STATUS_MORE)
42 fprintf(stderr,
"in aw_message_timer_listen_event\n");
fflush(stdout);
43 #endif // TRACE_STATUS_MORE
56 #define AW_INPUT_AWAR "tmp/input/string"
57 #define AW_INPUT_TITLE_AWAR "tmp/input/title"
59 #define AW_FILE_SELECT_BASE "tmp/file_select"
60 #define AW_FILE_SELECT_DIR_AWAR AW_FILE_SELECT_BASE "/directory"
61 #define AW_FILE_SELECT_FILE_AWAR AW_FILE_SELECT_BASE "/file_name"
62 #define AW_FILE_SELECT_FILTER_AWAR AW_FILE_SELECT_BASE "/filter"
63 #define AW_FILE_SELECT_TITLE_AWAR AW_FILE_SELECT_BASE "/title"
88 #if defined(TRACE_HISTORY)
89 static void dumpHistory(
const char *where) {
90 printf(
"History [%s]:\n", where);
91 for (deque<string>::iterator h = input_history.begin(); h != input_history.end(); ++h) {
92 printf(
"'%s'\n", h->c_str());
95 #endif // TRACE_HISTORY
100 if (input_history.empty()) {
101 input_history.push_front(
"");
104 deque<string>::iterator found = find(input_history.begin(), input_history.end(),
s);
105 if (found != input_history.end()) {
106 input_history.erase(found);
110 input_history.push_front(s);
113 input_history.push_back(s);
116 #if defined(TRACE_HISTORY)
117 dumpHistory(
GBS_global_string(
"input_history_insert('%s', front=%i)", str, front));
118 #endif // TRACE_HISTORY
129 if (!input_history.empty()) {
131 string s = input_history.front();
133 input_history.pop_front();
134 input_history.push_back(s);
137 string s = input_history.back();
139 input_history.pop_back();
140 input_history.push_front(s);
144 #if defined(TRACE_HISTORY)
146 #endif // TRACE_HISTORY
154 aw_input_cb_result =
NULp;
165 aw_input_cb_result =
NULp;
167 if (ok_cancel_flag >= 0) {
173 #define INPUT_SIZE 50 // size of input prompts in aw_input
187 aw_msg->
init(root, title,
false);
203 int butCount = button_names.
size();
205 int abortButton = -1;
206 for (
int b = 0; b<butCount; b++) {
207 if (button_names[b][0] ==
'-') {
210 button_names.
replace(b, button_names[b]+1);
212 int len = strlen(button_names[b]);
213 if (len>maxlen) maxlen = len;
218 #define MAXBUTTONSPERLINE 5
230 for (
int b = 0; b<butCount; b++) {
231 const char *name = button_names[b];
232 bool forceLF = name[0] ==
'\n';
242 int resultCode = b == abortButton ? -1 : b;
251 char *
aw_input(
const char *
title,
const char *prompt,
const char *default_input) {
288 aw_input_cb_result = dummy;
293 while (aw_input_cb_result == dummy) {
303 char *
aw_input(
const char *prompt,
const char *default_input) {
304 return aw_input(
"Enter string", prompt, default_input);
315 static AW_window_simple *aw_msg =
NULp;
332 aw_msg =
new AW_window_simple;
334 aw_msg->init(root,
"AW_FILE_SELECTION",
"File selection");
335 aw_msg->allow_delete_window(
false);
337 aw_msg->load_xfig(
"fileselect.fig");
344 aw_msg->button_length(7);
348 aw_msg->create_button(
"OK",
"OK",
"O");
350 aw_msg->at(
"cancel");
352 aw_msg->create_button(
"CANCEL",
"CANCEL",
"C");
354 aw_msg->window_fit();
357 aw_msg->show_modal();
359 aw_input_cb_result = dummy;
364 while (aw_input_cb_result == dummy) {
void button_length(int length)
#define AW_MESSAGE_LISTEN_DELAY
#define AW_FILE_SELECT_TITLE_AWAR
void input_cb(AW_window *aw, int buttonNr)
void AW_create_standard_fileselection(AW_window *aws, const char *awar_prefix)
static AW_window_message * new_input_window(AW_root *root, const char *title, const char *buttons)
const char * GBS_global_string(const char *templat,...)
void init(AW_root *root_in, const char *wid, const char *windowname, bool allow_close)
void add_timed_callback_never_disabled(int ms, const TimedCallback &tcb)
void set_window_title(const char *title)
static void input_history_insert(const char *str, bool front)
static char * aw_input_cb_result
unsigned aw_message_timer_listen_event(AW_root *, AW_window *aww)
static AW_root * SINGLETON
void message_cb(AW_window *, int result)
static deque< string > input_history
#define AW_INPUT_TITLE_AWAR
char * read_as_string() const
void file_selection_cb(AW_window *aw, int ok_cancel_flag)
char * read_string() const
AW_awar * awar(const char *awar)
#define AW_FILE_SELECT_BASE
void create_input_field(const char *awar_name, int columns=0)
void auto_space(int xspace, int yspace)
static void create_input_awars(AW_root *aw_root)
#define AW_FILE_SELECT_FILE_AWAR
#define MAXBUTTONSPERLINE
#define AW_FILE_SELECT_FILTER_AWAR
char * GBS_eval_env(GB_CSTR p)
static void create_fileSelection_awars(AW_root *aw_root)
char * aw_modal_file_selection(const char *title, const char *dir, const char *def_name, const char *suffix)
#define AW_FILE_SELECT_DIR_AWAR
GB_ERROR write_string(const char *aw_string)
void GBT_split_string(ConstStrArray &dest, const char *namelist, const char *separator, SplitMode mode)
int GB_get_transaction_level(GBDATA *gbd)
void callback(const WindowCallback &cb)
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
char * aw_input(const char *title, const char *prompt, const char *default_input)
void label_length(int length)
const char * replace(int i, const char *elem)
void create_button(const char *macro_name, AW_label label, const char *mnemonic=NULp, const char *color=NULp)
void input_history_cb(AW_window *aw, int mode)
GB_write_int const char s