diff --git a/src/add-ons/input_server/methods/canna/CannaInterface.cpp b/src/add-ons/input_server/methods/canna/CannaInterface.cpp index 4815fb8103..c08f321215 100644 --- a/src/add-ons/input_server/methods/canna/CannaInterface.cpp +++ b/src/add-ons/input_server/methods/canna/CannaInterface.cpp @@ -30,19 +30,19 @@ void CannaInterface::InitializeCanna() { char **warn; - + context_id = 0; //context id is now fixed to zero. #ifdef DEBUG SERIAL_PRINT(( "CannaInterface:Setting basepath to %s.\n", basePath )); #endif - + setBasePath( basePath ); - + jrKanjiControl(context_id, KC_INITIALIZE, (char *)&warn); #ifdef DEBUG SERIAL_PRINT(( "CannaInterface:Canna Initialize result = %x.\n", warn )); #endif - + if (warn) { canna_enabled = false; @@ -55,12 +55,12 @@ CannaInterface::InitializeCanna() jrKanjiControl( context_id, KC_SETMODEINFOSTYLE, (char *)(int32) 0); jrKanjiControl(context_id, KC_SETHEXINPUTSTYLE, (char *)(int32) 1); - + jrKanjiControl( context_id, KC_SETUNDEFKEYFUNCTION, (char *)(int32) kc_through ); jrKanjiStatusWithValue ks; uchar buf[CONVERT_BUFFER_SIZE]; - + ks.val = CANNA_MODE_HenkanMode; ks.buffer = buf; ks.bytes_buffer = CONVERT_BUFFER_SIZE; @@ -104,10 +104,10 @@ status_t CannaInterface::InitCheck() uint32 CannaInterface::KeyIn( char ch, uint32 mod, int32 key ) { int inkey; - + inkey = ConvertSpecial( ch, mod, key ); #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: KeyIn() returned from ConvertSpecial. inkey = 0x%x\n", inkey )); +SERIAL_PRINT(( "CannaInterface: KeyIn() returned from ConvertSpecial. inkey = 0x%x\n", inkey )); #endif if ( convert_arrowkey && kanji_status.gline.length != 0 ) inkey = ConvertArrowKey( inkey ); @@ -122,18 +122,18 @@ SERIAL_PRINT(( "CannaInterface: KeyIn() returned from ConvertSpecial. inkey = 0x strcpy( previousUTF, mikakuteiUTF ); hadMikakuteiStr = true; } -*/ +*/ #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: Calling jrKanjiString()...\n" )); +SERIAL_PRINT(( "CannaInterface: Calling jrKanjiString()...\n" )); #endif kakuteiLen = jrKanjiString(context_id, inkey, kakuteiStr, CONVERT_BUFFER_SIZE, &kanji_status); #ifdef DEBUG -SERIAL_PRINT(( "kakL = %d, mikL = %d, glineL = %d, info = 0x%x\n", kakuteiLen, kanji_status.length, kanji_status.gline.length, kanji_status.info )); +SERIAL_PRINT(( "kakL = %d, mikL = %d, glineL = %d, info = 0x%x\n", kakuteiLen, kanji_status.length, kanji_status.gline.length, kanji_status.info )); #endif //return UpdateKanjiStatus(); uint32 result = UpdateKanjiStatus(); #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: KeyIn() returning 0x%x.\n", result )); +SERIAL_PRINT(( "CannaInterface: KeyIn() returning 0x%x.\n", result )); #endif return result; } @@ -142,7 +142,7 @@ uint32 CannaInterface::UpdateKanjiStatus() { uint32 result = 0; #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); +SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); #endif if ( hadGuideLine && kanji_status.gline.length == 0 ) @@ -150,13 +150,13 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); result |= GUIDELINE_DISAPPEARED; hadGuideLine = false; } - + if ( kanji_status.length == -1 ) { result |= MIKAKUTEI_NO_CHANGE; return result; } - + if ( kanji_status.info & KanjiThroughInfo ) { result |= THROUGH_INPUT; @@ -172,7 +172,7 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); jrKanjiControl( context_id, KC_SETMODEINFOSTYLE, (char *)(int32) 0); result |= MODE_CHANGED; } - + if ( !hadMikakuteiStr && (kanji_status.length != 0 || kakuteiLen != 0 )) { //ClearPrevious(); @@ -207,7 +207,7 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); result |= MIKAKUTEI_EXISTS; } - + //when mikakutei string is deleted and become empty if ( hadMikakuteiStr && kanji_status.length == 0 && kakuteiLen == 0 ) result |= MIKAKUTEI_BECOME_EMPTY; @@ -219,13 +219,13 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); if ( hadGuideLine && (kanji_status.info & KanjiGLineInfo) ) result |= GUIDELINE_CHANGED; - + if ( !hadGuideLine && kanji_status.gline.length != 0 ) { result |= GUIDELINE_APPEARED; hadGuideLine = true; } - + // calculate revpos, revlen if ( kanji_status.revLen == 0 ) { @@ -239,7 +239,7 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); convert_to_utf8( B_EUC_CONVERSION, (const char*)kanji_status.echoStr, &length, mikakuteiUTF, &revBegin, &state ); revBegin += kakuteiUTFLen; - + length = kanji_status.revPos + kanji_status.revLen; revEnd = CONVERT_BUFFER_SIZE * 2; convert_to_utf8( B_EUC_CONVERSION, (const char*)kanji_status.echoStr, &length, @@ -247,7 +247,7 @@ SERIAL_PRINT(( "CannaInterface: Entering UpdateKanjiStatus()...\n" )); revEnd += kakuteiUTFLen; } #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: UpdateKanjiStatus() returning 0x%x.\n", result )); +SERIAL_PRINT(( "CannaInterface: UpdateKanjiStatus() returning 0x%x.\n", result )); #endif return result; } @@ -269,7 +269,7 @@ int CannaInterface::ConvertSpecial(char ch, uint32 mod, int32 key) { #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: ConvertSpecial ch = 0x%x, mod = 0x%x, key = 0x%x\n", ch, mod, key )); +SERIAL_PRINT(( "CannaInterface: ConvertSpecial ch = 0x%x, mod = 0x%x, key = 0x%x\n", ch, mod, key )); #endif if (mod & B_CONTROL_KEY) { // if control key is held down, do not convert special key @@ -372,7 +372,7 @@ void CannaInterface::GetModified( int32* from, int32* to, char** string ) { int32 i, previousLen; previousLen = strlen( previousUTF ); - + for( i = 0 ; mikakuteiUTF[i] == previousUTF[i] && mikakuteiUTF[i] != '\0' @@ -380,12 +380,12 @@ void CannaInterface::GetModified( int32* from, int32* to, char** string ) i++ ) {} *from = i; - + if ( mikakuteiUTFLen > previousLen ) *to = mikakuteiUTFLen; else *to = previousLen; - + *string = &mikakuteiUTF[ i ]; } @@ -393,7 +393,7 @@ int32 CannaInterface::ForceKakutei() { if ( !canna_enabled ) return 0; - + jrKanjiStatusWithValue ks; ks.val = 0; ks.buffer = (unsigned char *)kakuteiStr; @@ -409,14 +409,14 @@ bool CannaInterface::ReadSetting(char *path, BFont *aFont) BFile preffile( INLINE_SETTING_FILE, B_READ_ONLY ); if ( preffile.InitCheck() != B_NO_ERROR ) return false; - + if ( pref.Unflatten( &preffile ) != B_OK ) return false; - + font_family fontfamily; float size; char *string; - + underline_color = FindColorData( &pref, "underline" ); highlight_color = FindColorData( &pref, "highlight" ); selection_color = FindColorData( &pref, "selection" ); @@ -427,7 +427,7 @@ bool CannaInterface::ReadSetting(char *path, BFont *aFont) pref.FindFloat( "size", &size ); pref.FindBool( "arrow", &convert_arrowkey ); - aFont->SetFamilyAndStyle( fontfamily, NULL ); + aFont->SetFamilyAndStyle( fontfamily, NULL ); aFont->SetSize( size ); return true; } @@ -442,7 +442,7 @@ rgb_color CannaInterface::FindColorData( BMessage *msg, char *name ) return result; } */ - + bool CannaInterface::HasRev() { if ( kanji_status.revLen == 0 ) @@ -462,17 +462,17 @@ CannaInterface::GenerateKouhoString() int32 state; bool noindex, sizelimit, partialhighlight; #ifdef DEBUG -SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mode = %d\n", revposition, kanji_status.gline.revLen, current_mode )); +SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mode = %d\n", revposition, kanji_status.gline.revLen, current_mode )); #endif - + noindex = sizelimit = partialhighlight = false; - + kouhoUTFLen = KOUHO_WINDOW_MAXCHAR * 2; convert_to_utf8( B_EUC_CONVERSION, (const char*)kanji_status.gline.line, &length, kouhoUTF, &kouhoUTFLen, &state ); kouhoUTF[ kouhoUTFLen ] = '\0'; - + //find gline revpos by converting to UTF8 if ( kanji_status.gline.revLen == 0 ) kouhoRevLine = -1; @@ -483,8 +483,8 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod kouhoUTF, &revposUTF, &state ); //then, count full-spaces before revpos kouhoRevLine = 0; - - if ( current_mode == CANNA_MODE_TourokuMode + + if ( current_mode == CANNA_MODE_TourokuMode || ( kanji_status.gline.length != 0 && current_mode != CANNA_MODE_KigoMode && current_mode != CANNA_MODE_IchiranMode && current_mode != CANNA_MODE_YesNoMode @@ -511,7 +511,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod { for ( long i = 0; i < revposUTF ; i++ ) { - if ( (uint8)kouhoUTF[ i ] == 0xe3 + if ( (uint8)kouhoUTF[ i ] == 0xe3 && (uint8)kouhoUTF[ i + 1 ] == 0x80 && (uint8)kouhoUTF[ i + 2 ] == 0x80 ) kouhoRevLine++; @@ -520,7 +520,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod } //printf("KouhoRevLine = %d\n", kouhoRevLine ); - + // setup title string switch ( current_mode ) { @@ -588,7 +588,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod //setup info string according to current mode char* index; int32 len; - + if (current_mode == CANNA_MODE_IchiranMode || current_mode == CANNA_MODE_ExtendMode || (current_mode == CANNA_MODE_TourokuHinshiMode @@ -632,7 +632,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod kouhoUTFLen = strlen(kouhoUTF); } /* - if ( current_mode == CANNA_MODE_TourokuMode + if ( current_mode == CANNA_MODE_TourokuMode || ( kanji_status.gline.length != 0 && ( current_mode == CANNA_MODE_TankouhoMode || current_mode == CANNA_MODE_TankouhoMode || current_mode == CANNA_MODE_AdjustBunsetsuMode ))) @@ -644,7 +644,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod *index = '\x0a'; } } -*/ +*/ if ( current_mode == CANNA_MODE_IchiranMode || current_mode == CANNA_MODE_RussianMode || current_mode == CANNA_MODE_LineMode @@ -662,7 +662,7 @@ SERIAL_PRINT(( "CannaInterface: GenerateKouhoStr() revPos = %d, revLen = %d, mod while ( ( *index >= '0' && *index <= '9' ) || *index == '/' ) index--; strcat( infoUTF, index ); - + //remove excess spaces before number display while ( *index == ' ' ) *index-- = '\0'; @@ -690,14 +690,14 @@ uint32 CannaInterface::ChangeMode( int32 mode ) ksv.buffer = (unsigned char *)kakuteiStr; ksv.bytes_buffer = CONVERT_BUFFER_SIZE; ksv.val = mode; - + jrKanjiControl( context_id, KC_CHANGEMODE, (char *)&ksv ); kakuteiLen = ksv.val; #ifdef DEBUG SERIAL_PRINT(( "CannaInterface: ChangeMode returned kakuteiLen = %d\n", kakuteiLen )); SERIAL_PRINT(( "CannaInterface: ChangeMode mikakuteiLen = %d\n", kanji_status.length )); #endif - + return UpdateKanjiStatus(); } @@ -712,7 +712,7 @@ uint32 CannaInterface::Kakutei() ksv.ks = &kanji_status; ksv.buffer = (unsigned char *)kakuteiStr; ksv.bytes_buffer = CONVERT_BUFFER_SIZE; - + jrKanjiControl( context_id, KC_KAKUTEI, (char *)&ksv ); kakuteiLen = ksv.val; #ifdef DEBUG @@ -751,13 +751,13 @@ CannaInterface::GetRevStartPositionInChar() { int32 charNum; charNum = 0; - + if ( mikakuteiUTFLen == 0 ) return 0; #ifdef DEBUG SERIAL_PRINT(( "CannaInterface: GetRevStartPos revBegin = %d\n", revBegin )); #endif - + for ( int32 i = 0 ; i < mikakuteiUTFLen ; i += UTF8CharLen( mikakuteiUTF[i] ) ) { diff --git a/src/add-ons/input_server/methods/canna/CannaInterface.h b/src/add-ons/input_server/methods/canna/CannaInterface.h index 2e80df82fb..ae125ccdb1 100644 --- a/src/add-ons/input_server/methods/canna/CannaInterface.h +++ b/src/add-ons/input_server/methods/canna/CannaInterface.h @@ -60,7 +60,7 @@ private: uint32 UpdateKanjiStatus(); void InitializeCanna(); - + public: CannaInterface( char *basepath ); ~CannaInterface(); diff --git a/src/add-ons/input_server/methods/canna/CannaLooper.cpp b/src/add-ons/input_server/methods/canna/CannaLooper.cpp index 61fd9a2f8f..d9ec2359a9 100644 --- a/src/add-ons/input_server/methods/canna/CannaLooper.cpp +++ b/src/add-ons/input_server/methods/canna/CannaLooper.cpp @@ -181,7 +181,7 @@ CannaLooper::MessageReceived(BMessage* msg) panel->Go(); break; } - + case RELOAD_INIT_FILE: _ForceKakutei(); fCanna->Reset(); @@ -425,7 +425,7 @@ CannaLooper::_HandleMethodActivated(bool active) { if (active) { if (!fPaletteWindow) { - // first time input method activated + // first time input method activated float x = gSettings.palette_loc.x; float y = gSettings.palette_loc.y; BRect frame(x, y, x + 114, y + 44); @@ -448,8 +448,8 @@ CannaLooper::_HandleMethodActivated(bool active) fOwner->SetMenu(NULL, this); } } - - + + void CannaLooper::_ForceKakutei() { diff --git a/src/add-ons/input_server/methods/canna/CannaMethod.cpp b/src/add-ons/input_server/methods/canna/CannaMethod.cpp index 972df41fa8..2e4a5d3eb4 100644 --- a/src/add-ons/input_server/methods/canna/CannaMethod.cpp +++ b/src/add-ons/input_server/methods/canna/CannaMethod.cpp @@ -1,6 +1,6 @@ // -// CannaIM - Canna-based Input Method Add-on for BeOS R4 -// +// CannaIM - Canna-based Input Method Add-on for BeOS R4 +// #include #include @@ -61,12 +61,12 @@ status_t CannaMethod::MethodActivated( bool active ) { BMessage msg( CANNA_METHOD_ACTIVATED ); - + if ( active ) msg.AddBool( "active", true ); - + cannaLooper.SendMessage( &msg ); - + return B_OK; } @@ -75,7 +75,7 @@ CannaMethod::Filter( BMessage *msg, BList *outList ) { if ( msg->what != B_KEY_DOWN ) return B_DISPATCH_MESSAGE; - + cannaLooper.SendMessage( msg ); return B_SKIP_MESSAGE; } @@ -99,7 +99,7 @@ CannaMethod::InitCheck() else SERIAL_PRINT(( "CannaLooper::InitCheck() success.\n" )); #endif - + return err; } @@ -133,7 +133,7 @@ void CannaMethod::WriteSettings() BMessage pref; BFile preffile( CANNAIM_SETTINGS_FILE, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE ); - + if ( preffile.InitCheck() == B_NO_ERROR ) { pref.AddBool( "arrowkey", gSettings.convert_arrowkey ); diff --git a/src/add-ons/input_server/methods/canna/CannaMethod.h b/src/add-ons/input_server/methods/canna/CannaMethod.h index 82b14b1f1a..e4ff975e72 100644 --- a/src/add-ons/input_server/methods/canna/CannaMethod.h +++ b/src/add-ons/input_server/methods/canna/CannaMethod.h @@ -1,6 +1,6 @@ // -// CannaIM - Canna-based Input Method Add-on for BeOS R4 -// +// CannaIM - Canna-based Input Method Add-on for BeOS R4 +// #ifndef _CANNAMETHOD_H #define _CANNAMETHOD_H diff --git a/src/add-ons/input_server/methods/canna/KouhoWindow.cpp b/src/add-ons/input_server/methods/canna/KouhoWindow.cpp index d297987ebc..1511d19b8e 100644 --- a/src/add-ons/input_server/methods/canna/KouhoWindow.cpp +++ b/src/add-ons/input_server/methods/canna/KouhoWindow.cpp @@ -19,7 +19,7 @@ KouhoWindow::KouhoWindow( BFont *font, BLooper *looper ) :BWindow( DUMMY_RECT, - "kouho", B_MODAL_WINDOW_LOOK, + "kouho", B_MODAL_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_AVOID_FOCUS | @@ -38,15 +38,15 @@ KouhoWindow::KouhoWindow( BFont *font, BLooper *looper ) strcpy( style, "Regular" ); indexfont.SetFamilyAndStyle( family, style ); indexfont.SetSize( 10 ); - + #ifdef DEBUG SERIAL_PRINT(( "kouhoWindow: Constructor called.\n" )); #endif - + //setup main pane indexWidth = indexfont.StringWidth( "W" ) + INDEXVIEW_SIDE_MARGIN * 2; minimumWidth = indexfont.StringWidth( "ギリシャ 100/100" ); - + frame = Bounds(); frame.left = indexWidth + 2; frame.bottom -= INFOVIEW_HEIGHT; @@ -64,7 +64,7 @@ SERIAL_PRINT(( "kouhoWindow: Constructor called.\n" )); indexView = new KouhoIndexView( frame, fontHeight ); indexView->SetFont( &indexfont ); AddChild( indexView ); - + frame = Bounds(); frame.top = frame.bottom - INFOVIEW_HEIGHT + 1; infoView = new KouhoInfoView( frame ); @@ -78,7 +78,7 @@ void KouhoWindow::MessageReceived( BMessage* msg ) float height, width, x, y, w; BPoint point; BRect screenrect, frame; - + switch( msg->what ) { case KOUHO_WINDOW_HIDE: @@ -91,36 +91,36 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_HIDE recieved.\n" )); standalone_mode = false; } break; - + case KOUHO_WINDOW_SHOW: #ifdef DEBUG SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOW recieved.\n" )); #endif ShowWindow(); break; - + case KOUHO_WINDOW_SHOW_ALONE: standalone_mode = true; frame = Frame(); screenrect = BScreen().Frame(); frame.OffsetTo( gSettings.standalone_loc.x, gSettings.standalone_loc.y ); - + x = screenrect.right - frame.right; y = screenrect.bottom - frame.bottom; - + if ( x < 0 ) frame.OffsetBy( x, 0 ); - + if ( y < 0 ) frame.OffsetBy( 0, y ); - + gSettings.standalone_loc.x = frame.left; gSettings.standalone_loc.y = frame.top; point = frame.LeftTop(); MoveTo( point ); ShowWindow(); break; - + case KOUHO_WINDOW_SHOWAT: #ifdef DEBUG SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" )); @@ -129,24 +129,24 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" )); msg->FindFloat( "height", &height ); ShowAt( point, height ); break; - + case KOUHO_WINDOW_SETTEXT: const char* newtext; bool hideindex, limitsize; msg->FindString( "text", &newtext ); kouhoView->SetText( newtext ); - + msg->FindBool( "index", &hideindex ); indexView->HideNumberDisplay( hideindex ); msg->FindBool( "limit", &limitsize ); height = kouhoView->TextHeight( 0, kouhoView->TextLength() ); height += INFOVIEW_HEIGHT; - + msg->FindString( "info", &newtext ); infoView->SetText( newtext ); // calculate widest line width - width = 0; + width = 0; for ( int32 line = 0, numlines = kouhoView->CountLines() ; line < numlines ; line++ ) { @@ -174,13 +174,13 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SETTEXT(partial) received. rev = %d to msg->FindInt32( "kouhorev", &kouhorevline ); kouhoView->HighlightLine( kouhorevline ); } - + break; - + case NUM_SELECTED_FROM_KOUHO_WIN: cannaLooper->PostMessage( msg ); break; - + default: BWindow::MessageReceived( msg ); } @@ -194,7 +194,7 @@ void KouhoWindow::ShowAt( BPoint revpoint, float height ) kouhowidth = Frame().IntegerWidth(); kouhoheight = Frame().IntegerHeight(); - + screenrect = BScreen( this ).Frame(); #ifdef DEBUG SERIAL_PRINT(( "KouhoWindow: ShowAt activated. point x= %f, y= %f, height= %f", revpoint.x, revpoint.y, height )); @@ -209,16 +209,16 @@ SERIAL_PRINT(( "KouhoWindow: ShowAt activated. point x= %f, y= %f, height= %f", point.y = revpoint.y - kouhoheight - WINDOW_BORDER_WIDTH_V; // else // point.y = revpoint.y + height; - + if ( point.x + kouhowidth > screenrect.right ) point.x = point.x - (screenrect.right - (point.x + kouhowidth )); -// point.x = revpoint.x +// point.x = revpoint.x // - ( revpoint.x + kouhowidth + WINDOW_BORDER_WIDTH - screenrect.right ); // else // point.x = revpoint.x; - + MoveTo( point ); - ShowWindow(); + ShowWindow(); } void @@ -260,7 +260,7 @@ void KouhoView::HighlightLine( int32 line ) BRegion region; if ( line != -1 ) - { + { begin = OffsetAt( line ); if ( line == CountLines() - 1 ) end = TextLength() + 1; @@ -273,9 +273,9 @@ void KouhoView::HighlightLine( int32 line ) //extend highlihght region to right end highlightRect.right = Bounds().right; Invalidate( highlightRect ); - + } - + } void @@ -286,7 +286,7 @@ KouhoView::HighlightPartial( int32 begin, int32 end ) highlightRect = region.RectAt( 0 ); Invalidate( highlightRect ); } - + void KouhoView::Draw( BRect rect ) { BTextView::Draw( rect ); @@ -303,7 +303,7 @@ void KouhoView::MouseDown( BPoint point ) iview = (KouhoIndexView *)(Window()->FindView( "index" )); if ( iview->IsNumberDisplayHidden() ) return; - + int32 number; number = LineAt( point ); BMessage msg( NUM_SELECTED_FROM_KOUHO_WIN ); @@ -325,7 +325,7 @@ KouhoIndexView::KouhoIndexView( BRect frame, float fontheight ) indexfontheight = ht.ascent + ht.descent + ht.leading; if ( indexfontheight < lineHeight ) fontOffset = (int32)((lineHeight - indexfontheight) / 2 + 1.5); -//printf("line height=%f, index font height=%f, offset=%d\n", lineHeight, indexfontheight, fontOffset ); +//printf("line height=%f, index font height=%f, offset=%d\n", lineHeight, indexfontheight, fontOffset ); } diff --git a/src/add-ons/input_server/methods/canna/KouhoWindow.h b/src/add-ons/input_server/methods/canna/KouhoWindow.h index e9b8db0a23..8103b0b472 100644 --- a/src/add-ons/input_server/methods/canna/KouhoWindow.h +++ b/src/add-ons/input_server/methods/canna/KouhoWindow.h @@ -49,7 +49,7 @@ class KouhoIndexView : public BBox { private: float lineHeight; - int32 fontOffset; //for vertical centering + int32 fontOffset; //for vertical centering bool hideNumber; public: KouhoIndexView( BRect rect, float height ); diff --git a/src/add-ons/input_server/methods/canna/PaletteWindow.cpp b/src/add-ons/input_server/methods/canna/PaletteWindow.cpp index a2ca66ee03..292e3ac527 100644 --- a/src/add-ons/input_server/methods/canna/PaletteWindow.cpp +++ b/src/add-ons/input_server/methods/canna/PaletteWindow.cpp @@ -19,7 +19,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) :BWindow( rect, B_EMPTY_STRING, kLeftTitledWindowLook, B_FLOATING_ALL_WINDOW_FEEL, - B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE | + B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE | B_AVOID_FOCUS | B_WILL_ACCEPT_FIRST_CLICK ) { cannaLooper = looper; @@ -31,7 +31,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) frame.right += 3; back = new BBox( frame ); AddChild( back ); - + BRect largerect( 0, 0, HexOnwidth - 1, HexOnheight - 1 ); BRect smallrect( 0, 0, HiraOnwidth - 1, HiraOnheight - 1); int32 largebytes = HexOnbytesperpixel * HexOnwidth * HexOnheight; @@ -43,9 +43,9 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) //printf( "smallbytes = %d\n", smallbytes ); smallimage = new BBitmap( smallrect, cspace ); largeimage = new BBitmap( largerect, cspace ); - + back->MovePenTo( 0, 0 ); - + smallimage->SetBits( HiraOnbits, smallbytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( smallimage ); @@ -59,7 +59,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) HiraButton = new BPictureButton( BRect( 4, 4, 4 + HiraOnwidth - 1, 4 + HiraOnheight - 1), "hira", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( HiraButton ); - + smallimage->SetBits( KataOnbits, smallbytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( smallimage ); @@ -73,7 +73,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) KataButton = new BPictureButton( BRect( 26, 4, 26 + HiraOnwidth - 1, 4 + HiraOnheight - 1 ), "kata", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( KataButton ); - + smallimage->SetBits( ZenAlphaOnbits, smallbytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( smallimage ); @@ -87,7 +87,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) ZenAlphaButton = new BPictureButton( BRect( 48, 4, 48 + HiraOnwidth - 1, 4 + HiraOnheight - 1 ), "zenalpha", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( ZenAlphaButton ); - + smallimage->SetBits( HanAlphaOnbits, smallbytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( smallimage ); @@ -101,7 +101,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) HanAlphaButton = new BPictureButton( BRect( 70, 4, 70 + HiraOnwidth - 1, 4 + HiraOnheight - 1 ), "hanalpha", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( HanAlphaButton ); - + largeimage->SetBits( ExtendOnbits, largebytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( largeimage ); @@ -115,7 +115,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) ExtendButton = new BPictureButton( BRect( 94, 4, 94 + HexOnwidth -1 , 4 + HexOnheight - 1 ), "extend", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( ExtendButton ); - + largeimage->SetBits( KigoOnbits, largebytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( largeimage ); @@ -129,7 +129,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) KigoButton = new BPictureButton( BRect( 4, 26, 4 + HexOnwidth -1, 26 + HexOnheight - 1 ), "kigo", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( KigoButton ); - + largeimage->SetBits( HexOnbits, largebytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( largeimage ); @@ -143,7 +143,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) HexButton = new BPictureButton( BRect( 34, 26, 34 + HexOnwidth -1, 26 + HexOnheight - 1 ), "hex", offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( HexButton ); - + largeimage->SetBits( BushuOnbits, largebytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( largeimage ); @@ -158,7 +158,7 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) offpict, onpict, msg, B_TWO_STATE_BUTTON ); back->AddChild( BushuButton ); -/* +/* largeimage->SetBits( TorokuOnbits, largebytes, 0, cspace ); back->BeginPicture( new BPicture ); back->DrawBitmap( largeimage ); @@ -178,10 +178,10 @@ PaletteWindow::PaletteWindow( BRect rect, BLooper *looper ) delete largeimage; delete offpict; delete onpict; - + } - + void PaletteWindow::MessageReceived( BMessage *msg ) { int32 mode; @@ -191,23 +191,23 @@ void PaletteWindow::MessageReceived( BMessage *msg ) if ( !IsHidden() ) Hide(); break; - + case PALETTE_WINDOW_SHOW: if ( IsHidden() ) { BRect frame = Frame(); BRect screenrect = BScreen().Frame(); float x, y; - + x = screenrect.right - frame.right; y = screenrect.bottom - frame.bottom; - + if ( x < 0 ) frame.OffsetBy( x, 0 ); - + if ( y < 0 ) frame.OffsetBy( 0, y ); - + MoveTo( frame.left, frame.top ); SetWorkspaces( B_CURRENT_WORKSPACE ); Show(); @@ -270,13 +270,13 @@ void PaletteWindow::MessageReceived( BMessage *msg ) break; } break; - - + + default: BWindow::MessageReceived( msg ); } } - + void PaletteWindow::AllButtonOff() { HiraButton->SetValue( B_CONTROL_OFF );