CannaIM: style cleanup

This commit is contained in:
Jérôme Duval
2012-02-18 15:17:28 +01:00
parent d8116125d1
commit 484b565ad0
@@ -16,6 +16,7 @@
#include "KouhoWindow.h"
KouhoWindow::KouhoWindow(BFont *font, BLooper *looper)
:BWindow( DUMMY_RECT,
"kouho", B_MODAL_WINDOW_LOOK,
@@ -72,20 +73,20 @@ SERIAL_PRINT(( "kouhoWindow: Constructor called.\n" ));
AddChild(infoView);
}
void KouhoWindow::MessageReceived( BMessage* msg )
void
KouhoWindow::MessageReceived(BMessage* msg)
{
float height, width, x, y, w;
BPoint point;
BRect screenrect, frame;
switch( msg->what )
{
switch(msg->what) {
case KOUHO_WINDOW_HIDE:
#ifdef DEBUG
SERIAL_PRINT(("kouhoWindow: KOUHO_WINDOW_HIDE recieved.\n"));
#endif
if ( !IsHidden() )
{
if (!IsHidden()) {
Hide();
standalone_mode = false;
}
@@ -147,8 +148,7 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" ));
// calculate widest line width
width = 0;
for (int32 line = 0, numlines = kouhoView->CountLines();
line < numlines ; line++ )
{
line < numlines; line++) {
w = kouhoView->LineWidth(line);
if (w > width)
width = w;
@@ -157,8 +157,7 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" ));
width = minimumWidth;
ResizeTo(width + indexWidth + KOUHOVIEW_SIDE_MARGIN, height);
if ( msg->HasBool( "partial" ) )
{
if (msg->HasBool("partial")) {
int32 begin, end;
msg->FindInt32("revbegin", &begin);
msg->FindInt32("revend", &end);
@@ -166,9 +165,7 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SHOWAT recieved.\n" ));
#ifdef DEBUG
SERIAL_PRINT(("kouhoWindow: KOUHO_WINDOW_SETTEXT(partial) received. rev = %d to %d\n", begin, end));
#endif
}
else
{
} else {
int32 kouhorevline;
msg->FindInt32("kouhorev", &kouhorevline);
kouhoView->HighlightLine(kouhorevline);
@@ -185,7 +182,9 @@ SERIAL_PRINT(( "kouhoWindow: KOUHO_WINDOW_SETTEXT(partial) received. rev = %d to
}
}
void KouhoWindow::ShowAt( BPoint revpoint, float height )
void
KouhoWindow::ShowAt(BPoint revpoint, float height)
{
BRect screenrect;
BPoint point;
@@ -220,26 +219,27 @@ SERIAL_PRINT(( "KouhoWindow: ShowAt activated. point x= %f, y= %f, height= %f",
ShowWindow();
}
void
KouhoWindow::FrameMoved(BPoint screenPoint)
{
if (standalone_mode)
gSettings.standalone_loc = screenPoint;
return;
}
// ShowWindow() shows kouho window on current workspace
// This is a bug fix for version 1.0 beta 2
void
KouhoWindow::ShowWindow()
{
if ( IsHidden() )
{
if (IsHidden()) {
SetWorkspaces(B_CURRENT_WORKSPACE);
Show();
}
}
/*
KouhoView section
*/
@@ -252,14 +252,15 @@ KouhoView::KouhoView( BRect rect )
selection_color.blue = 255;
}
void KouhoView::HighlightLine( int32 line )
void
KouhoView::HighlightLine(int32 line)
{
//printf("highlightLine set to :%d\n", line);
int32 begin, end;
BRegion region;
if ( line != -1 )
{
if (line != -1) {
begin = OffsetAt(line);
if (line == CountLines() - 1)
end = TextLength() + 1;
@@ -276,6 +277,7 @@ void KouhoView::HighlightLine( int32 line )
}
void
KouhoView::HighlightPartial(int32 begin, int32 end)
{
@@ -285,17 +287,21 @@ KouhoView::HighlightPartial( int32 begin, int32 end )
Invalidate(highlightRect);
}
void KouhoView::Draw( BRect rect )
void
KouhoView::Draw(BRect rect)
{
BTextView::Draw(rect);
rgb_color viewcolor = ViewColor();
// rgb_color viewcolor = ViewColor();
SetHighColor(selection_color);
SetDrawingMode(B_OP_MIN);
FillRect(highlightRect);
// SetViewColor(viewcolor);
}
void KouhoView::MouseDown( BPoint point )
void
KouhoView::MouseDown(BPoint point)
{
KouhoIndexView *iview;
iview = (KouhoIndexView *)(Window()->FindView("index"));
@@ -309,6 +315,8 @@ void KouhoView::MouseDown( BPoint point )
msg.AddInt8("byte", (int8)number + '1');
Window()->PostMessage(&msg);
}
/*
KouhoIndexView section
*/
@@ -327,11 +335,12 @@ KouhoIndexView::KouhoIndexView( BRect frame, float fontheight )
}
void KouhoIndexView::Draw( BRect rect )
void
KouhoIndexView::Draw(BRect rect)
{
BBox::Draw(rect);
for ( long i = 1; i < 17 ; i++ )
{
for (long i = 1; i < 17; i++) {
MovePenTo(INDEXVIEW_SIDE_MARGIN + 2, lineHeight * i - fontOffset);
if (hideNumber)
DrawString("");
@@ -350,6 +359,7 @@ KouhoInfoView::KouhoInfoView( BRect frame )
{
}
void
KouhoInfoView::Draw(BRect rect)
{
@@ -360,3 +370,4 @@ KouhoInfoView::Draw( BRect rect )
StrokeLine(start, end);
BStringView::Draw(rect);
}