Skip to content
Snippets Groups Projects
Commit 03909a7a authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

more refinements to partion stuff

parent 867f98c8
No related branches found
No related tags found
No related merge requests found
...@@ -270,36 +270,12 @@ void Message::Direct(int level, const char *fmt, ...) ...@@ -270,36 +270,12 @@ void Message::Direct(int level, const char *fmt, ...)
#if defined(HAVE_FLTK) #if defined(HAVE_FLTK)
if(WID){ if(WID){
WID->check(); WID->check();
const char *const last = str + std::max(0u, std::strlen(str) - 1); std::string tmp;
char _buf[1029];
if(level < 3) if(level < 3)
std::strcpy(_buf, "@C1@."); tmp = std::string("@C1@.") + str;
else else
std::strcpy(_buf, "@C4@."); tmp = std::string("@C4@.") + str;
char *const buf = _buf + 5; WID->add_message(tmp.c_str());
char *p = std::strtok(str, "\n");
if(p) {
// If more than 1 leading '\n', print a blank line
if(p - str > 1) {
buf[0] = ' ';
buf[1] = '\0';
WID->add_message(_buf);
}
std::strcpy(buf, p);
WID->add_message(_buf);
// New line for each interior '\n'
while(p = std::strtok(NULL, "\n")) {
std::strcpy(buf, p);
WID->add_message(_buf);
}
}
// If more than 1 trailing '\n', or only "\n" in the string, print a blank
// line.
if(*last == '\n') {
buf[0] = ' ';
buf[1] = '\0';
WID->add_message(_buf);
}
if(level == 1) if(level == 1)
WID->create_message_window(); WID->create_message_window();
} }
......
...@@ -1415,11 +1415,10 @@ void partition_defaults_cb(Fl_Widget *widget, void *data) ...@@ -1415,11 +1415,10 @@ void partition_defaults_cb(Fl_Widget *widget, void *data)
dlg->read_all_options(); dlg->read_all_options();
partition_select_groups_cb(dlg->choicePartitioner, data); partition_select_groups_cb(dlg->choicePartitioner, data);
} }
void partition_partition_cb(Fl_Widget *widget, void *data) void partition_partition_cb(Fl_Widget *widget, void *data)
{ {
PartitionDialog *dlg = static_cast<PartitionDialog*>(data); PartitionDialog *dlg = static_cast<PartitionDialog*>(data);
Fl_Window *const w = widget->window();
w->hide();
// Write all options // Write all options
dlg->write_all_options(); dlg->write_all_options();
...@@ -1430,13 +1429,14 @@ void partition_partition_cb(Fl_Widget *widget, void *data) ...@@ -1430,13 +1429,14 @@ void partition_partition_cb(Fl_Widget *widget, void *data)
// Update the screen // Update the screen
if(!ier) { if(!ier) {
opt_mesh_color_carousel(0, GMSH_SET | GMSH_GUI, 3.); opt_mesh_color_carousel(0, GMSH_SET | GMSH_GUI, 3.);
CTX.mesh.changed = ENT_ALL;
Draw(); Draw();
} }
Fl::delete_widget(widget->window());
} }
void partition_cancel_cb(Fl_Widget *widget, void *data) void partition_cancel_cb(Fl_Widget *widget, void *data)
{ {
widget->window()->hide();
Fl::delete_widget(widget->window()); Fl::delete_widget(widget->window());
} }
...@@ -1581,8 +1581,8 @@ int partition_dialog() ...@@ -1581,8 +1581,8 @@ int partition_dialog()
const int w = 3 * BB + IW + 3 * WB; // Window width const int w = 3 * BB + IW + 3 * WB; // Window width
int y = 0; int y = 0;
Fl_Double_Window *const window = Dialog_Window *const window = new Dialog_Window(w, h, CTX.non_modal_windows,
new Fl_Double_Window(w, h, "Partitioner Options"); "Partitioner Options");
window->box(GMSH_WINDOW_BOX); window->box(GMSH_WINDOW_BOX);
// Main options group [0] // Main options group [0]
...@@ -1882,7 +1882,6 @@ int partition_dialog() ...@@ -1882,7 +1882,6 @@ int partition_dialog()
g->show(); g->show();
} }
window->set_modal();
window->end(); window->end();
window->hotspot(window); window->hotspot(window);
......
...@@ -3,7 +3,7 @@ include ../../variables ...@@ -3,7 +3,7 @@ include ../../variables
LIB = ../../lib/libGmshChaco${LIBEXT} LIB = ../../lib/libGmshChaco${LIBEXT}
INC = ${DASH}Imain INC = ${DASH}Imain ${DASH}I../../Common
CFLAGS = ${OPTIM} ${FLAGS} ${INC} ${SYSINCLUDE} CFLAGS = ${OPTIM} ${FLAGS} ${INC} ${SYSINCLUDE}
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// See the LICENSE.txt file for license information. Please report all // See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>. // bugs and problems to <gmsh@geuz.org>.
#include "../../../Common/Message.h" #include "Message.h"
// Overload the printf statements in Chaco to write using Msg::Direct in gmsh // Overload the printf statements in Chaco to write using Msg::Direct in gmsh
...@@ -14,5 +14,23 @@ extern "C" int Gmsh_printf(const char *fmt, ...) ...@@ -14,5 +14,23 @@ extern "C" int Gmsh_printf(const char *fmt, ...)
va_start(args, fmt); va_start(args, fmt);
vsnprintf(str, sizeof(str), fmt, args); vsnprintf(str, sizeof(str), fmt, args);
va_end(args); va_end(args);
Msg::Direct(3, str);
// deal with multi-line messages
const char *const last = str + std::max(0, (int)std::strlen(str) - 1);
char buf[1024];
char *p = std::strtok(str, "\n");
if(p) {
// If more than 1 leading '\n', print a blank line
if(p - str > 1) Msg::Direct(" ");
std::strcpy(buf, p);
Msg::Direct(buf);
// New line for each interior '\n'
while(p = std::strtok(NULL, "\n")) {
std::strcpy(buf, p);
Msg::Direct(buf);
}
}
// If more than 1 trailing '\n', or only "\n" in the string, print a blank
// line.
if(*last == '\n') Msg::Direct(" ");
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment