Back to index

tetex-bin  3.0
Classes | Defines | Enumerations | Functions
print-dialog.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  save_or_print_info

Defines

#define Xdvi_SAVE_SHELL_NAME   "save_popup"
#define Xdvi_PRINT_SHELL_NAME   "print_popup"

Enumerations

enum  printOrSaveActionT { FILE_PRINT = 0, FILE_SAVE = 1, FILE_ALL = 2 }

Functions

void save_or_print_callback (struct save_or_print_info *info)
void cancel_saving (struct save_or_print_info *info)
const char * get_printer_options (void)
char * get_dvips_options (printOrSaveActionT act)
void notify_print_dialog_have_marked (Boolean flag)

Class Documentation

struct save_or_print_info

Definition at line 31 of file print-dialog.h.

Collaboration diagram for save_or_print_info:
Class Members
printOrSaveActionT act
Widget message_popup
struct select_pages_info * pinfo

Define Documentation

#define Xdvi_PRINT_SHELL_NAME   "print_popup"

Definition at line 27 of file print-dialog.h.

#define Xdvi_SAVE_SHELL_NAME   "save_popup"

Definition at line 26 of file print-dialog.h.


Enumeration Type Documentation

Enumerator:
FILE_PRINT 
FILE_SAVE 
FILE_ALL 

Definition at line 29 of file print-dialog.h.


Function Documentation

Definition at line 590 of file print-dialog.c.

{
    cb_save_cancel(NULL, info, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 203 of file print-dialog.c.

{
    if (act == FILE_PRINT)
       return save_pr_info.dvips_options;
    else
       return save_save_info.dvips_options;
}

Here is the caller graph for this function:

Definition at line 197 of file print-dialog.c.

{
    return save_pr_info.printer_name;
}

Here is the caller graph for this function:

Definition at line 2900 of file print-dialog.c.

{
    /* Note: check for *both* windows, save and print: */

    static pageRadioT old_value = NO_PAGE_VAL;
    
    if (save_is_active) {
       if (!flag && curr_save_info.range_radio == SAVE_MARKED) {
           /* switch button from `marked' to its previous value */
           switch (old_value) {
           case SAVE_ALL:
#ifdef MOTIF
              XmToggleButtonGadgetSetState(range_all_radio[FILE_SAVE], True, True);
#else
              XawToggleSetCurrent(range_all_radio[FILE_SAVE], (XtPointer)old_value);
#endif
              break;
           case SAVE_RANGE:
#ifdef MOTIF
              XmToggleButtonGadgetSetState(range_from_to_radio[FILE_SAVE], True, True);
#else
              XawToggleSetCurrent(range_from_to_radio[FILE_SAVE], (XtPointer)old_value);
#endif
              break;
           default: break;
           }
       }
       else if (flag) {
           /* switch button to `marked', saving the current value */
           if (curr_save_info.range_radio != SAVE_MARKED) /* guard for second invocation on mouse release */
              old_value = curr_save_info.range_radio;
#ifdef MOTIF
           XmToggleButtonGadgetSetState(range_marked_radio[FILE_SAVE], True, True);
#else
           XawToggleSetCurrent(range_marked_radio[FILE_SAVE], (XtPointer)SAVE_MARKED);
#endif /* MOTIF */
       }
       XtSetSensitive(range_marked_radio[FILE_SAVE], flag);
    }
    
    if (print_is_active) {
       if (!flag && curr_pr_info.range_radio == PRINT_MARKED) {
           /* switch button from `marked' to its previous value */
           switch (old_value) {
           case PRINT_ALL:
#ifdef MOTIF
              XmToggleButtonGadgetSetState(range_all_radio[FILE_PRINT], True, True);
#else
              XawToggleSetCurrent(range_all_radio[FILE_PRINT], (XtPointer)old_value);
#endif
              break;
           case PRINT_RANGE:
#ifdef MOTIF
              XmToggleButtonGadgetSetState(range_from_to_radio[FILE_PRINT], True, True);
#else
              XawToggleSetCurrent(range_from_to_radio[FILE_PRINT], (XtPointer)old_value);
#endif
              break;
           default: break;
           }
       }
       else if (flag) {
           /* switch button to `marked', saving the current value */
           if (curr_pr_info.range_radio != PRINT_MARKED) /* guard for second invocation on mouse release */
              old_value = curr_pr_info.range_radio;
#ifdef MOTIF
           XmToggleButtonGadgetSetState(range_marked_radio[FILE_PRINT], True, True);
#else
           XawToggleSetCurrent(range_marked_radio[FILE_PRINT], (XtPointer)PRINT_MARKED);
#endif /* MOTIF */
       }
       XtSetSensitive(range_marked_radio[FILE_PRINT], flag);
    }
}

Here is the caller graph for this function:

Definition at line 2174 of file print-dialog.c.

{
    printOrSaveActionT act = info->act;
    static char ofstring[1024]; /* should be ample */
    struct dialog_info *save_info = NULL, *curr_info = NULL;

    if (act == FILE_PRINT) {
       save_info = &save_pr_info;
       curr_info = &curr_pr_info;
       if (print_is_active) {
           XBell(DISP, 0);
           XRaiseWindow(DISP, XtWindow(print_shell));
           return;
       }

       if (printlog_raise_active()) {
           XBell(DISP, 0);
           return;
       }
    }
    else if (act == FILE_SAVE) {
       save_info = &save_save_info;
       curr_info = &curr_save_info;
       if (save_is_active) {
           XBell(DISP, 0);
           XRaiseWindow(DISP, XtWindow(save_shell));
           return;
       }
    }
    else {
       ASSERT(0, "wrong action type in save_or_print_callback()");
    }

    if (globals.dvi_file.bak_fp == NULL) {
       popup_message(globals.widgets.top_level,
                    MSG_ERR,
                    NULL,
                    "Empty or incomplete DVI file. "
                    "Please select a new DVI file via File -> Open.");
       return;
    }

    if (globals.pageno_correct == 1)
       sprintf(ofstring, "of %d physical pages", total_pages);
    else
       sprintf(ofstring, "of %d to %d pages", globals.pageno_correct, total_pages + globals.pageno_correct - 1);

    if (act == FILE_PRINT && print_shell == NULL) {
       curr_info->print_radio = resource.default_printing_target;
       print_shell = create_print_or_save_window(info, ofstring);
#ifdef MOTIF
       set_sensitivity(resource.default_printing_target);
#endif
    }
    else if (act == FILE_SAVE && save_shell == NULL)
       save_shell = create_print_or_save_window(info, ofstring);
    else { /* if the window was already created */
#ifdef MOTIF
       XmString str;
#endif
       /* XXX: is this actually needed??? */
       /* XXX: To test, remove the following */
       if (!pageinfo_have_marked_pages()) {
           if (act == FILE_PRINT && save_pr_info.range_radio == PRINT_MARKED) {
              save_pr_info.range_radio = PRINT_ALL;
           }
           else if (act == FILE_SAVE && save_save_info.range_radio == SAVE_MARKED) {
              save_save_info.range_radio = SAVE_ALL;
           }
       }
       
       if (act == FILE_PRINT)
           set_target_radio(save_info, curr_info, act);
       set_range_radio(save_info, curr_info, act);
#ifdef MOTIF
       str = XmStringCreateLocalized(ofstring);
       XtVaSetValues(of_label[act], XmNlabelString, str, NULL);
       XmStringFree(str);

       /* FIXME: this seems neccessary, otherwise labels are misaligned
          again if window is closed and opened a second time? */
       adjust_heights(range_from_to_radio[act],
                     from_label[act], page_from_text[act],
                     to_label[act], page_to_text[act],
                     of_label[act],
                     NULL);
       
       if (save_info->dvips_options != NULL) {
           XtVaSetValues(dvips_options_text[act], XmNvalue, save_info->dvips_options,
                       XmNcursorPosition, strlen(save_info->dvips_options), NULL);
       }
       else {
           XtVaSetValues(dvips_options_text[act], XmNvalue, "", NULL);
       }
#else /* MOTIF */
       XtVaSetValues(of_label[act], XtNlabel, ofstring, NULL);
           
       if (save_info->dvips_options != NULL) {
           XtVaSetValues(dvips_options_text[act], XtNstring, save_info->dvips_options, NULL);
           XawTextSetInsertionPoint(dvips_options_text[act], strlen(save_info->dvips_options));
       }
       else {
           XtVaSetValues(dvips_options_text[act], XtNstring, "", NULL);
       }
#endif /* MOTIF */
    }

    get_initial_dialog_values(save_info, act);
    
#ifdef MOTIF
    if (act == FILE_PRINT)
       XtVaSetValues(print_to_printer_text, XmNvalue, save_info->printer_name,
                    XmNcursorPosition, strlen(save_info->printer_name), NULL);

    XtVaSetValues(dvips_options_text[act], XmNvalue, save_info->dvips_options,
                XmNcursorPosition, strlen(save_info->dvips_options), NULL);

    XtVaSetValues(page_from_text[act], XmNvalue, save_info->from_page,
                XmNcursorPosition, strlen(save_info->from_page), NULL);

    XtVaSetValues(page_to_text[act], XmNvalue, save_info->to_page,
                XmNcursorPosition, strlen(save_info->to_page),  NULL);
#else /* MOTIF */
    if (act == FILE_PRINT) {
       XtVaSetValues(print_to_printer_text, XtNstring, save_info->printer_name, NULL);
       XawTextSetInsertionPoint(print_to_printer_text, strlen(save_info->printer_name));
    }

    XtVaSetValues(dvips_options_text[act], XtNstring, save_info->dvips_options, NULL);
    XawTextSetInsertionPoint(dvips_options_text[act], strlen(save_info->dvips_options));
        
    XtVaSetValues(page_from_text[act], XtNstring, save_info->from_page, NULL);
    XawTextSetInsertionPoint(page_from_text[act], strlen(save_info->from_page));

    XtVaSetValues(page_to_text[act], XtNstring, save_info->to_page, NULL);
    XawTextSetInsertionPoint(page_to_text[act], strlen(save_info->to_page));
#endif /* MOTIF */

    if (act == FILE_PRINT) {
       if (pageinfo_have_marked_pages()) {
           XtSetSensitive(range_marked_radio[FILE_PRINT], True);
       }
       else {
           XtSetSensitive(range_marked_radio[FILE_PRINT], False);
       }
       ASSERT(save_pr_info.range_radio != PRINT_MARKED || pageinfo_have_marked_pages(),
              "PRINT_MARKED shouldn't be togglable if there are no marked pages!");
    }
    else if (act == FILE_SAVE) {
       if (pageinfo_have_marked_pages()) {
           XtSetSensitive(range_marked_radio[FILE_SAVE], True);
       }
       else {
           XtSetSensitive(range_marked_radio[FILE_SAVE], False);
       }
       ASSERT(save_save_info.range_radio != SAVE_MARKED || pageinfo_have_marked_pages(),
              "SAVE_MARKED shouldn't be togglable if there are no marked pages!");
    }

    set_outfile_name(save_info, &curr_save_info, act);

#ifdef MOTIF
    XtVaSetValues(print_to_file_text[act], XmNvalue, save_info->file_name,
                XmNcursorPosition, strlen(save_info->file_name), NULL);
#else /* MOTIF */
    XtVaSetValues(print_to_file_text[act], XtNstring, save_info->file_name, NULL);
    XawTextSetInsertionPoint(print_to_file_text[act], strlen(save_info->file_name));
#endif /* MOTIF */

    if (act == FILE_PRINT) {
       XtPopup(print_shell, XtGrabNone);
       print_is_active = True;
    }
    else {
       XtPopup(save_shell, XtGrabNone);
       save_is_active = True;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: