void TASARIM_DESIGN_WIDGET::INIT_WIDGET ( QList< TASARIM_DEGISKENI *> p_variable, TASARIMCI_MODU p_modu )
{
    int x = 0;
    int y = 0;

    for (int i = 0 ; i < p_variable.size() ; i++ ){

        TASARIM_DEGISKENI *degisken = p_variable.at(i);

        QString label_txt = degisken->GET_TEXT();

        if (label_txt.isEmpty() EQ false) {

            if( p_modu EQ ONIZLEME_MODU ) {
                label_txt = degisken->GET_DISPLAY_TXT();
            }

            QLabel * variable_label = CREATE_NEW_LABEL(label_txt, this);

            QFont label_font = variable_label->font();

            label_font.setFamily(degisken->GET_FONT_FAMILY());

            if ( degisken->IS_MONOSPACE_MI() EQ true ) {
                label_font.setFamily("Monospace");
                degisken->SET_FONT_FAMILY("Monospace");
            }
            label_font.setPointSize (degisken->GET_FONT_SIZE());
            label_font.setBold      (degisken->IS_BOLD());
            label_font.setUnderline (degisken->IS_UNDER_LINE());
            label_font.setItalic    (degisken->IS_ITALIC());
            label_font.setStrikeOut (degisken->IS_STRIKEOUT());

            variable_label->setFont (label_font);

            variable_label->move( x*m_oran, y*m_oran );
            variable_label->show();
            variable_label->setAttribute  ( Qt::WA_DeleteOnClose );
            variable_label->setObjectName ( QString::number( p_variable.at( i )->GET_PRIMARY_ID()) + "\t" + QString::number(  p_variable.at(i)->GET_GRUP() ));

            degisken->SET_LABEL( variable_label );

            ADD_LABEL_LIST( variable_label );

            emit VARIABLE_CREATED( variable_label );

            x += variable_label->width() + 2;
            if ( x >= ( m_width * m_oran ) ) {
                x = 0;
                y += variable_label->height() + 2;
            }

            SET_LABEL_FONTS_UNSELECTED( variable_label );
        }
    }

    setAcceptDrops( true );
}
예제 #2
0
void BELGE_KERNEL::ADD_VARIABLES()
{

    ADAK_BELGE_DEFAULTS_STRUCT * belge_struct = new ADAK_BELGE_DEFAULTS_STRUCT;

    // degiskenler once siralanmali ------------> satirlar
/*    1....N
      --------->
 N+1  |
      |
      |
 N+M  v

*/

    if ( m_printer_type EQ DOT_MATRIX_PRINTER ) {
        QList<TASARIM_DEGISKENI*> sirali_liste;

        for (int k = 0; k < m_belge_satir_count; ++k) {
            int aranan_satir = k;

            QList<TASARIM_DEGISKENI*> satirdaki_degiskenler;
            for (int i = 0; i < m_all_variables.size(); ++i) {
                TASARIM_DEGISKENI *aranan_degisken = m_all_variables.at(i);
                if ( aranan_degisken->GET_SATIR() EQ aranan_satir ) {
                    satirdaki_degiskenler.append(aranan_degisken);
                }
            }
            //! hesaplama

            //! AYNI SATIRDAKI DEGISKENLERI SIRALA ASC

            DEGISLENLERI_SIRALA(&satirdaki_degiskenler);

            sirali_liste.append(satirdaki_degiskenler);
        }

        m_all_variables.clear();

        m_all_variables.append(sirali_liste);
    }

    for ( int i = 0 ; i < m_all_variables.size() ; i++ ) {

        TASARIM_DEGISKENI *degisken = m_all_variables.at(i);

        double x = degisken->GET_POS_X();
        double y = degisken->GET_POS_Y();

        double width  = degisken->GET_SIZE_X();
        double height = degisken->GET_SIZE_Y();

        if (m_printer_type EQ LAZER_PRINTERS) {


            m_painter.setPen( Qt::black);
            QFont font = m_painter.font();
            font.setFamily      (degisken->GET_FONT_FAMILY());
            font.setBold        (degisken->IS_BOLD());
            font.setUnderline   (degisken->IS_UNDER_LINE());
            font.setItalic      (degisken->IS_ITALIC());
            font.setStrikeOut   (degisken->IS_STRIKEOUT());
            font.setPointSize   (degisken->GET_FONT_SIZE());
            m_painter.setFont(font);

            double mmx = m_device_pixel_rate_x * x;
            double mmy = m_device_pixel_rate_y * y;

            if ( degisken->IS_VISIBLE() EQ false ) {
                continue;
            }

            if ( degisken->GET_GRUP() EQ USER_TEXT ) {
                m_painter.drawText(QPointF(mmx,mmy), degisken->GET_TEXT() );
            }
            else if ( degisken->GET_GRUP() EQ USER_IMG ) {
                m_painter.drawImage(QRect(mmx, mmy, width, height), degisken->GET_IMAGES().toImage() );
            }
            else  {

                belge_struct->degisken_id         = degisken->GET_DEGISKEN_ID();
                belge_struct->align               = degisken->GET_ALIGN();
                belge_struct->degisken_adi        = degisken->GET_TEXT().toStdString().c_str();
                belge_struct->karakter_sayisi     = degisken->GET_TEXT_SIZE();
                belge_struct->degisken_kodu       = degisken->GET_KODU().toStdString().c_str();
                belge_struct->font_size           = degisken->GET_FONT_SIZE();
                belge_struct->is_visible_variable = degisken->IS_VISIBLE();
                belge_struct->monospace_mi        = degisken->IS_MONOSPACE_MI();
                belge_struct->x_position          = degisken->GET_POS_X();
                belge_struct->y_position          = degisken->GET_POS_Y();

                if ( degisken->GET_GRUP() EQ HEADER ){
                    ADD_LAZER_VARIABLES( belge_struct, 0, &m_header_variables, HEADER );
                }
                if ( degisken->GET_GRUP() EQ LINE ){
                    ADD_LAZER_VARIABLES( belge_struct, 0, &*m_line_variables, LINE );
                }
                if ( degisken->GET_GRUP() EQ FOOTER ){
                    ADD_LAZER_VARIABLES( belge_struct, 0, &m_footer_variables, FOOTER );
                }
            }
        }
        else {
            if ( degisken->IS_VISIBLE() EQ true) {

                if ( degisken->GET_GRUP() EQ USER_TEXT ) {
                    SET_DOTMATRIX_VALUE( degisken->GET_TEXT(), degisken->GET_SOLDAN_BOSLUK(), degisken->GET_SATIR(), degisken->GET_GRUP(), degisken->IS_NLQ(), degisken->GET_DOT_MARIX_MODE() );
                }

                belge_struct->degisken_id         = degisken->GET_DEGISKEN_ID();
                belge_struct->align               = degisken->GET_ALIGN();
                belge_struct->degisken_adi        = degisken->GET_TEXT().toStdString().c_str();
                belge_struct->karakter_sayisi     = degisken->GET_TEXT_SIZE();
                belge_struct->degisken_kodu       = degisken->GET_KODU().toStdString().c_str();
                belge_struct->font_size           = degisken->GET_FONT_SIZE();
                belge_struct->is_visible_variable = degisken->IS_VISIBLE();
                belge_struct->monospace_mi        = degisken->IS_MONOSPACE_MI();
                belge_struct->x_position          = degisken->GET_SOLDAN_BOSLUK();
                belge_struct->y_position          = degisken->GET_SATIR();

                if ( degisken->GET_GRUP() EQ HEADER ){
                    ADD_DOTMATRIX_VARIABLES(belge_struct,0,&m_header_variables,HEADER, degisken->IS_NLQ(), degisken->GET_DOT_MARIX_MODE() );
                }

                if ( degisken->GET_GRUP() EQ LINE ){
                    ADD_DOTMATRIX_VARIABLES(belge_struct,0,&*m_line_variables,LINE, degisken->IS_NLQ(), degisken->GET_DOT_MARIX_MODE() );
                }

                if ( degisken->GET_GRUP() EQ FOOTER ){
                    ADD_DOTMATRIX_VARIABLES(belge_struct,0,&m_footer_variables,FOOTER, degisken->IS_NLQ(), degisken->GET_DOT_MARIX_MODE());
                }
            }
        }
    }

    delete belge_struct;
}