Changeset 232

Show
Ignore:
Timestamp:
06/13/06 15:50:59 (2 years ago)
Author:
jordi
Message:

Added the Color Model options to the print view.

Location:
trunk/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/IPrintView.h

    r231 r232  
    6262 
    6363            /// 
     64            /// @brief Adds a new color model to the list. 
     65            /// 
     66            /// @param name The possibly translated name of the color model. 
     67            /// @param value The value the ePDFView internally uses to know 
     68            ///              which colorModel is. 
     69            /// 
     70            virtual void addColorModel (const gchar *name, 
     71                                        const gchar *value) = 0; 
     72  
     73 
     74            /// 
    6475            /// @brief Adds a new page size to the list. 
    6576            /// 
     
    97108 
    98109            /// 
     110            /// @brief Deletes all color models from the list of color modes. 
     111            /// 
     112            virtual void clearColorModelList (void) = 0; 
     113 
     114            /// 
    99115            /// @brief Deletes all sizes from the list of page sizes. 
    100116            /// 
     
    186202 
    187203            /// 
     204            /// @brief Select a color model. 
     205            /// 
     206            /// @param colorModelIndex The index of the color model to select. 
     207            /// 
     208            virtual void selectColorModel (guint colorModelIndex) = 0; 
     209 
     210            /// 
    188211            /// @brief Selects a page size. 
    189212            /// 
  • trunk/src/PrintPter.cxx

    r231 r232  
    233233                } 
    234234                view.selectResolution (resolutionToSelect); 
     235 
     236                // Get the color models. 
     237                ppd_option_t *colorModelOption = 
     238                    ppdFindOption (printerPPD, "ColorModel"); 
     239                view.clearColorModelList (); 
     240                if ( NULL != colorModelOption ) 
     241                { 
     242                    int colorModelToSelect = 0; 
     243                    ppd_choice_t *colorModelChoice = colorModelOption->choices; 
     244                    for ( int currentColor = 0 ; 
     245                          currentColor < colorModelOption->num_choices ; 
     246                          ++currentColor, ++colorModelChoice ) 
     247                    { 
     248                        const gchar *colorName = colorModelChoice->text; 
     249                        const gchar *colorValue = colorModelChoice->choice; 
     250 
     251                        view.addColorModel (_(colorName), colorValue); 
     252                        if ( colorModelChoice->marked ) 
     253                        { 
     254                            colorModelToSelect = currentColor; 
     255                        } 
     256                    } 
     257                    view.selectColorModel (colorModelToSelect); 
     258                } 
     259                else 
     260                { 
     261                    view.addColorModel (_("Grayscale"), "Gray"); 
     262                } 
    235263                ppdClose (printerPPD); 
    236264            } 
  • trunk/src/gtk/PrintView.cxx

    r231 r232  
    122122 
    123123void 
     124PrintView::addColorModel (const gchar *name, const gchar *value) 
     125{ 
     126    addOptionToList (m_ColorModel, name, value); 
     127} 
     128 
     129void 
    124130PrintView::addPageSize (const gchar *name, const gchar *value) 
    125131{ 
     
    148154 
    149155void 
     156PrintView::clearColorModelList () 
     157{ 
     158    gtk_list_store_clear (m_ColorModel); 
     159} 
     160 
     161void 
    150162PrintView::clearPageSizeList () 
    151163{ 
     
    236248{ 
    237249    return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m_OddPageSet)); 
     250} 
     251 
     252void 
     253PrintView::selectColorModel (guint colorModelIndex) 
     254{ 
     255    gtk_combo_box_set_active (GTK_COMBO_BOX (m_ColorModelView), 
     256                              colorModelIndex); 
    238257} 
    239258 
     
    551570    gtk_misc_set_alignment (GTK_MISC (colorModeLabel), 1.0, 0.5); 
    552571    gtk_label_set_use_underline (GTK_LABEL (colorModeLabel), TRUE); 
    553 //    createColorModeListModel (); 
    554     GtkWidget *colorModeView = gtk_combo_box_new (); //_with_model (GTK_TREE_MODEL (m_ColorMode)); 
    555     gtk_label_set_mnemonic_widget (GTK_LABEL (colorModeLabel), colorModeView); 
    556     { 
    557         GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); 
    558         gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (colorModeView), 
     572    createColorModelListModel (); 
     573    m_ColorModelView = 
     574        gtk_combo_box_new_with_model (GTK_TREE_MODEL (m_ColorModel)); 
     575    gtk_label_set_mnemonic_widget (GTK_LABEL (colorModeLabel), 
     576                                   m_ColorModelView); 
     577    { 
     578        GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); 
     579        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (m_ColorModelView), 
    559580                                    renderer, TRUE); 
    560         gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (colorModeView), 
     581        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (m_ColorModelView), 
    561582                                        renderer, 
    562583                                        "text", 
     
    568589                      (GtkAttachOptions)(GTK_SHRINK), 
    569590                      0, 0); 
    570     gtk_table_attach (GTK_TABLE (outputTable), colorModeView, 
     591    gtk_table_attach (GTK_TABLE (outputTable), m_ColorModelView, 
    571592                      1, 2, 0, 1, 
    572593                      (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 
     
    661682 
    662683void 
     684PrintView::createColorModelListModel () 
     685{ 
     686    m_ColorModel = gtk_list_store_new (printOptionNumColumn, 
     687                                       G_TYPE_STRING,  // Label 
     688                                       G_TYPE_INT);    // Value 
     689} 
     690 
     691void 
    663692PrintView::createLayoutListModel () 
    664693{ 
  • trunk/src/gtk/PrintView.h

    r231 r232  
    2929            virtual void setPresenter (PrintPter *pter); 
    3030 
     31            virtual void addColorModel (const gchar *name, 
     32                                        const gchar *value); 
    3133            virtual void addPageSize (const gchar *name, 
    3234                                      const gchar *value); 
     
    3638            virtual void addResolution (const gchar *name, 
    3739                                        const gchar *value); 
     40            virtual void clearColorModelList (void); 
    3841            virtual void clearPageSizeList (void); 
    3942            virtual void clearResolutionList (void); 
     
    4851            virtual gboolean isSelectedEvenPageSet (void); 
    4952            virtual gboolean isSelectedOddPageSet (void); 
     53            virtual void selectColorModel (guint colorModeIndex); 
    5054            virtual void selectPageSize (guint pageSizeIndex); 
    5155            virtual void selectPrinter (guint printerIndex); 
     
    5862            GtkWidget *m_AllPagesRangeOption; 
    5963            GtkWidget *m_Collate; 
     64            GtkListStore *m_ColorModel; 
     65            GtkWidget *m_ColorModelView; 
    6066            GtkWidget *m_CustomPagesRangeOption; 
    6167            GtkWidget *m_EvenPageSet; 
     
    8389            GtkWidget *createPrinterTab (void); 
    8490 
     91            void createColorModelListModel (void); 
    8592            void createLayoutListModel (void); 
    8693            void createOrientationListModel (void);