int OnObjectNotifyPref(void *w, int obj) { GEM_WINDOW *wnd = (GEM_WINDOW *) w ; WEXTENSION_PREF *wext = wnd->DlgData->UserData ; WDLG_PREF *wdlg = wnd->Extension ; OBJECT *adr_pref = wnd->DlgData->BaseObject ; int i, off_x, off_y ; int code = -1 ; int save = 0 ; switch( obj ) { case PREF_TPECRAN : inv_select(adr_pref, PREF_PECRAN) ; break ; case PREF_TQUIT : inv_select(adr_pref, PREF_QUIT) ; break ; case PREF_TCLIP : inv_select(adr_pref, PREF_CLIP) ; break ; case PREF_TWKIND : inv_select(adr_pref, PREF_WKIND) ; break ; case PREF_TMVISEUR : inv_select(adr_pref, PREF_MVISEUR) ; break ; case PREF_TAIDE : inv_select(adr_pref, PREF_AIDE) ; break ; case PREF_TDITHERAUTO: inv_select(adr_pref, PREF_DITHERAUTO) ; break ; case PREF_TSPLASH : inv_select(adr_pref, PREF_SPLASH) ; break ; case PREF_TTOOLBAR : inv_select(adr_pref, PREF_TOOLBAR) ; break ; case PREF_TLONGFNAME: inv_select(adr_pref, PREF_LONGFNAME) ; break ; case PREF_CP : deselect(adr_pref, PREF_CP) ; objc_offset(adr_pref, PREF_CP, &off_x, &off_y) ; i = popup_formdo(&wdlg->popup_cp, off_x, off_y, 1+wext->cp, -1) ; if (i > 0) wext->cp = i-1 ; write_text(adr_pref, PREF_CP, msg[MSG_CPNONE+wext->cp]) ; xobjc_draw( wnd->window_handle, adr_pref, PREF_CP ) ; break ; case PREF_LANGUE : deselect( adr_pref, PREF_LANGUE ) ; if ( config.nb_languages > 1 ) { objc_offset( adr_pref, PREF_LANGUE, &off_x, &off_y ) ; i = popup_formdo( &wdlg->popup_language, off_x, off_y, 1, -1 ) ; if (i > 0) sprintf( wext->language, " %s", config.all_languages[i-1] ) ; write_text( adr_pref, PREF_LANGUE, wext->language ) ; } xobjc_draw( wnd->window_handle, adr_pref, PREF_LANGUE ) ; break ; case PREF_DITHER : deselect(adr_pref, PREF_DITHER) ; objc_offset(adr_pref, PREF_DITHER, &off_x, &off_y) ; i = popup_formdo(&wdlg->popup_dm, off_x, off_y, 1+wext->dm, -1) ; if (i > 0) wext->dm = i-1 ; write_text(adr_pref, PREF_DITHER, msg[MSG_DITHERAUTO+wext->dm]) ; xobjc_draw( wnd->window_handle, adr_pref, PREF_DITHER ) ; break ; case PREF_PATHS : get_paths() ; inv_select( adr_pref, obj ) ; break ; case PREF_DSP : pref_dsp() ; inv_select( adr_pref, obj ) ; break ; case PREF_SLDSHOW : pref_sldshow() ; inv_select( adr_pref, obj ) ; break ; case PREF_UNDO : pref_undo() ; inv_select( adr_pref, obj ) ; break ; case PREF_RTZOOM : wext->rtzoom_change = pref_rtzoom() ; inv_select( adr_pref, obj ) ; break ; case PREF_LOGFILE : pref_logfile() ; inv_select( adr_pref, obj ) ; break ; case PREF_SAVE : save = 1 ; case PREF_OK : code = IDOK ; break ; case PREF_CANCEL : code = IDCANCEL ; break ; } if ( code == IDOK ) { if (selected(adr_pref, PREF_PECRAN)) config.flag_fullscreen = 1 ; else config.flag_fullscreen = 0 ; if (selected(adr_pref, PREF_WKIND)) config.w_info = 1 ; else config.w_info = 0 ; if (selected(adr_pref, PREF_QUIT)) config.quitte = 1 ; else config.quitte = 0 ; if (selected(adr_pref, PREF_CLIP)) config.clip_gem = 1 ; else config.clip_gem = 0 ; if (selected(adr_pref, PREF_MVISEUR)) config.souris_viseur = 1 ; else config.souris_viseur = 0 ; if (selected(adr_pref, PREF_AIDE)) config.flags |= FLG_HELP ; else config.flags &= ~FLG_HELP ; if (selected(adr_pref, PREF_LONGFNAME)) config.flags |= FLG_LONGFNAME ; else config.flags &= ~FLG_LONGFNAME ; if (selected(adr_pref, PREF_DITHERAUTO)) config.flags |= FLG_DITHERAUTO ; else config.flags &= ~FLG_DITHERAUTO ; if (selected(adr_pref, PREF_SPLASH)) config.flags |= FLG_SPLASH ; else config.flags &= ~FLG_SPLASH ; if (selected(adr_pref, PREF_TOOLBAR)) config.flags |= FLG_TOOLBAR ; else config.flags &= ~FLG_TOOLBAR ; if ( config.flags & FLG_HELP ) GemApp.Flags.HelpBubbles = 1 ; else GemApp.Flags.HelpBubbles = 0 ; config.color_protect = wext->cp ; config.dither_method = DitherMethod = wext->dm ; if ( GemApp.CurrentGemWindow && ( strcmp( GemApp.CurrentGemWindow->ClassName, VIMG_CLASSNAME ) == 0 ) ) set_imgpalette( (VXIMAGE *) GemApp.CurrentGemWindow->Extension ) ; if ( strcmp( config.language, 2+wext->language ) ) { form_stop( 1, msg[MSG_CHANGELNG] ) ; strcpy( config.language, 2+wext->language ) ; save = 1 ; /* Force la sauvegarde */ } VToolBarShow( config.flags & FLG_TOOLBAR ) ; } if ( save ) { if ( SaveVISIONIniFile( &config ) ) form_stop( 1, msg[MSG_WRITEERROR] ) ; } return( code ) ; }
void term_mouse (Mouse_Button b, Mouse_Action a, int x, int y) { unsigned long *selpoint; if (y<0) y = 0; if (y>=rows) y = rows-1; if (x<0) { if (y > 0) { x = cols-1; y--; } else x = 0; } if (x>=cols) x = cols-1; selpoint = disptop + y * (cols+1) + x; if (b == MB_SELECT && a == MA_CLICK) { deselect(); selstate = ABOUT_TO; selanchor = selpoint; selmode = SM_CHAR; } else if (b == MB_SELECT && (a == MA_2CLK || a == MA_3CLK)) { deselect(); selmode = (a == MA_2CLK ? SM_WORD : SM_LINE); selstate = DRAGGING; selstart = selanchor = selpoint; selend = selstart + 1; sel_spread(); } else if ((b == MB_SELECT && a == MA_DRAG) || (b == MB_EXTEND && a != MA_RELEASE)) { if (selstate == ABOUT_TO && selanchor == selpoint) return; if (b == MB_EXTEND && a != MA_DRAG && selstate == SELECTED) { if (selpoint-selstart < (selend-selstart)/2) selanchor = selend - 1; else selanchor = selstart; selstate = DRAGGING; } if (selstate != ABOUT_TO && selstate != DRAGGING) selanchor = selpoint; selstate = DRAGGING; if (selpoint < selanchor) { selstart = selpoint; selend = selanchor + 1; } else { selstart = selanchor; selend = selpoint + 1; } sel_spread(); } else if ((b == MB_SELECT || b == MB_EXTEND) && a == MA_RELEASE) { if (selstate == DRAGGING) { /* * We've completed a selection. We now transfer the * data to the clipboard. */ unsigned char *p = selspace; unsigned long *q = selstart; while (q < selend) { int nl = FALSE; unsigned long *lineend = q - (q-text) % (cols+1) + cols; unsigned long *nlpos = lineend; if (!(*nlpos & ATTR_WRAPPED)) { while ((nlpos[-1] & CHAR_MASK) == 0x20 && nlpos > q) nlpos--; if (nlpos < selend) nl = TRUE; } while (q < nlpos && q < selend) *p++ = (unsigned char) (*q++ & CHAR_MASK); if (nl) { int i; for (i=0; i<sizeof(sel_nl); i++) *p++ = sel_nl[i]; } q = lineend + 1; /* start of next line */ } write_clip (selspace, p - selspace); selstate = SELECTED; } else selstate = NO_SELECTION; } else if (b == MB_PASTE && (a==MA_CLICK || a==MA_2CLK || a==MA_3CLK)) { char *data; int len; get_clip((void **) &data, &len); if (data) { char *p, *q; p = q = data; while (p < data+len) { while (p < data+len && !(p <= data+len-sizeof(sel_nl) && !memcmp(p, sel_nl, sizeof(sel_nl)))) p++; { int i; unsigned char c; for(i=0;i<p-q;i++) { c=xlat_kbd2tty(q[i]); ldisc->send(&c,1); } } if (p <= data+len-sizeof(sel_nl) && !memcmp(p, sel_nl, sizeof(sel_nl))) { ldisc->send ("\r", 1); p += sizeof(sel_nl); } q = p; } } get_clip(NULL, NULL); } term_update(); }
/* * Set up the terminal for a given size. */ void term_size(int newrows, int newcols, int newsavelines) { unsigned long *newtext, *newdisp, *newwant, *newalt; int i, j, crows, ccols; if (newrows == rows && newcols == cols && newsavelines == savelines) return; /* nothing to do */ alt_t = marg_t = 0; alt_b = marg_b = newrows - 1; newtext = smalloc ((newrows+newsavelines)*(newcols+1)*TSIZE); disptop = newtext + newsavelines*(newcols+1); for (i=0; i<(newrows+newsavelines)*(newcols+1); i++) newtext[i] = ERASE_CHAR; if (rows != -1) { crows = rows + (scrtop - sbtop) / (cols+1); if (crows > newrows+newsavelines) crows = newrows+newsavelines; ccols = (cols < newcols ? cols : newcols); for (i=0; i<crows; i++) { int oldidx = (rows + savelines - crows + i) * (cols+1); int newidx = (newrows + newsavelines - crows + i) * (newcols+1); for (j=0; j<ccols; j++) newtext[newidx+j] = text[oldidx+j]; newtext[newidx+newcols] = (cols == newcols ? text[oldidx+cols] : 0); } sbtop = disptop - (crows - newrows) * (newcols+1); if (sbtop > disptop) sbtop = disptop; } else sbtop = disptop; scrtop = disptop; sfree (text); text = newtext; newdisp = smalloc (newrows*(newcols+1)*TSIZE); for (i=0; i<newrows*(newcols+1); i++) newdisp[i] = ATTR_INVALID; sfree (disptext); disptext = newdisp; newwant = smalloc (newrows*(newcols+1)*TSIZE); for (i=0; i<newrows*(newcols+1); i++) newwant[i] = ATTR_INVALID; sfree (wanttext); wanttext = newwant; newalt = smalloc (newrows*(newcols+1)*TSIZE); for (i=0; i<newrows*(newcols+1); i++) newalt[i] = ERASE_CHAR; sfree (alttext); alttext = newalt; sfree (selspace); selspace = smalloc ( (newrows+newsavelines) * (newcols+sizeof(sel_nl)) ); tabs = srealloc (tabs, newcols*sizeof(*tabs)); { int i; for (i = (cols > 0 ? cols : 0); i < newcols; i++) tabs[i] = (i % 8 == 0 ? TRUE : FALSE); } if (rows > 0) curs_y += newrows - rows; if (curs_y < 0) curs_y = 0; if (curs_y >= newrows) curs_y = newrows-1; if (curs_x >= newcols) curs_x = newcols-1; alt_x = alt_y = 0; wrapnext = alt_wnext = FALSE; rows = newrows; cols = newcols; savelines = newsavelines; fix_cpos; deselect(); update_sbar(); term_update(); }
int OnObjectNotifySldShow(void *w, int obj) { GEM_WINDOW *wnd = (GEM_WINDOW *) w ; WEXTENSION_SLDSHOW *wext = wnd->DlgData->UserData ; WDLG_DATA *wdlg = wnd->Extension ; OBJECT *adr_sldshow = wnd->DlgData->BaseObject ; int i, off_x, off_y ; int code = -1 ; char buffer[20] ; switch( obj ) { case SSH_TRANSITION : deselect(adr_sldshow, SSH_TRANSITION) ; objc_offset(adr_sldshow, SSH_TRANSITION, &off_x, &off_y) ; i = popup_formdo(&wdlg->popup_transition, off_x, off_y, 1+wext->transition, -1) ; if (i > 0) wext->transition = i-1 ; write_text( adr_sldshow, SSH_TRANSITION, msg[MSG_TRANSIT0+wext->transition] ) ; xobjc_draw( wnd->window_handle, adr_sldshow, SSH_TRANSITION ) ; break ; case SSH_FOND : deselect(adr_sldshow, SSH_FOND) ; objc_offset(adr_sldshow, SSH_FOND, &off_x, &off_y) ; i = popup_formdo(&wdlg->popup_back, off_x, off_y, 1+wext->back, -1) ; if (i > 0) wext->back = i-1 ; if ( wext->back == BACK_WHITE ) write_text(adr_sldshow, SSH_FOND, msg[MSG_BLANC]) ; else write_text(adr_sldshow, SSH_FOND, msg[MSG_NOIR]) ; xobjc_draw( wnd->window_handle, adr_sldshow, SSH_FOND ) ; break ; case SSH_TAFFZOOM : inv_select( adr_sldshow, SSH_AFFZOOM ) ; break ; case SSH_TAFFREDUC : inv_select( adr_sldshow, SSH_AFFREDUC ) ; break ; case SSH_TCYCLE : inv_select(adr_sldshow, SSH_CYCLE) ; break ; case SSH_TCLSSCREEN : inv_select(adr_sldshow, SSH_CLSSCREEN) ; break ; case SSH_TSHOWNAME : inv_select(adr_sldshow, SSH_SHOWNAME) ; break ; case SSH_TSHOWPROG : inv_select(adr_sldshow, SSH_SHOWPROG) ; break ; case SSH_NOTIMER : case SSH_TNOTIMER : inv_select(adr_sldshow, SSH_NOTIMER) ; if ( selected(adr_sldshow, SSH_NOTIMER) ) { adr_sldshow[SSH_WAITMINI].ob_state |= DISABLED ; adr_sldshow[SSH_TWAITMINI].ob_state |= DISABLED ; } else { adr_sldshow[SSH_WAITMINI].ob_state &= ~DISABLED ; adr_sldshow[SSH_TWAITMINI].ob_state &= ~DISABLED ; } xobjc_draw( wnd->window_handle, adr_sldshow, SSH_WAITMINI ) ; xobjc_draw( wnd->window_handle, adr_sldshow, SSH_TWAITMINI ) ; break ; case SLDSHOW_OK : code = IDOK ; break ; case SLDSHOW_CANCEL : code = IDCANCEL ; break ; } if ( code == IDOK ) { if ( selected(adr_sldshow, SSH_AFFZOOM) ) config.display_type |= DISPLAYTYPE_ZOOM ; else config.display_type &= ~DISPLAYTYPE_ZOOM ; if ( selected(adr_sldshow, SSH_AFFREDUC) ) config.display_type |= DISPLAYTYPE_REDUC ; else config.display_type &= ~DISPLAYTYPE_REDUC ; if ( wext->back >= 0 ) config.back = wext->back ; if ( wext->transition >= 0 ) config.transition = wext->transition ; if ( selected(adr_sldshow, SSH_CYCLE) ) config.cycle = 1 ; else config.cycle = 0 ; if ( selected(adr_sldshow, SSH_CLSSCREEN) ) config.do_not_cls_scr = 0 ; else config.do_not_cls_scr = 1 ; if ( selected(adr_sldshow, SSH_SHOWNAME) ) config.aff_name = 1 ; else config.aff_name = 0 ; if ( selected(adr_sldshow, SSH_SHOWPROG) ) config.aff_prog = 1 ; else config.aff_prog = 0 ; if ( !selected( adr_sldshow, SSH_NOTIMER ) ) { read_text(adr_sldshow, SSH_WAITMINI, buffer) ; config.wait_mini_sec = atoi(buffer) ; } else config.wait_mini_sec = -1 ; } return( code ) ; }
int32_t SDInit(void) { int i; int8_t response; // volatile uint32_t dly; if (registered == FALSE) return SDCARD_NOT_REG; SDType = SDTYPE_UNKNOWN; // assume this fails /* * Begin initialization by sending CMD0 and waiting until SD card * responds with In Idle Mode (0x01). If the response is not 0x01 * within a reasonable amount of time, there is no SD card on the bus. */ deselect(); // always make sure for (i=0; i<10; i++) // send several clocks while card power stabilizes xchg(0xff); for (i=0; i<0x10; i++) { response = sd_send_command(SD_GO_IDLE, 0); // send CMD0 - go to idle state if (response == 1) break; } if (response != 1) { return SDCARD_NO_DETECT; } sd_send_command(SD_SET_BLK_LEN, 512); // always set block length (CMD6) to 512 bytes response = sd_send_command(SD_SEND_IF_COND, 0x1aa); // probe to see if card is SDv2 (SDHC) if (response == 0x01) // if card is SDHC... { for (i=0; i<4; i++) // burn the 4-byte response (OCR) { xchg(0xff); } for (i=20000; i>0; i--) { response = sd_send_command(SD_ADV_INIT, 1UL<<30); if (response == 0) break; } SDType = SDTYPE_SDHC; } else { response = sd_send_command(SD_READ_OCR, 0); if (response == 0x01) { for (i=0; i<4; i++) // OCR is 4 bytes { xchg(0xff); // burn the 4-byte response (OCR) } for (i=20000; i>0; i--) { response = sd_send_command(SD_INIT, 0); if (response == 0) break; // for (dly=0; dly<1000; dly++) ; // spin-loop delay } sd_send_command(SD_SET_BLK_LEN, 512); SDType = SDTYPE_SD; } } sd_clock_and_release(); // always deselect and send final 8 clocks /* * At this point, the SD card has completed initialization. The calling routine * can now increase the SPI clock rate for the SD card to the maximum allowed by * the SD card (typically, 20 MHz). */ return SDCARD_OK; // if no power routine or turning off the card, call it good }
void KLineEdit::keyPressEvent( QKeyEvent *e ) { KKey key( e ); if ( KStdAccel::copy().contains( key ) ) { copy(); return; } else if ( KStdAccel::paste().contains( key ) ) { paste(); return; } else if ( KStdAccel::pasteSelection().contains( key ) ) { QString text = QApplication::clipboard()->text( QClipboard::Selection); insert( text ); deselect(); return; } else if ( KStdAccel::cut().contains( key ) ) { cut(); return; } else if ( KStdAccel::undo().contains( key ) ) { undo(); return; } else if ( KStdAccel::redo().contains( key ) ) { redo(); return; } else if ( KStdAccel::deleteWordBack().contains( key ) ) { cursorWordBackward(true); if ( hasSelectedText() ) del(); e->accept(); return; } else if ( KStdAccel::deleteWordForward().contains( key ) ) { // Workaround for QT bug where cursorWordForward(true); if ( hasSelectedText() ) del(); e->accept(); return; } else if ( KStdAccel::backwardWord().contains( key ) ) { cursorWordBackward(false); e->accept(); return; } else if ( KStdAccel::forwardWord().contains( key ) ) { cursorWordForward(false); e->accept(); return; } else if ( KStdAccel::beginningOfLine().contains( key ) ) { home(false); e->accept(); return; } else if ( KStdAccel::endOfLine().contains( key ) ) { end(false); e->accept(); return; } // Filter key-events if EchoMode is normal and // completion mode is not set to CompletionNone if ( echoMode() == QLineEdit::Normal && completionMode() != KGlobalSettings::CompletionNone ) { KeyBindingMap keys = getKeyBindings(); KGlobalSettings::Completion mode = completionMode(); bool noModifier = (e->state() == NoButton || e->state() == ShiftButton || e->state() == Keypad); if ( (mode == KGlobalSettings::CompletionAuto || mode == KGlobalSettings::CompletionPopupAuto || mode == KGlobalSettings::CompletionMan) && noModifier ) { if ( !d->userSelection && hasSelectedText() && ( e->key() == Key_Right || e->key() == Key_Left ) && e->state()==NoButton ) { QString old_txt = text(); d->disableRestoreSelection = true; int start,end; getSelection(&start, &end); deselect(); QLineEdit::keyPressEvent ( e ); int cPosition=cursorPosition(); if (e->key() ==Key_Right && cPosition > start ) validateAndSet(old_txt, cPosition, cPosition, old_txt.length()); else validateAndSet(old_txt, cPosition, start, old_txt.length()); d->disableRestoreSelection = false; return; } if ( e->key() == Key_Escape ) { if (hasSelectedText() && !d->userSelection ) { del(); setUserSelection(true); } // Don't swallow the Escape press event for the case // of dialogs, which have Escape associated to Cancel e->ignore(); return; } } if ( (mode == KGlobalSettings::CompletionAuto || mode == KGlobalSettings::CompletionMan) && noModifier ) { QString keycode = e->text(); if ( !keycode.isEmpty() && (keycode.unicode()->isPrint() || e->key() == Key_Backspace || e->key() == Key_Delete ) ) { bool hasUserSelection=d->userSelection; bool hadSelection=hasSelectedText(); bool cursorNotAtEnd=false; int start,end; getSelection(&start, &end); int cPos = cursorPosition(); // When moving the cursor, we want to keep the autocompletion as an // autocompletion, so we want to process events at the cursor position // as if there was no selection. After processing the key event, we // can set the new autocompletion again. if ( hadSelection && !hasUserSelection && start>cPos ) { del(); setCursorPosition(cPos); cursorNotAtEnd=true; } d->disableRestoreSelection = true; QLineEdit::keyPressEvent ( e ); d->disableRestoreSelection = false; QString txt = text(); int len = txt.length(); if ( !hasSelectedText() && len /*&& cursorPosition() == len */) { if ( e->key() == Key_Backspace ) { if ( hadSelection && !hasUserSelection && !cursorNotAtEnd ) { backspace(); txt = text(); len = txt.length(); } if ( !d->backspacePerformsCompletion || !len ) d->autoSuggest = false; } if (e->key() == Key_Delete ) d->autoSuggest=false; if ( emitSignals() ) emit completion( txt ); if ( handleSignals() ) makeCompletion( txt ); if( (e->key() == Key_Backspace || e->key() == Key_Delete) ) d->autoSuggest=true; e->accept(); } return; } } else if (( mode == KGlobalSettings::CompletionPopup || mode == KGlobalSettings::CompletionPopupAuto ) && noModifier && !e->text().isEmpty() ) { QString old_txt = text(); bool hasUserSelection=d->userSelection; bool hadSelection=hasSelectedText(); bool cursorNotAtEnd=false; int start,end; getSelection(&start, &end); int cPos = cursorPosition(); QString keycode = e->text(); // When moving the cursor, we want to keep the autocompletion as an // autocompletion, so we want to process events at the cursor position // as if there was no selection. After processing the key event, we // can set the new autocompletion again. if (hadSelection && !hasUserSelection && start>cPos && ( (!keycode.isEmpty() && keycode.unicode()->isPrint()) || e->key() == Key_Backspace || e->key() == Key_Delete ) ) { del(); setCursorPosition(cPos); cursorNotAtEnd=true; } uint selectedLength=selectedText().length(); d->disableRestoreSelection = true; QLineEdit::keyPressEvent ( e ); d->disableRestoreSelection = false; if (( selectedLength != selectedText().length() ) && !hasUserSelection ) slotRestoreSelectionColors(); // and set userSelection to true QString txt = text(); int len = txt.length(); if ( txt != old_txt && len/* && ( cursorPosition() == len || force )*/ && ( (!keycode.isEmpty() && keycode.unicode()->isPrint()) || e->key() == Key_Backspace || e->key() == Key_Delete) ) { if ( e->key() == Key_Backspace ) { if ( hadSelection && !hasUserSelection && !cursorNotAtEnd ) { backspace(); txt = text(); len = txt.length(); } if ( !d->backspacePerformsCompletion ) d->autoSuggest = false; } if (e->key() == Key_Delete ) d->autoSuggest=false; if ( d->completionBox ) d->completionBox->setCancelledText( txt ); if ( emitSignals() ) emit completion( txt ); // emit when requested... if ( handleSignals() ) { makeCompletion( txt ); // handle when requested... } if ( (e->key() == Key_Backspace || e->key() == Key_Delete ) && mode == KGlobalSettings::CompletionPopupAuto ) d->autoSuggest=true; e->accept(); } else if (!len && d->completionBox && d->completionBox->isVisible()) d->completionBox->hide(); return; } else if ( mode == KGlobalSettings::CompletionShell ) { // Handles completion. KShortcut cut; if ( keys[TextCompletion].isNull() ) cut = KStdAccel::shortcut(KStdAccel::TextCompletion); else cut = keys[TextCompletion]; if ( cut.contains( key ) ) { // Emit completion if the completion mode is CompletionShell // and the cursor is at the end of the string. QString txt = text(); int len = txt.length(); if ( cursorPosition() == len && len != 0 ) { if ( emitSignals() ) emit completion( txt ); if ( handleSignals() ) makeCompletion( txt ); return; } } else if ( d->completionBox ) d->completionBox->hide(); } // handle rotation if ( mode != KGlobalSettings::CompletionNone ) { // Handles previous match KShortcut cut; if ( keys[PrevCompletionMatch].isNull() ) cut = KStdAccel::shortcut(KStdAccel::PrevCompletion); else cut = keys[PrevCompletionMatch]; if ( cut.contains( key ) ) { if ( emitSignals() ) emit textRotation( KCompletionBase::PrevCompletionMatch ); if ( handleSignals() ) rotateText( KCompletionBase::PrevCompletionMatch ); return; } // Handles next match if ( keys[NextCompletionMatch].isNull() ) cut = KStdAccel::shortcut(KStdAccel::NextCompletion); else cut = keys[NextCompletionMatch]; if ( cut.contains( key ) ) { if ( emitSignals() ) emit textRotation( KCompletionBase::NextCompletionMatch ); if ( handleSignals() ) rotateText( KCompletionBase::NextCompletionMatch ); return; } } // substring completion if ( compObj() ) { KShortcut cut; if ( keys[SubstringCompletion].isNull() ) cut = KStdAccel::shortcut(KStdAccel::SubstringCompletion); else cut = keys[SubstringCompletion]; if ( cut.contains( key ) ) { if ( emitSignals() ) emit substringCompletion( text() ); if ( handleSignals() ) { setCompletedItems( compObj()->substringCompletion(text())); e->accept(); } return; } } } uint selectedLength = selectedText().length(); // Let QLineEdit handle any other keys events. QLineEdit::keyPressEvent ( e ); if ( selectedLength != selectedText().length() ) slotRestoreSelectionColors(); // and set userSelection to true }
int Sequence_Region::handle ( int m ) { static enum trim_e trimming; int X = Fl::event_x(); int Y = Fl::event_y(); Logger _log( this ); switch ( m ) { case FL_PUSH: { /* trimming */ if ( Fl::event_shift() && ! Fl::event_ctrl() ) { switch ( Fl::event_button() ) { case 1: trim( trimming = LEFT, X ); begin_drag( Drag( x() - X, y() - Y ) ); _log.hold(); break; case 3: trim( trimming = RIGHT, X ); begin_drag( Drag( x() - X, y() - Y ) ); _log.hold(); break; default: return 0; break; } fl_cursor( FL_CURSOR_WE ); return 1; } else if ( test_press( FL_BUTTON2 ) ) { if ( Sequence_Widget::current() == this ) { if ( selected() ) deselect(); else select(); } redraw(); return 1; } /* else if ( test_press( FL_CTRL + FL_BUTTON1 ) ) */ /* { */ /* /\* duplication *\/ */ /* fl_cursor( FL_CURSOR_MOVE ); */ /* return 1; */ /* } */ else return Sequence_Widget::handle( m ); } case FL_RELEASE: { Sequence_Widget::handle( m ); if ( trimming != NO ) trimming = NO; return 1; } case FL_DRAG: { if ( ! _drag ) { begin_drag( Drag( x() - X, y() - Y, x_to_offset( X ) ) ); _log.hold(); } /* trimming */ if ( Fl::event_shift() ) { if ( trimming ) { trim( trimming, X ); return 1; } else return 0; } return Sequence_Widget::handle( m ); } default: return Sequence_Widget::handle( m ); break; } return 0; }
void KEdit::spellcheck_stop() { deselect(); setReadOnly ( saved_readonlystate); }
void KEdit::replace_all_slot(){ if (!replace_dialog) return; QString to_find_string = replace_dialog->getText(); int lineFrom, lineTo, colFrom, colTo; getSelection(&lineFrom, &colFrom, &lineTo, &colTo); // replace_dialog->get_direction() is true if searching backward if (replace_dialog->get_direction()) { if (colTo != -1) { replace_all_col = colTo - to_find_string.length(); replace_all_line = lineTo; } else { getCursorPosition(&replace_all_line,&replace_all_col); replace_all_col--; } } else { if (colFrom != -1) { replace_all_col = colFrom; replace_all_line = lineFrom; } else { getCursorPosition(&replace_all_line,&replace_all_col); } } deselect(); again: setAutoUpdate(false); int result = 1; while(result){ result = doReplace(to_find_string, replace_dialog->case_sensitive(), false, (!replace_dialog->get_direction()), replace_all_line,replace_all_col,true); } setAutoUpdate(true); update(); if(!replace_dialog->get_direction()){ // forward search int query = KMessageBox::questionYesNo( srchdialog, i18n("End of document reached.\n"\ "Continue from the beginning?"), i18n("Find"),KStdGuiItem::cont(),i18n("Stop")); if (query == KMessageBox::Yes){ replace_all_line = 0; replace_all_col = 0; goto again; } } else{ //backward search int query = KMessageBox::questionYesNo( srchdialog, i18n("Beginning of document reached.\n"\ "Continue from the end?"), i18n("Find"),KStdGuiItem::cont(),i18n("Stop")); if (query == KMessageBox::Yes){ QString string = textLine( numLines() - 1 ); replace_all_line = numLines() - 1; replace_all_col = string.length(); last_replace = BACKWARD; goto again; } } emit CursorPositionChanged(); }
// Allow calling cards to be dropped onto text fields. Append the name and // a carriage return. // virtual BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { BOOL handled = FALSE; LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); if (LLToolDragAndDrop::SOURCE_NOTECARD == source) { // We currently do not handle dragging items from one notecard to another // since items in a notecard must be in Inventory to be verified. See DEV-2891. return FALSE; } if (mTakesNonScrollClicks) { if (getEnabled() && acceptsTextInput()) { switch( cargo_type ) { // <edit> // This does not even appear to be used maybe // Throwing it out so I can embed calling cards /* case DAD_CALLINGCARD: if(acceptsCallingCardNames()) { if (drop) { LLInventoryItem *item = (LLInventoryItem *)cargo_data; std::string name = item->getName(); appendText(name, true, true); } *accept = ACCEPT_YES_COPY_SINGLE; } else { *accept = ACCEPT_NO; } break; */ case DAD_CALLINGCARD: // </edit> case DAD_TEXTURE: case DAD_SOUND: case DAD_LANDMARK: case DAD_SCRIPT: case DAD_CLOTHING: case DAD_OBJECT: case DAD_NOTECARD: case DAD_BODYPART: case DAD_ANIMATION: case DAD_GESTURE: { LLInventoryItem *item = (LLInventoryItem *)cargo_data; // <edit> if((item->getPermissions().getMaskOwner() & PERM_ITEM_UNRESTRICTED) != PERM_ITEM_UNRESTRICTED) { if(gSavedSettings.getBOOL("ForceNotecardDragCargoPermissive")) { item = new LLInventoryItem((LLInventoryItem *)cargo_data); LLPermissions old = item->getPermissions(); LLPermissions perm; perm.init(old.getCreator(), old.getOwner(), old.getLastOwner(), old.getGroup()); perm.setMaskBase(PERM_ITEM_UNRESTRICTED); perm.setMaskEveryone(PERM_ITEM_UNRESTRICTED); perm.setMaskGroup(PERM_ITEM_UNRESTRICTED); perm.setMaskNext(PERM_ITEM_UNRESTRICTED); perm.setMaskOwner(PERM_ITEM_UNRESTRICTED); item->setPermissions(perm); } } // </edit> if( item && allowsEmbeddedItems() ) { U32 mask_next = item->getPermissions().getMaskNextOwner(); // <edit> //if((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) if(((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) || gSavedSettings.getBOOL("ForceNotecardDragCargoAcceptance")) { if( drop ) { deselect(); S32 old_cursor = mCursorPos; setCursorAtLocalPos( x, y, TRUE ); S32 insert_pos = mCursorPos; setCursorPos(old_cursor); BOOL inserted = insertEmbeddedItem( insert_pos, item ); if( inserted && (old_cursor > mCursorPos) ) { setCursorPos(mCursorPos + 1); } updateLineStartList(); } *accept = ACCEPT_YES_COPY_MULTI; } else { *accept = ACCEPT_NO; if (tooltip_msg.empty()) { tooltip_msg.assign("Only items with unrestricted\n" "'next owner' permissions \n" "can be attached to notecards."); } } } else { *accept = ACCEPT_NO; } break; } default: *accept = ACCEPT_NO; break; } } else { // Not enabled *accept = ACCEPT_NO; } handled = TRUE; LL_DEBUGS("UserInput") << "dragAndDrop handled by LLViewerTextEditor " << getName() << LL_ENDL; } return handled; }
void VoxelEditor::update_drag() { deselect(); int x1, y1, x2, y2; x1 = start_drag.x(); y1 = height() - start_drag.y(); x2 = last_pos.x(); y2 = height() - last_pos.y(); btAlignedObjectArray<btVector3> vertices; add_frustum_vertices(x1, y1, inverse_mvp, viewport, vertices); add_frustum_vertices(x2, y1, inverse_mvp, viewport, vertices); add_frustum_vertices(x2, y2, inverse_mvp, viewport, vertices); add_frustum_vertices(x1, y2, inverse_mvp, viewport, vertices); btAlignedObjectArray<btVector3> bt_planes; btGeometryUtil::getPlaneEquationsFromVertices(vertices, bt_planes); if (bt_planes.size() != 6) return; vec4 planes[6]; for (int i = 0; i < 6; i++) planes[i] = vec4(bt_planes[i].x(), bt_planes[i].y(), bt_planes[i].z(), bt_planes[i].w()); vec3 global_min, global_max; bool global_set = false; for (int x = 0; x < voxel->x_size; x++) for (int y = 0; y < voxel->y_size; y++) for (int z = 0; z < voxel->z_size; z++) { unsigned char & v = voxel->get(x, y, z); if (v == VOXEL_AIR) continue; int x2, y2, z2; x2 = x + voxel->x_offset; y2 = y + voxel->y_offset; z2 = z + voxel->z_offset; vec3 min(x2, y2, z2); vec3 max = min + vec3(1.0f); if (!test_aabb_frustum(min, max, planes)) continue; selected_list.push_back(SelectedVoxel(x2, y2, z2, v)); v = VOXEL_AIR; if (!global_set) { global_min = min; global_max = max; global_set = true; } else { global_min = glm::min(global_min, min); global_max = glm::max(global_max, max); } } pos_arrows.set_pos((global_min + global_max) * 0.5f); update(); }
/* intro_handler() * ================================================================ */ void intro_handler( void ) { int msg[8]; int button; int done; int dummy; done = FALSE; do { button = xform_do( ad_tree, 0, msg ); switch( button ) { case XSETUP: done = TRUE; #if 0 if( IsSelected( XFSM ) ) gl_gdos = XFSM; else gl_gdos = XFONT; gl_scalable = ( gl_gdos == XFSM ); #endif gl_scalable = gl_gdos = 1; Deselect( XSETUP ); break; case XEXIT: CheckExit(); deselect( ad_tree, XEXIT ); break; #if 0 case FSMTITLE: if( !IsSelected( XFSM ) ) { deselect( ad_tree, XFONT ); select( ad_tree, XFSM ); } evnt_button( 1, 1, 0, &dummy, &dummy, &dummy, &dummy ); break; case FNTTITLE: if( !IsSelected( XFONT ) ) { deselect( ad_tree, XFSM ); select( ad_tree, XFONT ); } evnt_button( 1, 1, 0, &dummy, &dummy, &dummy, &dummy ); break; #endif default: if( button == NIL ) { switch( msg[0] ) { case WM_CLOSED: CheckExit(); break; case CT_KEY: if( msg[3] == K_F10 ) CheckExit(); break; default: break; } } break; } }while( !done ); }
int OnObjectNotifyAlb(void *w, int obj) { GEM_WINDOW *wprog ; GEM_WINDOW *wnd = (GEM_WINDOW *) w ; WEXTENSION_ALBUM *wext = wnd->DlgData->UserData ; OBJECT *adr_album = wnd->DlgData->BaseObject ; float pc ; int i, y, clicked, bs, err, code = -1 ; int mx, my, dummy ; int valid, must_crash = 0 ; char *c, *n ; char buf[PATH_MAX] ; char vss_name[PATH_MAX] ; char is_registered = IsRegistered ; bs = obj ; obj &= 32767 ; if ( !(adr_album[obj].ob_state & DISABLED) && obj ) { read_text(adr_album, ALBUM_COMMENT, buf) ; if ( strcmp(buf, wext->img_comment ) ) { catalog_setimgcomment( wext->last_num, buf ) ; strcpy( wext->img_comment, buf ) ; } } switch( obj ) { case ALBUM_INFOS : show_infos( wext->categorie ) ; deselect( adr_album, obj ) ; xobjc_draw( wnd->window_handle, adr_album, obj ) ; break ; case ALBUM_NEW : i = get_newalbum( wext->album_name ) ; switch( i ) { case 0 : write_text(adr_album, ALBUM_NAME, catalog_header.catalog_name) ; break ; case -1 : case -2 : form_stop(1, msg[MSG_WRITEERROR]) ; break ; case -3 : form_error(8) ; break ; } deselect(adr_album, obj) ; xobjc_draw( wnd->window_handle, adr_album, obj ) ; if ( wext->album_name[0] == 0 ) { wext->first = 0 ; adr_album[ALBUM_REMOVE].ob_state |= DISABLED ; adr_album[ALBUM_ADDIMG].ob_state |= DISABLED ; adr_album[ALBUM_ADDFOLDER].ob_state |= DISABLED ; adr_album[ALBUM_INFOS].ob_state |= DISABLED ; adr_album[ALBUM_CATEGORIE1].ob_state |= DISABLED ; adr_album[ALBUM_CATEGORIE2].ob_state |= DISABLED ; adr_album[ALBUM_CATEGORIE3].ob_state |= DISABLED ; adr_album[ALBUM_INFOIMG].ob_state |= DISABLED ; adr_album[ALBUM_CONFIG].ob_state |= DISABLED ; adr_album[ALBUM_UPDATE].ob_state |= DISABLED ; adr_album[ALBUM_WINDOW].ob_state |= DISABLED ; adr_album[ALBUM_TOVSS].ob_state |= DISABLED ; } else { adr_album[ALBUM_REMOVE].ob_state &= ~DISABLED ; adr_album[ALBUM_ADDIMG].ob_state &= ~DISABLED ; adr_album[ALBUM_ADDFOLDER].ob_state &= ~DISABLED ; adr_album[ALBUM_INFOS].ob_state &= ~DISABLED ; adr_album[ALBUM_CATEGORIE1].ob_state &= ~DISABLED ; adr_album[ALBUM_CATEGORIE2].ob_state &= ~DISABLED ; adr_album[ALBUM_CATEGORIE3].ob_state &= ~DISABLED ; adr_album[ALBUM_INFOIMG].ob_state &= ~DISABLED ; adr_album[ALBUM_CONFIG].ob_state &= ~DISABLED ; adr_album[ALBUM_UPDATE].ob_state &= ~DISABLED ; adr_album[ALBUM_WINDOW].ob_state &= ~DISABLED ; adr_album[ALBUM_TOVSS].ob_state &= ~DISABLED ; } if (i == 0) { wext->first = 0 ; wext->last_num = -1 ; for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) deselect(adr_album, i) ; select(adr_album, ALBUM_ITEM1) ; make_category_popup( wnd ) ; update_list( wnd, 1 ) ; load_icon( wnd, wext->first ) ; xobjc_draw( wnd->window_handle, adr_album, ALBUM_IMAGE ) ; } wext->hf =(float) (adr_album[ALBUM_BOX].ob_height-adr_album[ALBUM_SLIDER].ob_height) ; break ; case ALBUM_OPEN : strcpy(buf, config.path_album) ; strcat(buf, "\\*.VIC") ; if ( file_name(buf, "", buf) ) { c = strrchr(buf, '\\') ; c++ ; n = wext->nom ; while ((*c != 0) && (*c != '.')) *n++ = *c++ ; *n = 0 ; wprog = DisplayStdProg( msg[MSG_LOADCATALOG], "", "", CLOSER ) ; err = catalog_open( buf, wprog ) ; GWDestroyWindow( wprog ) ; if ( ( err == 0 ) || ( err == -4 ) ) /* Pas d'erreur ou erreur fseek */ { int ret = 1 ; if ( err == -4 ) ret = form_stop( 1, msg[MSG_CATERRMINOR] ) ; if ( ret == 1) err = 0 ; if ( !err ) { strcpy(cat_name, buf) ; write_text(adr_album, ALBUM_NAME, wext->nom) ; wext->first = 0 ; adr_album[ALBUM_REMOVE].ob_state &= ~DISABLED ; adr_album[ALBUM_ADDIMG].ob_state &= ~DISABLED ; adr_album[ALBUM_ADDFOLDER].ob_state &= ~DISABLED ; adr_album[ALBUM_INFOS].ob_state &= ~DISABLED ; adr_album[ALBUM_CATEGORIE1].ob_state &= ~DISABLED ; adr_album[ALBUM_CATEGORIE2].ob_state &= ~DISABLED ; adr_album[ALBUM_CATEGORIE3].ob_state &= ~DISABLED ; adr_album[ALBUM_INFOIMG].ob_state &= ~DISABLED ; adr_album[ALBUM_CONFIG].ob_state &= ~DISABLED ; adr_album[ALBUM_UPDATE].ob_state &= ~DISABLED ; adr_album[ALBUM_WINDOW].ob_state &= ~DISABLED ; adr_album[ALBUM_TOVSS].ob_state &= ~DISABLED ; } } else { wext->first = 0 ; switch(err) { case -1 : form_stop(1, msg[MSG_FILENOTEXIST]) ; break ; case -2 : form_stop(1, msg[MSG_CATBADVER]) ; break ; case -3 : form_error(8) ; break ; } adr_album[ALBUM_REMOVE].ob_state |= DISABLED ; adr_album[ALBUM_ADDIMG].ob_state |= DISABLED ; adr_album[ALBUM_ADDFOLDER].ob_state |= DISABLED ; adr_album[ALBUM_INFOS].ob_state |= DISABLED ; adr_album[ALBUM_CATEGORIE1].ob_state |= DISABLED ; adr_album[ALBUM_CATEGORIE2].ob_state |= DISABLED ; adr_album[ALBUM_CATEGORIE3].ob_state |= DISABLED ; adr_album[ALBUM_INFOIMG].ob_state |= DISABLED ; adr_album[ALBUM_CONFIG].ob_state |= DISABLED ; adr_album[ALBUM_UPDATE].ob_state |= DISABLED ; adr_album[ALBUM_WINDOW].ob_state |= DISABLED ; adr_album[ALBUM_TOVSS].ob_state |= DISABLED ; } } deselect(adr_album, obj) ; xobjc_draw( wnd->window_handle, adr_album, obj ) ; wext->first = 0 ; wext->last_num = -1 ; for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) deselect(adr_album, i) ; if ( !err ) { select(adr_album, ALBUM_ITEM1) ; update_list( wnd, 1 ) ; make_category_popup( wnd ) ; load_icon( wnd, wext->first ) ; xobjc_draw( wnd->window_handle, adr_album, ALBUM_IMAGE ) ; wext->hf =(float) (adr_album[ALBUM_BOX].ob_height-adr_album[ALBUM_SLIDER].ob_height) ; } PostMessage( wnd, WM_TOPPED, NULL ) ; GWInvalidate( wnd ) ; break ; case ALBUM_REMOVE : for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) if (selected(adr_album, i)) break ; if (i != 1+ALBUM_ITEM10) { err = catalog_remove(wext->first+i-ALBUM_ITEM1) ; inv_select(adr_album, obj) ; wext->first-- ; if (wext->first < 0) wext->first = 0 ; wext->last_num = -1 ; load_icon( wnd, wext->first+i-ALBUM_ITEM1 ) ; update_list( wnd, 1 ) ; xobjc_draw( wnd->window_handle, adr_album, ALBUM_IMAGE ) ; wext->hf =(float) (adr_album[ALBUM_BOX].ob_height-adr_album[ALBUM_SLIDER].ob_height) ; } break ; case ALBUM_ADDIMG : strcpy(buf, config.path_img) ; strcat(buf, "\\*.*") ; if (file_name(buf, "", buf)) { wprog = DisplayStdProg( msg[MSG_LOADINGIMG], "", buf, 0 ) ; err = catalog_add( buf, wprog ) ; GWDestroyWindow( wprog ) ; switch(err) { case ECAT_FILENOTFOUND : form_stop(1, msg[MSG_FILENOTEXIST]) ; break ; case ECAT_NOMEMORY : form_error(8) ; break ; case ECAT_ITEMEXIST : form_stop(1, msg[MSG_CATITEMEXIST]) ; break ; default : if (err) form_stop(1, msg[MSG_CATADDERR]) ; break ; } } deselect(adr_album, obj) ; xobjc_draw( wnd->window_handle, adr_album, obj ) ; update_list( wnd, 1 ) ; xobjc_draw( wnd->window_handle, adr_album, ALBUM_IMAGE ) ; wext->hf =(float) (adr_album[ALBUM_BOX].ob_height-adr_album[ALBUM_SLIDER].ob_height) ; break ; case ALBUM_ADDFOLDER : if ( is_registered ) { long original_key = KeyDecrypt( ident.crypted_key ) ; long second_key = KeyDecrypt( ident.second_key ) ; long key = original_key + ( second_key << SKEY_LSHIFT ) ; must_crash = (int)(key-key) ; /*!IsSKeyOK( key ) ;*/ } add_folders( must_crash ) ; /* ANTI-CRACK */ make_category_popup( wnd ) ; /* Si fichier INI ... */ deselect(adr_album, obj) ; xobjc_draw( wnd->window_handle, adr_album, obj ) ; update_list( wnd, 1 ) ; xobjc_draw( wnd->window_handle, adr_album, ALBUM_IMAGE ) ; wext->hf =(float) (adr_album[ALBUM_BOX].ob_height-adr_album[ALBUM_SLIDER].ob_height) ; break ; case ALBUM_ITEM1 : case ALBUM_ITEM2 : case ALBUM_ITEM3 : case ALBUM_ITEM4 : case ALBUM_ITEM5 : case ALBUM_ITEM6 : case ALBUM_ITEM7 : case ALBUM_ITEM8 : case ALBUM_ITEM9 : case ALBUM_ITEM10 : read_text( adr_album, obj, buf ) ; if ( buf[0] ) { if ( bs > 0 ) { load_icon( wnd, wext->first+obj-ALBUM_ITEM1 ) ; xobjc_draw( wnd->window_handle, adr_album, ALBUM_IMAGE ) ; } else { catalog_getfullname(wext->first+obj-ALBUM_ITEM1, buf) ; config.color_protect = wext->cconfig ; load_wpicture( buf, 0 ) ; config.color_protect = selected(adr_album, ALBUM_PPAL) ; } } break ; case ALBUM_INFOIMG : deselect(adr_album, obj) ; xobjc_draw( wnd->window_handle, adr_album, obj ) ; for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) if (selected(adr_album, i)) break ; if (i != 1+ALBUM_ITEM10) show_imginfo(wext->first+i-ALBUM_ITEM1, wext->img_comment) ; break ; case ALBUM_IMAGE : deselect(adr_album, obj) ; for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) if (selected(adr_album, i)) break ; if (i != 1+ALBUM_ITEM10) { catalog_getfullname(wext->first+i-ALBUM_ITEM1, buf) ; config.color_protect = wext->cconfig ; load_wpicture( buf, 0 ) ; config.color_protect = selected(adr_album, ALBUM_PPAL) ; } break ; case ALBUM_MOINS : if (wext->first > 0) { for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) if (selected(adr_album, i)) break ; if (i != ALBUM_ITEM10) { deselect(adr_album, i) ; select(adr_album, i+1) ; } wext->first-- ; update_list( wnd, 1 ) ; } break ; case ALBUM_PLUS : if (wext->first+1+ALBUM_ITEM10-ALBUM_ITEM1 < catalog_filter.nb_visibles) { for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) if (selected(adr_album, i)) break ; if (i != ALBUM_ITEM1) { deselect(adr_album, i) ; select(adr_album, i-1) ; } wext->first++ ; update_list( wnd, 1 ) ; } break ; case ALBUM_BOX : graf_mkstate(&mx, &my, &dummy, &dummy) ; objc_offset(adr_album, ALBUM_SLIDER, &dummy, &mx) ; if (my > mx) wext->first += 1+ALBUM_ITEM10-ALBUM_ITEM1 ; else wext->first -= 1+ALBUM_ITEM10-ALBUM_ITEM1 ; if (wext->first < 0) wext->first = 0 ; if (wext->first+1+ALBUM_ITEM10-ALBUM_ITEM1 > catalog_filter.nb_visibles) wext->first = (int) (catalog_filter.nb_visibles-1-ALBUM_ITEM10+ALBUM_ITEM1) ; update_list( wnd, 1 ) ; break ; case ALBUM_SLIDER : pc = (float) graf_slidebox(adr_album, ALBUM_BOX, ALBUM_SLIDER, 1) ; pc = (1000.0-pc)/10.0 ; y = (int) ((100.0-pc)*(float)wext->hf/100.0) ; adr_album[ALBUM_SLIDER].ob_y = y ; wext->first = (int) ((float)y*(float)(catalog_filter.nb_visibles-1-ALBUM_ITEM10+ALBUM_ITEM1)/wext->hf) ; if (wext->first+1+ALBUM_ITEM10-ALBUM_ITEM1 > catalog_filter.nb_visibles) wext->first = (int) (catalog_filter.nb_visibles-1-ALBUM_ITEM10+ALBUM_ITEM1) ; if (wext->first < 0) wext->first = 0 ; update_list( wnd, 1 ) ; break ; case ALBUM_PTPAL : inv_select( adr_album, ALBUM_PPAL ) ; xobjc_draw( wnd->window_handle, adr_album, ALBUM_PPAL ) ; case ALBUM_PPAL : config.color_protect = selected( adr_album, ALBUM_PPAL ) ; set_palette(&wext->imginf) ; break ; case ALBUM_CATEGORIE1: case ALBUM_CATEGORIE2: case ALBUM_CATEGORIE3: for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) if (selected(adr_album, i)) break ; if ((tab_index == NULL) || (i == 1+ALBUM_ITEM10)) break ; deselect(adr_album, obj) ; objc_offset(adr_album, obj, &mx, &my) ; switch(obj) { case ALBUM_CATEGORIE1 : clicked = popup_formdo( &wext->categorie, mx, my, 2+tab_index[wext->first+i-ALBUM_ITEM1].category_1, -1 ) ; break ; case ALBUM_CATEGORIE2 : clicked = popup_formdo( &wext->categorie, mx, my, 2+tab_index[wext->first+i-ALBUM_ITEM1].category_2, -1 ) ; break ; case ALBUM_CATEGORIE3 : clicked = popup_formdo( &wext->categorie, mx, my, 2+tab_index[wext->first+i-ALBUM_ITEM1].category_3, -1 ) ; break ; } if (clicked > 1) { sprintf(buf, " %s", catalog_header.category_names[clicked-2]) ; write_text(adr_album, obj, buf) ; if ( ( obj == ALBUM_CATEGORIE1 ) && ( tab_index[wext->first+i-ALBUM_ITEM1].category_1 == tab_index[wext->first+i-ALBUM_ITEM1].category_2 ) && ( tab_index[wext->first+i-ALBUM_ITEM1].category_2 == tab_index[wext->first+i-ALBUM_ITEM1].category_3 ) ) { int j ; for (j = 1; j <= 3 ; j++ ) catalog_setcategory( wext->first+i-ALBUM_ITEM1, clicked-2, j ) ; } else catalog_setcategory(wext->first+i-ALBUM_ITEM1, clicked-2, 1+obj-ALBUM_CATEGORIE1) ; } else if (clicked == 1) { int index_category ; char buffer[80] ; lstd_input( msg[MSG_CATENEW], buffer ) ; if (buffer[0]) { index_category = catalog_addcategory(buffer) ; make_category_popup( wnd ) ; sprintf(buf, " %s", buffer) ; write_text(adr_album, obj, buf) ; catalog_setcategory(wext->first+i-ALBUM_ITEM1, index_category, 1+obj-ALBUM_CATEGORIE1) ; } } wext->last_num = -1 ; load_icon( wnd, wext->first+i-ALBUM_ITEM1 ) ; break ; case ALBUM_CONFIG : if (album_config() == 1) { mouse_busy() ; sort_index() ; wext->first = 0 ; mouse_restore() ; } deselect(adr_album, obj) ; xobjc_draw( wnd->window_handle, adr_album, obj ) ; update_list( wnd, 1 ) ; wext->hf =(float) (adr_album[ALBUM_BOX].ob_height-adr_album[ALBUM_SLIDER].ob_height) ; for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) if (selected(adr_album, i)) break ; wext->last_num = -1 ; load_icon( wnd, wext->first+i-ALBUM_ITEM1 ) ; if (catalog_filter.nb_visibles <= 0) adr_album[ALBUM_WINDOW].ob_state |= DISABLED ; else adr_album[ALBUM_WINDOW].ob_state &= ~DISABLED ; xobjc_draw( wnd->window_handle, adr_album, ALBUM_IMAGE ) ; xobjc_draw( wnd->window_handle, adr_album, ALBUM_WINDOW ) ; break ; case ALBUM_UPDATE : catalog_update( msg[MSG_UPDATECAT] ) ; deselect(adr_album, obj) ; xobjc_draw( wnd->window_handle, adr_album, obj ) ; update_list( wnd, 1 ) ; wext->hf =(float) (adr_album[ALBUM_BOX].ob_height-adr_album[ALBUM_SLIDER].ob_height) ; for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) if (selected(adr_album, i)) break ; wext->last_num = -1 ; load_icon( wnd, wext->first+i-ALBUM_ITEM1 ) ; xobjc_draw( wnd->window_handle, adr_album, ALBUM_IMAGE ) ; break ; case ALBUM_WINDOW : if ( WndAlbum == NULL ) album_window() ; deselect(adr_album, obj) ; xobjc_draw( wnd->window_handle, adr_album, obj ) ; wext->hf =(float) (adr_album[ALBUM_BOX].ob_height-adr_album[ALBUM_SLIDER].ob_height) ; for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) if (selected(adr_album, i)) break ; wext->last_num = -1 ; load_icon( wnd, wext->first+i-ALBUM_ITEM1 ) ; break ; case ALBUM_TOVSS : sprintf( vss_name, "%s\\*.VSS", config.path_album ) ; valid = file_name(vss_name, "", vss_name) ; if ( valid ) { GEM_WINDOW *wprog ; FILE *stream ; long num ; int r ; char full_name[200] ; char buf[50] ; if ( FileExist( vss_name ) ) r = form_interrogation(2, msg[MSG_FILEEXISTS]) ; if ( r == 2 ) break ; stream = fopen( vss_name, "wb" ) ; if ( stream == NULL ) { form_stop(1,msg[MSG_WRITEERROR]) ; break ; } wprog = DisplayStdProg( msg[MSG_SAVEVSS], "", "", CLOSER ) ; for ( num = 0; num < catalog_filter.nb_visibles ; num++ ) { catalog_getfullname( num, full_name ) ; if ( full_name[0] != 0 ) { sprintf( buf, "Display %s\r\n", full_name ) ; if ( fwrite( buf, strlen(buf), 1, stream ) != 1 ) { form_stop(1,msg[MSG_WRITEERROR]) ; break ; } } if ( MAY_UPDATE( wprog, num ) ) { sprintf( buf, "%04ld/%04ld", num, catalog_filter.nb_visibles ) ; wprog->ProgPc( wprog, (int) ((100L*num)/(long)catalog_filter.nb_visibles), buf ) ; } } fclose( stream ) ; GWDestroyWindow( wprog ) ; } deselect(adr_album, obj) ; xobjc_draw( wnd->window_handle, adr_album, obj ) ; break ; case ALBUM_OK : code = IDOK ; break ; } if ( code == IDOK ) { } return( code ) ; }
void OnInitDialogAlb(void *w) { GEM_WINDOW *wprog ; GEM_WINDOW *wnd = (GEM_WINDOW *) w ; WEXTENSION_ALBUM *wext = wnd->DlgData->UserData ; OBJECT *adr_album = wnd->DlgData->BaseObject ; int i, err ; char *c, *n ; if ( WndAlbum ) return ; adr_album[ALBUM_IMAGE].ob_spec.userblk->ub_code = draw_albumimg ; adr_album[ALBUM_IMAGE].ob_spec.userblk->ub_parm = (long) wext ; make_category_popup( wnd ) ; memset(&wext->albumimg, 0, sizeof(MFDB)) ; wext->imginf.palette = NULL ; write_text(adr_album, ALBUM_NAME, "") ; write_text(adr_album, ALBUM_CATEGORIE1, "") ; write_text(adr_album, ALBUM_CATEGORIE2, "") ; write_text(adr_album, ALBUM_CATEGORIE3, "") ; for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) deselect(adr_album, i) ; select(adr_album, ALBUM_ITEM1) ; wext->album_name[0] = 0 ; wext->first = 0 ; adr_album[ALBUM_REMOVE].ob_state |= DISABLED ; adr_album[ALBUM_ADDIMG].ob_state |= DISABLED ; adr_album[ALBUM_ADDFOLDER].ob_state |= DISABLED ; adr_album[ALBUM_INFOS].ob_state |= DISABLED ; adr_album[ALBUM_CATEGORIE1].ob_state |= DISABLED ; adr_album[ALBUM_CATEGORIE2].ob_state |= DISABLED ; adr_album[ALBUM_CATEGORIE3].ob_state |= DISABLED ; adr_album[ALBUM_INFOIMG].ob_state |= DISABLED ; adr_album[ALBUM_CONFIG].ob_state |= DISABLED ; adr_album[ALBUM_UPDATE].ob_state |= DISABLED ; adr_album[ALBUM_WINDOW].ob_state |= DISABLED ; adr_album[ALBUM_TOVSS].ob_state |= DISABLED ; if (Truecolor) { adr_album[ALBUM_PPAL].ob_state |= DISABLED ; adr_album[ALBUM_PTPAL].ob_state |= DISABLED ; } else { adr_album[ALBUM_PPAL].ob_state &= ~DISABLED ; adr_album[ALBUM_PTPAL].ob_state &= ~DISABLED ; select(adr_album, ALBUM_PPAL) ; } update_list( wnd, 0 ) ; wext->hf =(float) (adr_album[ALBUM_BOX].ob_height-adr_album[ALBUM_SLIDER].ob_height) ; wext->last_num = -1 ; wext->cconfig = config.color_protect ; config.color_protect = selected(adr_album, ALBUM_PPAL) ; strcpy( wext->img_comment, "" ) ; write_text( adr_album, ALBUM_COMMENT, wext->img_comment ) ; /* Chargement du nom pass‚ en paramŠtre */ if ( wext->name || (cat_name[0] != 0)) { if ( wext->name ) c = strrchr( wext->name, '\\' ) ; else c = strrchr( cat_name, '\\' ) ; if (c == NULL) c = wext->name ; else c++ ; n = wext->nom ; while ( *c && ( *c != '.' ) ) *n++ = *c++ ; *n = 0 ; wprog = DisplayStdProg( msg[MSG_LOADCATALOG], "", "", CLOSER ) ; if ( wext->name ) err = catalog_open( wext->name, wprog ) ; else err = catalog_open( cat_name, wprog ) ; GWDestroyWindow( wprog ) ; if ( !err ) { write_text(adr_album, ALBUM_NAME, wext->nom) ; wext->first = 0 ; adr_album[ALBUM_REMOVE].ob_state &= ~DISABLED ; adr_album[ALBUM_ADDIMG].ob_state &= ~DISABLED ; adr_album[ALBUM_ADDFOLDER].ob_state &= ~DISABLED ; adr_album[ALBUM_INFOS].ob_state &= ~DISABLED ; adr_album[ALBUM_CATEGORIE1].ob_state &= ~DISABLED ; adr_album[ALBUM_CATEGORIE2].ob_state &= ~DISABLED ; adr_album[ALBUM_CATEGORIE3].ob_state &= ~DISABLED ; adr_album[ALBUM_INFOIMG].ob_state &= ~DISABLED ; adr_album[ALBUM_CONFIG].ob_state &= ~DISABLED ; adr_album[ALBUM_UPDATE].ob_state &= ~DISABLED ; adr_album[ALBUM_WINDOW].ob_state &= ~DISABLED ; adr_album[ALBUM_TOVSS].ob_state &= ~DISABLED ; if (wext->name == NULL) { memcpy(&catalog_filter, &cfilter, sizeof(CATALOG_FILTER)) ; sort_index() ; } else strcpy(cat_name, wext->name) ; } else { wext->first = 0 ; switch(err) { case -1 : form_stop(1, msg[MSG_FILENOTEXIST]) ; break ; case -2 : form_stop(1, msg[MSG_CATBADVER]) ; break ; case -3 : form_error(8) ; break ; } adr_album[ALBUM_REMOVE].ob_state |= DISABLED ; adr_album[ALBUM_ADDIMG].ob_state |= DISABLED ; adr_album[ALBUM_ADDFOLDER].ob_state |= DISABLED ; adr_album[ALBUM_INFOS].ob_state |= DISABLED ; adr_album[ALBUM_CATEGORIE1].ob_state |= DISABLED ; adr_album[ALBUM_CATEGORIE2].ob_state |= DISABLED ; adr_album[ALBUM_CATEGORIE3].ob_state |= DISABLED ; adr_album[ALBUM_INFOIMG].ob_state |= DISABLED ; adr_album[ALBUM_CONFIG].ob_state |= DISABLED ; adr_album[ALBUM_UPDATE].ob_state |= DISABLED ; adr_album[ALBUM_WINDOW].ob_state |= DISABLED ; adr_album[ALBUM_TOVSS].ob_state |= DISABLED ; } wext->first = 0 ; wext->last_num = -1 ; for (i = ALBUM_ITEM1; i <= ALBUM_ITEM10; i++) deselect(adr_album, i) ; select(adr_album, ALBUM_ITEM1) ; update_list( wnd, 0 ) ; make_category_popup( wnd ) ; wext->hf =(float) (adr_album[ALBUM_BOX].ob_height-adr_album[ALBUM_SLIDER].ob_height) ; load_icon( wnd, wext->first ) ; } GWSetWndRscIcon( wnd, FORM_ALBUM, ALBUM_ADDFOLDER ) ; adr_album[ALBUM_PPAL].ob_flags |= TOUCHEXIT ; /* Evite modif RSC */ }
void OnInitPrinterDialog(void *w) { static int printer_index ; static int type_index = 0 ; GEM_WINDOW *wnd = (GEM_WINDOW *) w ; DIALOG *dlg = (DIALOG *) wnd->DlgData ; DLGPRINTER_USER_DATA *dlg_user_data = dlg->UserData ; DLGPRINTER_WEXTENSION *wext ; OBJECT *adr_print = dlg->BaseObject ; int i ; char buffer[200] ; wnd->Extension = calloc( sizeof(DLGPRINTER_WEXTENSION), 1 ) ; wext = (DLGPRINTER_WEXTENSION *) wnd->Extension ; read_text( adr_print, PRINT_FILE, buffer ) ; if ( dlg_user_data->filename[0] ) write_text( adr_print, PRINT_FILE, dlg_user_data->filename ) ; else write_text( adr_print, PRINT_FILE, buffer ) ; wext->popup_page = popup_make(1+LAST_INDEX, 11) ; for (i = 0; i <= LAST_INDEX; i++) strcpy(wext->popup_page[1+i].ob_spec.free_string, tab_page[i]->nom) ; wext->popup_printer = popup_make(nb_drivers, 20) ; for (i = 0; i < nb_drivers; i++) sprintf(wext->popup_printer[1+i].ob_spec.free_string, " %s", &printer_names[i][0]) ; dlg_user_data->printer_index = printer_index ; wext->popup_type = popup_make(2, 20) ; strcpy(wext->popup_type[1].ob_spec.free_string, msg[MSG_PRINTCOLOR]) ; strcpy(wext->popup_type[2].ob_spec.free_string, msg[MSG_PRINTBW]) ; dlg_user_data->sizex = (float)dlg_user_data->raster.fd_w*(float)dlg_user_data->info.lpix/10000.0 ; /* En cm */ sprintf(buffer, "%.1f", dlg_user_data->sizex) ; write_text(adr_print, PRINT_SIZEX, buffer) ; dlg_user_data->sizey = (float)dlg_user_data->raster.fd_h*(float)dlg_user_data->info.hpix/10000.0 ; /* En cm */ sprintf(buffer, "%.1f", dlg_user_data->sizey) ; write_text(adr_print, PRINT_SIZEY, buffer) ; write_text(adr_print, PRINT_XPC, "100") ; write_text(adr_print, PRINT_YPC, "100") ; dlg_user_data->page.unite = CM ; read_text(adr_print, PRINT_SIZEPAGEW, buffer) ; dlg_user_data->page.largeur = atof(buffer) ; read_text(adr_print, PRINT_SIZEPAGEH, buffer) ; dlg_user_data->page.hauteur = atof(buffer) ; setup_pagename(&dlg_user_data->page) ; deselect(adr_print, PRINT_R90) ; deselect(adr_print, PRINT_CENTREX) ; deselect(adr_print, PRINT_CENTREY) ; if (dlg_user_data->info.nplans == 1) { adr_print[PRINT_TYPE].ob_state |= DISABLED ; dlg_user_data->type_index = 1 ; } else { adr_print[PRINT_TYPE].ob_state &= ~DISABLED ; dlg_user_data->type_index = type_index ; } write_text(adr_print, PRINT_CONFIGPAGE, dlg_user_data->page.nom) ; write_text(adr_print, PRINT_PRINTER, wext->popup_printer[1+dlg_user_data->printer_index].ob_spec.free_string) ; write_text(adr_print, PRINT_TYPE, wext->popup_type[1+dlg_user_data->type_index].ob_spec.free_string) ; sprintf(buffer, "%.4d/%.4d", micron2dpi(dlg_user_data->info.lpix), micron2dpi(dlg_user_data->info.hpix)) ; write_text(adr_print, PRINT_RESOL, buffer) ; compute_page( dlg ) ; }
void UIHostComboEditor::sltDeselect() { deselect(); }
int OnObjectNotifyPrinterDialog(void *wi, int obj) /* >=0 : sortie de la fenetre, code IDOK ou IDCANCEL */ { GEM_WINDOW *wnd = (GEM_WINDOW *) wi ; DIALOG *dlg = (DIALOG *) wnd->DlgData ; OBJECT *adr_print = dlg->BaseObject ; DLGPRINTER_USER_DATA *dlg_user_data = dlg->UserData ; DLGPRINTER_WEXTENSION *wext = wnd->Extension ; float number ; static int pc ; int rx, ry ; int xc, yc ; int w, h ; int clicked ; int ix, iy ; int xr, yr ; int lx, ly, lw, lh ; int code = -1 ; char *c, buffer[100], buf[100] ; switch( obj ) { case PRINT_XPCMOINS : case PRINT_XPCPLUS : read_text(adr_print, PRINT_XPC, buffer) ; pc = atoi(buffer) ; if (obj == PRINT_XPCPLUS) pc += PC_STEP ; else pc -= PC_STEP ; if (pc < 2) pc = 2 ; if (pc > 999) pc = 999 ; sprintf(buffer, "%d", pc) ; write_text(adr_print, PRINT_XPC, buffer) ; number = dlg_user_data->sizex*(float)pc/100.0 ; adr_print[PRINT_IMAGE].ob_width = (int) (number*(float)dlg_user_data->spx/dlg_user_data->page.largeur) ; sprintf(buffer, "%.1f", number) ; write_text(adr_print, PRINT_SIZEX, buffer) ; if (selected(adr_print, PRINT_KEEPRATIO)) { sprintf(buffer, "%d", pc) ; write_text(adr_print, PRINT_YPC, buffer) ; number = dlg_user_data->sizey*(float)pc/100.0 ; adr_print[PRINT_IMAGE].ob_height = (int) (number*(float)dlg_user_data->spy/dlg_user_data->page.hauteur) ; sprintf(buffer, "%.1f", number) ; write_text(adr_print, PRINT_SIZEY, buffer) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_YPC ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_SIZEY ) ; } rx = (int) ((float)dlg_user_data->info.lpix*(float)pc/100.0) ; ry = (int) ((float)dlg_user_data->info.hpix*(float)pc/100.0) ; sprintf(buffer, "%.4d/%.4d", micron2dpi(rx), micron2dpi(ry)) ; write_text(adr_print, PRINT_RESOL, buffer) ; deselect(adr_print, obj) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_XPC ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_SIZEX ) ; xobjc_draw( wnd->window_handle, adr_print, obj ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_PAGE ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_RESOL ) ; if (selected(adr_print, PRINT_CENTREX)) button_center( wnd, adr_print, 0, 0 ) ; if (selected(adr_print, PRINT_CENTREY)) button_center( wnd, adr_print, 1, 0 ) ; break ; case PRINT_YPCMOINS : case PRINT_YPCPLUS : read_text(adr_print, PRINT_YPC, buffer) ; pc = atoi(buffer) ; if (obj == PRINT_YPCPLUS) pc += PC_STEP ; else pc -= PC_STEP ; if (pc < 2) pc = 2 ; if (pc > 999) pc = 999 ; sprintf(buffer, "%d", pc) ; write_text(adr_print, PRINT_YPC, buffer) ; number = dlg_user_data->sizey*(float)pc/100.0 ; adr_print[PRINT_IMAGE].ob_height = (int) (number*(float)dlg_user_data->spy/dlg_user_data->page.hauteur) ; sprintf(buffer, "%.1f", number) ; write_text(adr_print, PRINT_SIZEY, buffer) ; if (selected(adr_print, PRINT_KEEPRATIO)) { sprintf(buffer, "%d", pc) ; write_text(adr_print, PRINT_XPC, buffer) ; number = dlg_user_data->sizex*(float)pc/100.0 ; adr_print[PRINT_IMAGE].ob_width = (int) (number*(float)dlg_user_data->spx/dlg_user_data->page.largeur) ; sprintf(buffer, "%.1f", number) ; write_text(adr_print, PRINT_SIZEX, buffer) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_XPC ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_SIZEX ) ; } rx = (int) ((float)dlg_user_data->info.lpix*(float)pc/100.0) ; ry = (int) ((float)dlg_user_data->info.hpix*(float)pc/100.0) ; sprintf(buffer, "%.4d/%.4d", micron2dpi(rx), micron2dpi(ry)) ; write_text(adr_print, PRINT_RESOL, buffer) ; deselect(adr_print, obj) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_YPC ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_SIZEY ) ; xobjc_draw( wnd->window_handle, adr_print, obj ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_PAGE ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_RESOL ) ; if (selected(adr_print, PRINT_CENTREX)) button_center( wnd, adr_print, 0, 0 ) ; if (selected(adr_print, PRINT_CENTREY)) button_center( wnd, adr_print, 1, 0 ) ; break ; case PRINT_R90 : case PRINT_TR90 : inv_select(adr_print, PRINT_R90) ; xc = adr_print[PRINT_IMAGE].ob_width ; adr_print[PRINT_IMAGE].ob_width = adr_print[PRINT_IMAGE].ob_height ; adr_print[PRINT_IMAGE].ob_height = xc ; xobjc_draw( wnd->window_handle, adr_print, PRINT_PAGE ) ; number = dlg_user_data->sizex ; dlg_user_data->sizex = dlg_user_data->sizey ; dlg_user_data->sizey = number ; read_text(adr_print, PRINT_SIZEX, buf) ; read_text(adr_print, PRINT_SIZEY, buffer) ; write_text(adr_print, PRINT_SIZEX, buffer) ; write_text(adr_print, PRINT_SIZEY, buf) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_SIZEX ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_SIZEY ) ; read_text(adr_print, PRINT_XPC, buf) ; read_text(adr_print, PRINT_YPC, buffer) ; write_text(adr_print, PRINT_XPC, buffer) ; write_text(adr_print, PRINT_YPC, buf) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_XPC ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_YPC ) ; if (selected(adr_print, PRINT_CENTREX)) button_center( wnd, adr_print, 0, 0 ) ; if (selected(adr_print, PRINT_CENTREY)) button_center( wnd, adr_print, 1, 0 ) ; break ; case PRINT_CENTREX : case PRINT_TCENTREX : button_center( wnd, adr_print, 0, 1 ) ; break ; case PRINT_CENTREY : case PRINT_TCENTREY : button_center( wnd, adr_print, 1, 1 ) ; break ; case PRINT_KEEPRATIO : case PRINT_TKEEPRATIO : inv_select(adr_print, PRINT_KEEPRATIO) ; break ; case PRINT_IMAGE : w = adr_print[PRINT_IMAGE].ob_width ; h = adr_print[PRINT_IMAGE].ob_height ; objc_offset(adr_print, PRINT_IMAGE, &ix, &iy) ; objc_offset(adr_print, PRINT_PAGE, &lx, &ly) ; lw = adr_print[PRINT_PAGE].ob_width ; lh = adr_print[PRINT_PAGE].ob_height ; my_dragbox(w, h, ix, iy, lx, ly, lw, lh, &xr, &yr) ; adr_print[PRINT_IMAGE].ob_x = xr-lx ; adr_print[PRINT_IMAGE].ob_y = yr-ly ; xobjc_draw( wnd->window_handle, adr_print, PRINT_PAGE ) ; if (selected(adr_print, PRINT_CENTREX)) inv_select(adr_print, PRINT_CENTREX) ; if (selected(adr_print, PRINT_CENTREY)) inv_select(adr_print, PRINT_CENTREY) ; break ; case PRINT_CONFIGPAGE : deselect(adr_print, PRINT_CONFIGPAGE) ; dlg_user_data->page_index = tab_page_index(&dlg_user_data->page) ; objc_offset(adr_print, PRINT_CONFIGPAGE, &xc, &yc) ; clicked = popup_formdo(&wext->popup_page, xc, yc, 1+dlg_user_data->page_index, 0) ; if (clicked > 0) { write_text(adr_print, PRINT_CONFIGPAGE, tab_page[clicked-1]->nom) ; memcpy(&dlg_user_data->page, tab_page[clicked-1], sizeof(PAGE)) ; compute_page( dlg ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_GROUP ) ; } xobjc_draw( wnd->window_handle, adr_print, PRINT_CONFIGPAGE ) ; show_dimpage( wnd, &dlg_user_data->page, adr_print ) ; read_text(adr_print, PRINT_XPC, buffer) ; pc = atoi(buffer) ; sprintf(buffer, "%d", pc) ; number = dlg_user_data->sizex*(float)pc/100.0 ; adr_print[PRINT_IMAGE].ob_width = (int) (number*(float)dlg_user_data->spy/dlg_user_data->page.hauteur) ; sprintf(buffer, "%.1f", number) ; write_text(adr_print, PRINT_SIZEY, buffer) ; read_text(adr_print, PRINT_YPC, buffer) ; pc = atoi(buffer) ; sprintf(buffer, "%d", pc) ; number = dlg_user_data->sizey*(float)pc/100.0 ; adr_print[PRINT_IMAGE].ob_height = (int) (number*(float)dlg_user_data->spx/dlg_user_data->page.largeur) ; sprintf(buffer, "%.1f", number) ; write_text(adr_print, PRINT_SIZEY, buffer) ; rx = (int) ((float)dlg_user_data->info.lpix*(float)pc/100.0) ; ry = (int) ((float)dlg_user_data->info.hpix*(float)pc/100.0) ; sprintf(buffer, "%.4d/%.4d", micron2dpi(rx), micron2dpi(ry)) ; write_text(adr_print, PRINT_RESOL, buffer) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_SIZEY ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_PAGE ) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_RESOL ) ; if (selected(adr_print, PRINT_CENTREX)) button_center( wnd, adr_print, 0, 0 ) ; if (selected(adr_print, PRINT_CENTREY)) button_center( wnd, adr_print, 1, 0 ) ; break ; case PRINT_PRINTER : deselect(adr_print, PRINT_PRINTER) ; objc_offset(adr_print, PRINT_PRINTER, &xc, &yc) ; clicked = popup_formdo(&wext->popup_printer, xc, yc, 1+dlg_user_data->printer_index, 0) ; if (clicked > 0) { dlg_user_data->printer_index = clicked-1 ; write_text(adr_print, PRINT_PRINTER, wext->popup_printer[1+dlg_user_data->printer_index].ob_spec.free_string) ; } xobjc_draw( wnd->window_handle, adr_print, PRINT_PRINTER ) ; sprintf(buffer, "%d", id[dlg_user_data->printer_index]) ; write_text(adr_print, PRINT_ID, buffer) ; xobjc_draw( wnd->window_handle, adr_print, PRINT_ID ) ; break ; case PRINT_TYPE : if (!(adr_print[PRINT_TYPE].ob_state & DISABLED)) { deselect(adr_print, PRINT_TYPE) ; objc_offset(adr_print, PRINT_TYPE, &xc, &yc) ; clicked = popup_formdo(&wext->popup_type, xc, yc, 1+dlg_user_data->type_index, 0) ; if (clicked > 0) { dlg_user_data->type_index = clicked-1 ; write_text(adr_print, PRINT_TYPE, wext->popup_type[1+dlg_user_data->type_index].ob_spec.free_string) ; } xobjc_draw( wnd->window_handle, adr_print, PRINT_TYPE ) ; } break ; case PRINT_FILE : strcpy(buffer, dlg_user_data->filename) ; c = strrchr(buffer, '\\') ; if (c != NULL) *c = 0 ; strcat(buffer, "\\*.*") ; if ( file_name(buffer, "", buffer) == 1 ) { INFO_IMAGE inf ; strcpy(dlg_user_data->filename, buffer) ; write_text(adr_print, PRINT_FILE, dlg_user_data->filename) ; if ( img_format( dlg_user_data->filename, &inf ) == 0 ) { memcpy( &dlg_user_data->info, &inf, sizeof(INFO_IMAGE) ) ; deselect(adr_print, PRINT_R90) ; deselect(adr_print, PRINT_CENTREX) ; deselect(adr_print, PRINT_CENTREY) ; memset(&dlg_user_data->raster, 0, sizeof(MFDB)) ; dlg_user_data->raster.fd_w = dlg_user_data->info.largeur ; dlg_user_data->raster.fd_h = dlg_user_data->info.hauteur ; dlg_user_data->raster.fd_nplanes = dlg_user_data->info.nplans ; dlg_user_data->raster.fd_wdwidth = dlg_user_data->raster.fd_w/16 ; if (dlg_user_data->raster.fd_w % 16) dlg_user_data->raster.fd_wdwidth++ ; dlg_user_data->sizex = (float)dlg_user_data->raster.fd_w*(float)dlg_user_data->info.lpix/10000.0 ; /* En cm */ sprintf(buffer, "%.1f", dlg_user_data->sizex) ; write_text(adr_print, PRINT_SIZEX, buffer) ; dlg_user_data->sizey = (float)dlg_user_data->raster.fd_h*(float)dlg_user_data->info.hpix/10000.0 ; /* En cm */ sprintf(buffer, "%.1f", dlg_user_data->sizey) ; write_text(adr_print, PRINT_SIZEY, buffer) ; write_text(adr_print, PRINT_XPC, "100") ; write_text(adr_print, PRINT_YPC, "100") ; compute_page( dlg ) ; } } deselect(adr_print, obj) ; break ; case PRINT_OK : code = IDOK ; break ; case PRINT_CANCEL : code = IDCANCEL ; break ; } if ( code == IDOK ) { /* Mise a jour de UserData */ dlg_user_data->rotate90 = selected( adr_print, PRINT_R90 ) ; read_text( adr_print, PRINT_XPC, buffer ) ; dlg_user_data->xpc = atof( buffer ) ; read_text( adr_print, PRINT_YPC, buffer ) ; dlg_user_data->ypc = atof( buffer ) ; dlg_user_data->posx = dlg_user_data->page.largeur*(float)adr_print[PRINT_IMAGE].ob_x/(float)adr_print[PRINT_PAGE].ob_width ; dlg_user_data->posy = dlg_user_data->page.hauteur*(float)adr_print[PRINT_IMAGE].ob_y/(float)adr_print[PRINT_PAGE].ob_height ; } return( code ) ; }
/* * CPX user interaction */ BOOLEAN cdecl cpx_call( GRECT *rect ) { OBJECT *tree = (OBJECT *)rs_trindex[MACCEL]; int button; int quit = 0; int saveptime; WORD msg[8]; MA_INFO *src; int ox, oy; MRETS mk; if( !ma_installed ) { form_alert( 1, alertbox ); return FALSE; } ma_work = ma_cancel = *ma_info; ObX( ROOT ) = rect->g_x; ObY( ROOT ) = rect->g_y; set_accelbox( tree, ma_info->linear ); set_screenbox( tree, ma_info->udset ); ma_work.timeout /= 3600; ma_cancel.timeout /= 3600; xcpb->Sl_x( tree, SCRNBACK, SCRNTHUM, ma_work.timeout, SCRN_MIN, SCRN_MAX, NULLFUNC ); TedText(SCRNTHUM)[0] = '0' + ma_work.timeout; if( ma_info->watch ) Select(PHONE); else Deselect(PHONE); if( ma_info->stacy ) { ObFlags(STACSCRN) = ObFlags(STACLITE) = TOUCHEXIT; if( ma_info->stacmask & SH_SCREEN ) Select( STACSCRN ); if( ma_info->stacmask & SH_LIGHT ) Select( STACLITE ); } else { ObFlags(STACSCRN) = ObFlags(STACLITE) = NONE; ObState(STACSCRN) = ObState(STACLITE) = DISABLED; /* deselects */ } Supexec( (long(*)())get_ptime ); saveptime = ma_work.savepark = parktime; if( saveptime == 0 ) saveptime = 1; set_parkbox( tree ); if( parktime >= 0 ) { xcpb->Sl_x( tree, PARKBACK, PARKTHUM, parktime, PARK_MIN, PARK_MAX, NULLFUNC ); itoa2( ma_work.savepark, TedText(PARKTHUM) ); } Objc_draw( tree, ROOT, MAX_DEPTH, NULL ); do { dodelay = FALSE; sl_time = SL_MAX_DELAY; button = xcpb->Xform_do( tree, 0, msg ); if( button == -1 ) if( msg[0] == AC_CLOSE ) button = CANCEL; else if( msg[0] == WM_CLOSED ) button = OK; else button &= 0x7fff; switch( button ) { case OK: src = &ma_work; update_info( tree, src ); quit = OK; break; case CANCEL: src = &ma_cancel; quit = CANCEL; break; case SAVE: if( xcpb->XGen_Alert( SAVE_DEFAULTS ) ) { src = &ma_work; update_info( tree, src ); src->timeout *= 3600; if( xcpb->CPX_Save( src, sizeof(MA_INFO) ) ) { set_info( ma_info, src ); src->timeout /= 3600; ma_cancel = ma_work; } else { src->timeout /= 3600; } } deselect( tree, SAVE ); break; case OFF: ma_work.linear = ma_info->linear = -1; break; case SLOW: ma_work.linear = ma_info->linear = 1; break; case FAST: ma_work.linear = ma_info->linear = 0; break; case PARK: if( IsSelected(PARK) ) /* deselecting */ { saveptime = ma_work.savepark; ma_work.savepark = 0; } else { ma_work.savepark = saveptime; xcpb->Sl_x( tree, PARKBACK, PARKTHUM, parktime, PARK_MIN, PARK_MAX, update_parkbox ); } set_parkbox( tree ); Objc_draw( tree, PARKBOX, MAX_DEPTH, NULL ); break; case PARKUP: dodelay = TRUE; xcpb->Sl_arrow( tree, PARKBACK, PARKTHUM, PARKUP, 1, PARK_MIN, PARK_MAX, &ma_work.savepark, HORIZONTAL, update_parkbox ); break; case PARKDN: dodelay = TRUE; xcpb->Sl_arrow( tree, PARKBACK, PARKTHUM, PARKDN, -1, PARK_MIN, PARK_MAX, &ma_work.savepark, HORIZONTAL, update_parkbox ); break; case PARKTHUM: xcpb->Sl_dragx( tree, PARKBACK, PARKTHUM, PARK_MIN, PARK_MAX, &ma_work.savepark, update_parkbox ); break; case PARKBACK: dodelay = TRUE; Graf_mkstate( &mk ); objc_offset( tree, PARKTHUM, &ox, &oy ); if( mk.x < ox ) oy = -PARK_PAGE; else oy = PARK_PAGE; xcpb->Sl_arrow( tree, PARKBACK, PARKTHUM, -1, oy, PARK_MIN, PARK_MAX, &ma_work.savepark, HORIZONTAL, update_parkbox ); break; case SCRN: ma_work.udset ^= 1; set_screenbox( tree, ma_work.udset ); Objc_draw( tree, SCRNBOX, MAX_DEPTH, NULL ); break; case SCRNUP: dodelay = TRUE; xcpb->Sl_arrow( tree, SCRNBACK, SCRNTHUM, SCRNUP, 1, SCRN_MIN, SCRN_MAX, &ma_work.timeout, HORIZONTAL, update_screenbox ); break; case SCRNDN: dodelay = TRUE; xcpb->Sl_arrow( tree, SCRNBACK, SCRNTHUM, SCRNDN, -1, SCRN_MIN, SCRN_MAX, &ma_work.timeout, HORIZONTAL, update_screenbox ); break; case SCRNTHUM: xcpb->Sl_dragx( tree, SCRNBACK, SCRNTHUM, SCRN_MIN, SCRN_MAX, &ma_work.timeout, update_screenbox ); break; case SCRNBACK: dodelay = TRUE; Graf_mkstate( &mk ); objc_offset( tree, SCRNTHUM, &ox, &oy ); if( mk.x < ox ) oy = -SCRN_PAGE; else oy = SCRN_PAGE; xcpb->Sl_arrow( tree, SCRNBACK, SCRNTHUM, -1, oy, SCRN_MIN, SCRN_MAX, &ma_work.timeout, HORIZONTAL, update_screenbox ); break; } } while (!quit); Deselect(quit); src->timeout *= 3600; set_info( ma_info, src ); return FALSE; }
void SonicPiScintilla::copyClear() { QsciScintilla::copy(); deselect(); }
/* Outline_Buttons() * ==================================================================== * Handle the button events for the outline font dialog. */ int Outline_Buttons( int button, WORD *msg ) { int quit = FALSE; int out; long i; MRETS mk; if( ( button != -1 ) && ( button & 0x8000 ) ) button &= 0x7FFF; switch( button ) { case OCANCEL:pop_outline(); /* restore */ case OEXIT: Deselect( button ); if( OEXIT == button ) { /* Read in ONLY if new directory path */ if( strcmp( Current.FontPath, Backup.FontPath ) ) { MF_Save(); push_outline(); Scan_Message( ad_scan, TRUE ); read_fonts( 1 ); Scan_Message( ad_scan, FALSE ); pop_outline(); MF_Restore(); } } Return_To_Maintree( Maintree ); break; case SETCACHE: deselect( tree, SETCACHE ); Do_Cache_Size(); break; case DEFPOINT: Deselect( button ); Do_Point_Sizes( 0, DEFAULT_POINTS ); break; case FSMLEFT: select( tree, FSMLEFT ); do { Graf_mkstate( &mk ); if( dircount ) { dircount--; strncpy( view_path, &dirpath[ dircount ], min( DIR_MAX, dirsize - dircount ) ); if( dircount ) view_path[0] = 0xAE; if((dirsize - dircount ) > DIR_MAX ) view_path[ DIR_MAX - 1 ] = 0xAF; TedText( FSMPATH ) = view_path; Objc_draw( tree, FSMPATH, MAX_DEPTH, NULL ); } }while( mk.buttons ); deselect( tree, FSMLEFT ); break; case FSMRIGHT: select( tree, FSMRIGHT ); do { Graf_mkstate( &mk ); if( ( dirsize > DIR_MAX ) && ((dircount + DIR_MAX ) < dirsize )) { dircount++; strncpy( view_path, &dirpath[ dircount], min( DIR_MAX, dirsize - dircount) ); view_path[0] = 0xAE; if( (dirsize - dircount) > DIR_MAX ) view_path[ DIR_MAX - 1 ] = 0xAF; TedText( FSMPATH ) = view_path; Objc_draw( tree, FSMPATH, MAX_DEPTH, NULL ); } }while( mk.buttons ); deselect( tree, FSMRIGHT ); break; case FSMPATH: wait_up(); strcpy( newpath, dirpath ); for( i = strlen( newpath ); i && ( newpath[i] != '\\'); newpath[ i-- ] = '\0' ); out = fsel_name( FALSE, newpath, "*.QFM", title_fsmpath ); if( ( ( out == A_OK ) || ( out == A_CANCEL )) && ( newpath[0] != '\0' ) ) { for( i = strlen( newpath ); i && ( newpath[i] != '\\'); newpath[ i-- ] = '\0' ); strcpy( dirpath, newpath ); newpath[i] = '\0'; /* Get rid of the '\\' */ strcpy( Current.FontPath, newpath ); strcat( dirpath, "*.QFM" ); dirsize = (int)strlen( &dirpath[0] ); strcpy( view_path, underbar ); strncpy( view_path, dirpath, min( DIR_MAX, dirsize) ); dircount = 0; if( dirsize > DIR_MAX ) view_path[ DIR_MAX - 1 ] = 0xAF; TedText( FSMPATH ) = view_path; Objc_draw( tree, FSMPATH, MAX_DEPTH, NULL ); Change_Flag = TRUE; } break; case WIDTHFLG: Current.Width ^= TRUE; deselect( tree, button ); ObString( WIDTHFLG ) = width_text[ Current.Width ]; Objc_draw( tree, WIDTHFLG, MAX_DEPTH, NULL ); Change_Flag = TRUE; CacheCheck( 0 ); break; case SYMFLAG: Current.SymbolFlag ^= TRUE; if( SetSymbols( &Current.SymbolFlag, SYMTEXT, SYMTITLE, Current.SymbolFont, title_symbol, TRUE ) ) SymHebFontChange(); deselect( tree, SYMFLAG ); Change_Flag = TRUE; break; case HEBFLAG: Current.HebrewFlag ^= TRUE; if( SetSymbols( &Current.HebrewFlag, HEBTEXT, HEBTITLE, Current.HebrewFont, title_hebrew, TRUE )) SymHebFontChange(); deselect( tree, HEBFLAG ); Change_Flag = TRUE; break; case SYMTEXT: if( SymButton( Current.SymbolFont, SYMTITLE, SYMTEXT, title_symbol, &Current.SymbolFlag ) ) SymHebFontChange(); break; case HEBTEXT: if( SymButton( Current.HebrewFont, HEBTITLE, HEBTEXT, title_hebrew, &Current.HebrewFlag ) ) SymHebFontChange(); break; default: if( button == -1 ) { switch( msg[0] ) { case WM_REDRAW: break; case AC_CLOSE: quit = TRUE; break; case WM_CLOSED: quit = TRUE; do_write_extend( FALSE ); break; case CT_KEY: break; default: break; } } break; } return( quit ); }
/* Path_Button() * ======================================================================== * Handle the Button handling for the set font path tree... */ int Path_Button( int button, WORD *msg ) { int quit = FALSE; long i; MRETS mk; int out; if( ( button != -1 ) && ( button & 0x8000 ) ) button &= 0x7FFF; switch( button ) { case PEXIT: Deselect( PEXIT ); if( strcmp( bitmap_path, backup ) ) { MF_Save(); Scan_Message( ad_scan, TRUE ); read_fonts(); Scan_Message( ad_scan, FALSE ); MF_Restore(); SetChangeFlag(); } RestoreMainTree(); break; case PCANCEL: Deselect( PCANCEL ); strcpy( bitmap_path, backup ); RestoreMainTree(); break; case PLEFT: select( tree, PLEFT ); do { Graf_mkstate( &mk ); if( dircount ) { dircount--; strncpy( view_path, &dirpath[ dircount ], min( DIR_MAX, dirsize - dircount ) ); if( dircount ) view_path[0] = 0xAE; if((dirsize - dircount ) > DIR_MAX ) view_path[ DIR_MAX - 1 ] = 0xAF; TedText( PBASE ) = view_path; Objc_draw( tree, PBASE, MAX_DEPTH, NULL ); } }while( mk.buttons ); deselect( tree, PLEFT ); break; case PRIGHT: select( tree, PRIGHT ); do { Graf_mkstate( &mk ); if( ( dirsize > DIR_MAX ) && ((dircount + DIR_MAX ) < dirsize )) { dircount++; strncpy( view_path, &dirpath[ dircount], min( DIR_MAX, dirsize - dircount) ); view_path[0] = 0xAE; if( (dirsize - dircount) > DIR_MAX ) view_path[ DIR_MAX - 1 ] = 0xAF; TedText( PBASE ) = view_path; Objc_draw( tree, PBASE, MAX_DEPTH, NULL ); } }while( mk.buttons ); deselect( tree, PRIGHT ); break; case PBASE: wait_up(); strcpy( newpath, dirpath ); for( i = strlen( newpath ); i && ( newpath[i] != '\\'); newpath[ i-- ] = '\0' ); out = fsel_name( FALSE, newpath, "*.FNT", "Select Font Path" ); if( ( ( out == A_OK ) || ( out == A_CANCEL )) && ( newpath[0] != '\0' ) ) { for( i = strlen( newpath ); i && ( newpath[i] != '\\'); newpath[ i-- ] = '\0' ); strcpy( dirpath, newpath ); newpath[i] = '\0'; /* Get rid of the '\\' */ strcpy( bitmap_path, newpath ); strcat( dirpath, "*.FNT" ); dirsize = (int)strlen( &dirpath[0] ); strcpy( view_path, underbar ); strncpy( view_path, dirpath, min( DIR_MAX, dirsize) ); dircount = 0; if( dirsize > DIR_MAX ) view_path[ DIR_MAX - 1 ] = 0xAF; TedText( PBASE ) = view_path; Objc_draw( tree, PBASE, MAX_DEPTH, NULL ); } break; default: if( button == -1 ) { switch( msg[0] ) { case WM_REDRAW: break; case AC_CLOSE: quit = TRUE; break; case WM_CLOSED: quit = TRUE; if( strcmp( bitmap_path, backup ) ) SetChangeFlag(); CloseWindow(); break; case CT_KEY: break; default: break; } } break; } return( quit ); }
BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; // let scrollbar have first dibs handled = LLView::childrenHandleDoubleClick(x, y, mask) != NULL; if( !handled && mTakesNonScrollClicks) { if( allowsEmbeddedItems() ) { const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); if( cur_segment && cur_segment->getStyle()->getIsEmbeddedItem() ) { if( openEmbeddedItemAtPos( cur_segment->getStart() ) ) { deselect(); setFocus( FALSE ); return TRUE; } } } setCursorAtLocalPos( x, y, FALSE ); deselect(); const LLWString &text = getWText(); if( isPartOfWord( text[mCursorPos] ) ) { // Select word the cursor is over while ((mCursorPos > 0) && isPartOfWord(text[mCursorPos-1])) { mCursorPos--; } startSelection(); while ((mCursorPos < (S32)text.length()) && isPartOfWord( text[mCursorPos] ) ) { mCursorPos++; } mSelectionEnd = mCursorPos; } else if ((mCursorPos < (S32)text.length()) && !iswspace( text[mCursorPos]) ) { // Select the character the cursor is over startSelection(); mCursorPos++; mSelectionEnd = mCursorPos; } // We don't want handleMouseUp() to "finish" the selection (and thereby // set mSelectionEnd to where the mouse is), so we finish the selection here. mIsSelecting = FALSE; // delay cursor flashing resetKeystrokeTimer(); // take selection to 'primary' clipboard updatePrimary(); handled = TRUE; } return handled; }
void unGroup() { deselect( ); unit_list.clear(); }
// Allow calling cards to be dropped onto text fields. Append the name and // a carriage return. // virtual BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { BOOL handled = FALSE; LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); if (LLToolDragAndDrop::SOURCE_NOTECARD == source) { // We currently do not handle dragging items from one notecard to another // since items in a notecard must be in Inventory to be verified. See DEV-2891. return FALSE; } if (mTakesNonScrollClicks) { if (getEnabled() && acceptsTextInput()) { switch( cargo_type ) { case DAD_CALLINGCARD: if(acceptsCallingCardNames()) { if (drop) { LLInventoryItem *item = (LLInventoryItem *)cargo_data; std::string name = item->getName(); appendText(name, true, true); } *accept = ACCEPT_YES_COPY_SINGLE; } else { *accept = ACCEPT_NO; } break; case DAD_TEXTURE: case DAD_SOUND: case DAD_LANDMARK: case DAD_SCRIPT: case DAD_CLOTHING: case DAD_OBJECT: case DAD_NOTECARD: case DAD_BODYPART: case DAD_ANIMATION: case DAD_GESTURE: { LLInventoryItem *item = (LLInventoryItem *)cargo_data; if( item && allowsEmbeddedItems() ) { U32 mask_next = item->getPermissions().getMaskNextOwner(); if((mask_next & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) { if( drop ) { deselect(); S32 old_cursor = mCursorPos; setCursorAtLocalPos( x, y, TRUE ); S32 insert_pos = mCursorPos; setCursorPos(old_cursor); BOOL inserted = insertEmbeddedItem( insert_pos, item ); if( inserted && (old_cursor > mCursorPos) ) { setCursorPos(mCursorPos + 1); } updateLineStartList(); } *accept = ACCEPT_YES_COPY_MULTI; } else { *accept = ACCEPT_NO; if (tooltip_msg.empty()) { tooltip_msg.assign("Only items with unrestricted\n" "'next owner' permissions \n" "can be attached to notecards."); } } } else { *accept = ACCEPT_NO; } break; } default: *accept = ACCEPT_NO; break; } } else { // Not enabled *accept = ACCEPT_NO; } handled = TRUE; lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLViewerTextEditor " << getName() << llendl; } return handled; }
/* driver_handler() * ================================================================ */ int driver_handler( void ) { int msg[8]; int button; int done; GRECT clip; int dummy; MENU Menu; MENU MData; GRECT rect; done = FALSE; do { button = xform_do( ad_tree, 0, msg ); switch( button ) { case DSETUP: done = TRUE; Deselect( DSETUP ); break; case DEXIT: CheckExit(); deselect( ad_tree, DEXIT ); break; case PMETA: case PMETA2: gl_meta ^= 1; if( gl_meta ) { objc_xywh( ad_driver, PMETA2, &clip ); msg[3] = wid; msg[4] = clip.g_x; msg[5] = clip.g_y; msg[6] = clip.g_w; msg[7] = clip.g_h; driver_redraw( msg ); } else ObjcDraw( ad_driver, PMETA2, MAX_DEPTH, NULL ); evnt_button( 1, 1, 0, &dummy, &dummy, &dummy, &dummy ); break; case PMEM: case PMEM2: gl_mem ^= 1; if( gl_mem ) { objc_xywh( ad_driver, PMEM2, &clip ); msg[3] = wid; msg[4] = clip.g_x; msg[5] = clip.g_y; msg[6] = clip.g_w; msg[7] = clip.g_h; driver_redraw( msg ); } else ObjcDraw( ad_driver, PMEM2, MAX_DEPTH, NULL ); evnt_button( 1, 1, 0, &dummy, &dummy, &dummy, &dummy ); break; case PBUTTON: select( ad_driver, PBUTTON ); evnt_button( 1, 1, 0, &dummy, &dummy, &dummy, &dummy ); select( ad_driver, PTITLE ); objc_xywh( ad_driver, PBUTTON, &rect ); Menu.mn_tree = ad_submenu; Menu.mn_menu = ROOT; Menu.mn_item = SNONE + gl_printer; Menu.mn_scroll = FALSE; if( menu_popup( &Menu, rect.g_x, rect.g_y, &MData )) { menu_icheck( ad_submenu, SNONE + gl_printer, 0 ); gl_printer = MData.mn_item - SNONE; menu_icheck( ad_submenu, SNONE + gl_printer, 1 ); if( gl_printer ) { ObString( PBUTTON ) = MenuNode[ gl_printer ].name; } else ObString( PBUTTON ) = anone; } deselect( ad_driver, PTITLE ); Deselect( PBUTTON ); objc_xywh( ad_driver, PBUTTON, &rect ); rect.g_x -= 1; rect.g_w += 2; ObjcDraw( ad_driver, PBUTTON, MAX_DEPTH, &rect ); break; default: if( button == NIL ) { switch( msg[0] ) { case WM_REDRAW: driver_redraw( msg ); break; case WM_CLOSED: return( FALSE ); break; case CT_KEY: if( msg[3] == K_F10 ) CheckExit(); break; default: break; } } break; } }while( !done ); return( TRUE ); }
BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; // Let scrollbar have first dibs handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL; // enable I Agree checkbox if the user scrolled through entire text BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax()); if (mOnScrollEndCallback && was_scrolled_to_bottom) { mOnScrollEndCallback(mOnScrollEndData); } if( !handled && mTakesNonScrollClicks) { if (!(mask & MASK_SHIFT)) { deselect(); } BOOL start_select = TRUE; if( allowsEmbeddedItems() ) { setCursorAtLocalPos( x, y, FALSE ); llwchar wc = 0; if (mCursorPos < getLength()) { wc = getWChar(mCursorPos); } LLInventoryItem* item_at_pos = LLEmbeddedItems::getEmbeddedItem(wc); if (item_at_pos) { mDragItem = item_at_pos; mDragItemChar = wc; mDragItemSaved = LLEmbeddedItems::getEmbeddedItemSaved(wc); gFocusMgr.setMouseCapture( this ); mMouseDownX = x; mMouseDownY = y; S32 screen_x; S32 screen_y; localPointToScreen(x, y, &screen_x, &screen_y ); LLToolDragAndDrop::getInstance()->setDragStart( screen_x, screen_y ); start_select = FALSE; } else { mDragItem = NULL; } } if( start_select ) { // If we're not scrolling (handled by child), then we're selecting if (mask & MASK_SHIFT) { S32 old_cursor_pos = mCursorPos; setCursorAtLocalPos( x, y, TRUE ); if (hasSelection()) { /* Mac-like behavior - extend selection towards the cursor if (mCursorPos < mSelectionStart && mCursorPos < mSelectionEnd) { // ...left of selection mSelectionStart = llmax(mSelectionStart, mSelectionEnd); mSelectionEnd = mCursorPos; } else if (mCursorPos > mSelectionStart && mCursorPos > mSelectionEnd) { // ...right of selection mSelectionStart = llmin(mSelectionStart, mSelectionEnd); mSelectionEnd = mCursorPos; } else { mSelectionEnd = mCursorPos; } */ // Windows behavior mSelectionEnd = mCursorPos; } else { mSelectionStart = old_cursor_pos; mSelectionEnd = mCursorPos; } // assume we're starting a drag select mIsSelecting = TRUE; } else { setCursorAtLocalPos( x, y, TRUE ); startSelection(); } gFocusMgr.setMouseCapture( this ); } handled = TRUE; } if (hasTabStop()) { setFocus(TRUE); handled = TRUE; } // Delay cursor flashing resetKeystrokeTimer(); return handled; }
void term_deselect (void) { deselect(); term_update(); }
void HiddenFileView::checkBoxClicked(QCheckBox* chkBox,KToggleAction* action,QLineEdit* edit, int column,QPtrList<QRegExp> & reqExpList,bool b) { // We don't save the old state so // disable the tristate mode chkBox->setTristate(false); action->setChecked(b); chkBox->setChecked(b); HiddenListViewItem* item; for (item = static_cast<HiddenListViewItem*>(_dlg->hiddenListView->firstChild());item; item = static_cast<HiddenListViewItem*>(item->nextSibling())) { if (!item->isSelected()) continue; if (b == item->isOn(column)) continue; if (!b) { QRegExp* rx = getRegExpListMatch(item->text(0),reqExpList); // Perhaps the file was hidden because it started with a dot if (!rx && item->text(0)[0]=='.' && _dlg->hideDotFilesChk->isChecked()) { int result = KMessageBox::questionYesNo(_dlg,i18n( "<qt>Some files you have selected are hidden because they start with a dot; " "do you want to uncheck all files starting with a dot?</qt>"),i18n("Files Starting With Dot"),i18n("Uncheck Hidden"), i18n("Keep Hidden")); if (result == KMessageBox::No) { QPtrList<HiddenListViewItem> lst = getMatchingItems(QRegExp(".*",false,true)); deselect(lst); } else { _dlg->hideDotFilesChk->setChecked(false); } continue; } else { if (rx) { // perhaps it is matched by a wildcard string QString p = rx->pattern(); if ( p.find("*") > -1 || p.find("?") > -1 ) { // TODO after message freeze: why show three times the wildcard string? Once should be enough. // TODO remove <b></b> and use <qt> instead int result = KMessageBox::questionYesNo(_dlg,i18n( "<b></b>Some files you have selected are matched by the wildcarded string <b>'%1'</b>; " "do you want to uncheck all files matching <b>'%1'</b>?").arg(rx->pattern()).arg(rx->pattern()).arg(rx->pattern()), i18n("Wildcarded String"),i18n("Uncheck Matches"),i18n("Keep Selected")); QPtrList<HiddenListViewItem> lst = getMatchingItems( *rx ); if (result == KMessageBox::No) { deselect(lst); } else { setState(lst,column,false); reqExpList.remove(rx); updateEdit(edit, reqExpList); } continue; } else { reqExpList.remove(rx); updateEdit(edit, reqExpList); } } } } else { reqExpList.append( new QRegExp(item->text(0)) ); updateEdit(edit, reqExpList); } item->setOn(column,b); } _dlg->hiddenListView->update(); }
/* * Check whether the region bounded by the two pointers intersects * the scroll region, and de-select the on-screen selection if so. */ static void check_selection (unsigned long *from, unsigned long *to) { if (from < selend && selstart < to) deselect(); }
/* cpx_call() *========================================================================== * Execute the cpx using Xform_do */ BOOLEAN cdecl cpx_call( GRECT *rect ) { int button; int quit = 0; OBJECT *tree = (OBJECT *)rs_trindex[PRINTER]; WORD msg[8]; GRECT xrect; ObX( ROOT ) = rect->g_x; ObY( ROOT ) = rect->g_y; set_objects(); Objc_draw( tree, ROOT, MAX_DEPTH, NULL ); do { button = (*xcpb->Xform_do)( tree, 0, msg ); switch( button ) { case PSAVE: if( (*xcpb->XGen_Alert)( SAVE_DEFAULTS ) ) { (*xcpb->CPX_Save)( &cur_value, sizeof( PRT ) ); push_data(); Set_Printer( &cur_value ); } Deselect( PSAVE ); xrect = ObRect( PSAVE ); objc_offset( tree, PSAVE, &xrect.g_x, &xrect.g_y ); xrect.g_x -= 2; xrect.g_y -= 2; xrect.g_w += 4; xrect.g_h += 4; Objc_draw( tree, PSAVE, MAX_DEPTH, &xrect ); #if 0 deselect( tree, PSAVE ); #endif break; case POK: quit = POK; Set_Printer( &cur_value ); Deselect( POK ); break; case PCANCEL: quit = PCANCEL; pop_data(); Deselect( PCANCEL ); break; #if GERMAN case PTYPE: Pop_Handle( PTYPE, type_array, 2, &cur_value.cur_type, IBM, 11 ); break; #endif #if FRENCH | SPAIN | SWEDEN | ITALY case PTYPE: Pop_Handle( PTYPE, type_array, 2, &cur_value.cur_type, IBM, 10 ); break; #endif #if USA | UK case PTYPE: Pop_Handle( PTYPE, type_array, 2, &cur_value.cur_type, IBM, 8 ); break; #endif #if FRENCH case COLOR: Pop_Handle( COLOR, color_array, 2, &cur_value.cur_color, IBM, 10 ); break; #endif #if ITALY case COLOR: Pop_Handle( COLOR, color_array, 2, &cur_value.cur_color, IBM, 9 ); break; #endif #if USA | UK | SPAIN | GERMAN | SWEDEN case COLOR: Pop_Handle( COLOR, color_array, 2, &cur_value.cur_color, IBM, 8 ); break; #endif case PIXLINE: Pop_Handle( PIXLINE, pix_array, 2, &cur_value.cur_pixel, IBM, 8 ); break; #if GERMAN | FRENCH | ITALY case QUALITY: Pop_Handle( QUALITY, quality_array, 2, &cur_value.cur_quality, IBM, 10 ); break; #endif #if SWEDEN case QUALITY: Pop_Handle( QUALITY, quality_array, 2, &cur_value.cur_quality, IBM, 9 ); break; #endif #if USA | UK | SPAIN case QUALITY: Pop_Handle( QUALITY, quality_array, 2, &cur_value.cur_quality, IBM, 8 ); break; #endif #if ITALY case PAPER: Pop_Handle( PAPER, paper_array, 2, &cur_value.cur_paper, IBM, 10 ); break; #endif #if USA | UK | SPAIN | GERMAN | FRENCH case PAPER: Pop_Handle( PAPER, paper_array, 2, &cur_value.cur_paper, IBM, 9 ); break; #endif #if SWEDEN case PAPER: Pop_Handle( PAPER, paper_array, 2, &cur_value.cur_paper, IBM, 8 ); break; #endif #if ITALY case PORT: Pop_Handle( PORT, port_array, 2, &cur_value.cur_port, IBM, 9 ); break; #else case PORT: Pop_Handle( PORT, port_array, 2, &cur_value.cur_port, IBM, 10 ); break; #endif default: if( button == -1 ) { switch( msg[0] ) { case WM_REDRAW: Redraw_Objects(); break; case AC_CLOSE: quit = PCANCEL; pop_data(); break; case WM_CLOSED: quit = POK; Set_Printer( &cur_value ); break; default: break; } } break; } }while( !quit); return( FALSE ); }