Re: [PATCH]: copy/move/delete progress title



Hello!

>   Yes, the color is differ, because imho the main function of this
> window is just show the status of process. This window is not regular
> dialog.

We have two styles - normal dialog boxes and and error messages.  I think 
it's enough.

Even if you want to use different colors, there is always a possibility to
use the values from the colors[] array instead of fixed colors in
common_dialog_repaint().  I think I'll try to make that change now to
eliminate replace_callback().

>   Unfortunately, there is no single function, that draws
> the title, like such:
> 
> void dlg_draw_title(Dlg_head *h, const char *title)
> {
>  char *t = title ? title : h->title;

You don't need to draw the title.  common_dialog_repaint() draws the whole 
frame and the title.

I'm applying the following patch.  Believe me, it works just fine, and
also removes the unnesessary variations in the frame width.  The result of
the callback for DLG_DRAW is not checked, see dlg_redraw() in dlg.c, so I
don't care about "return 1".  Your sanity check for "op" is not necessary
- op_names[] is defined on the complete set of valid values for op.

=======================
--- filegui.c
+++ filegui.c
@@ -190,19 +190,6 @@ check_progress_buttons (FileOpContext *c
 
 /* {{{ File progress display routines */
 
-static int
-op_win_callback (struct Dlg_head *h, int id, int msg)
-{
-    switch (msg){
-    case DLG_DRAW:
-	attrset (COLOR_NORMAL);
-	dlg_erase (h);
-	draw_box (h, 1, 2, h->lines-2, h->cols-4);
-	return 1;
-    }
-    return 0;
-}
-
 void
 file_op_context_create_ui (FileOpContext *ctx, FileOperation op, int with_eta)
 {
@@ -234,13 +221,13 @@ file_op_context_create_ui (FileOpContext
     x_size = (WX + 4) + ui->eta_extra;
 
     ui->op_dlg = create_dlg (0, 0, WY-minus+4, x_size, dialog_colors,
-			     op_win_callback, "", "opwin", DLG_CENTER);
+			     common_dialog_callback, "", "opwin", DLG_CENTER);
 
     last_hint_line = the_hint->widget.y;
     if ((ui->op_dlg->y + ui->op_dlg->lines) > last_hint_line)
 	the_hint->widget.y = ui->op_dlg->y + ui->op_dlg->lines+1;
 
-    x_set_dialog_title (ui->op_dlg, "");
+    x_set_dialog_title (ui->op_dlg, op_names[op]);
 
     add_widget (ui->op_dlg, button_new (BY-minus, WX - 19 + eta_offset, FILE_ABORT,
 					 NORMAL_BUTTON, _("&Abort"), 0, 0, "abort"));
=======================

-- 
Regards,
Pavel Roskin




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]