Skip to content

Commit

Permalink
Merge pull request #4 from OscarL/haiku-fixes
Browse files Browse the repository at this point in the history
Fix compilation, add stubbed out version of missing source files.
  • Loading branch information
pulkomandy authored Mar 20, 2024
2 parents db78755 + f2b13dc commit 26ffe79
Show file tree
Hide file tree
Showing 36 changed files with 324 additions and 46 deletions.
64 changes: 64 additions & 0 deletions Common/Support/BarberPole.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include "BarberPole.h"


BarberPole::BarberPole(BRect pRect, const char *pName, uint32 resizingMode, uint32 flags, int pDirection)
: BView(pRect, pName, resizingMode, flags) {

spinning_thread_id = spawn_thread(spinningThread, pName, B_DISPLAY_PRIORITY, this);
is_running = false;
direction = pDirection;
};

BarberPole::~BarberPole(){
kill_thread(spinning_thread_id);
}

void BarberPole::Start(){
resume_thread(spinning_thread_id);
is_running = true;
}

void BarberPole::Stop(){
suspend_thread(spinning_thread_id);
is_running = false;
}

bool BarberPole::IsRunning(){
return is_running;
}

int32 BarberPole::spinningThread(void *data){
BarberPole *lBarberPole = (BarberPole*)data;
pattern lStripes;

lStripes.data[0] = 0x0f;
lStripes.data[1] = 0x1e;
lStripes.data[2] = 0x3c;
lStripes.data[3] = 0x78;
lStripes.data[4] = 0xf0;
lStripes.data[5] = 0xe1;
lStripes.data[6] = 0xc3;
lStripes.data[7] = 0x87;

while(1==1){
lBarberPole->LockLooper();
lBarberPole->FillRect(lBarberPole->Bounds(), lStripes);
lBarberPole->UnlockLooper();

if(lBarberPole->direction == FROM_RIGHT_TO_LEFT){
uchar tmp = lStripes.data[0];
for (int j = 0; j < 7; ++j) {
lStripes.data[j] = lStripes.data[j+1];
}
lStripes.data[7] = tmp;
} else {
uchar tmp = lStripes.data[7];
for (int j = 7; j > 0; --j) {
lStripes.data[j] = lStripes.data[j-1];
}
lStripes.data[0] = tmp;

}
snooze(25000);
}
};
28 changes: 28 additions & 0 deletions Common/Support/BarberPole.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef _BARBERPOLE_H_
#define _BARBERPOLE_H_

#include <View.h>

const int FROM_RIGHT_TO_LEFT = 0;
const int FROM_LEFT_TO_RIGHT = 1;

class BarberPole : public BView {
public:
BarberPole(BRect pRect, const char *pName, uint32 resizingMode, uint32 flags = 0, int pDirection = FROM_LEFT_TO_RIGHT);
~BarberPole();

void Start();
void Stop();

bool IsRunning();

protected:
thread_id spinning_thread_id;
bool is_running;

private:
int direction;
static int32 spinningThread(void *data);
};

#endif
15 changes: 15 additions & 0 deletions Common/Support/BarberPole.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Dortmund, Germany.
December, 12th 1998

BarberPole is a little class, that shows this little spinning barber pole, you probably know from Net+ or the Tracker.

This is V1.0 and should compile on both x86 and PPC, although I currently haven't tested it on PPC. If you want to set the color of the pole, do it by using

myBarberPol->SetHighColor(...)
and
myBarberPole->SetLowColor(...)

BarberPole is Freeware. If you made any changes, please report it to me, so I could update it.

[email protected] // Member of DeBUG - German Be User Group
// http://www.BeUserGroup.de
1 change: 1 addition & 0 deletions Common/Support/DragNDrop.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <Rect.h>
#include <Message.h>
#include <View.h>

/*
* Class: RefDragMessage
Expand Down
6 changes: 3 additions & 3 deletions Common/Support/Scripter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Scripter :: Scripter( const char * s, property_info* pi )
fprintf( stderr, "Created Scripter (%p) as\n\
Suite: %s\n\
property_info *: %p\n\
Default Options: %lu\n", this, fSuite, pi, fOptions ) ;
Default Options: %" B_PRIu32 "\n", this, fSuite, pi, fOptions ) ;
}
}

Expand All @@ -55,7 +55,7 @@ Scripter :: Scripter( const char * s, property_info* pi, uint32 opt )
fprintf( stderr, "Created Scripter (%p) as\n\
Suite: %s\n\
property_info *: %p\n\
Set Options: %lu\n", this, fSuite, pi, fOptions ) ;
Set Options: %" B_PRIu32 "\n", this, fSuite, pi, fOptions ) ;
}
}

Expand Down Expand Up @@ -138,7 +138,7 @@ int32 Scripter :: FindMatch( BMessage * m, int32 i,
int32 idx = fPropInfo.FindMatch( m, i, s, w, prop) ;

if( fOptions & PrintDebug )
fprintf( stderr, "Match for %s is %ld (%p)\n", prop, idx, this ) ;
fprintf( stderr, "Match for %s is %" B_PRId32 " (%p)\n", prop, idx, this ) ;

// clean up
delete[] buff ;
Expand Down
4 changes: 0 additions & 4 deletions Common/Support/Support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,6 @@ char * StringUtils:: VerboseErrorString( status_t e , char * str )
strcpy( str, "B_FILE_ERROR " ) ;
break ;

case B_FILE_NOT_FOUND:
strcpy( str, "B_FILE_NOT_FOUND " ) ;
break ;

case B_FILE_EXISTS:
strcpy( str, "B_FILE_EXISTS " ) ;
break ;
Expand Down
4 changes: 2 additions & 2 deletions Common/Support/Support.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ namespace ObjectUtils
{
// Duplicates an object from another pointer
template <class T>
inline T* Dup( T* )
inline T* Dup( T* t )
{
return new T( *t ) ;
}

template <class T>
inline void Swap( T& , T& )
inline void Swap( T& a, T& b )
{
T c = a ;
a = b ;
Expand Down
2 changes: 1 addition & 1 deletion Common/Support/WindowList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void WindowList :: CloseAll( void )
{
Lock() ;
void * v ;
while( (v = fList.RemoveItem( 0L )) != NULL )
while( (v = fList.RemoveItem( (int32)0L )) != NULL )
{
reinterpret_cast<BWindow *>( v )->Quit() ;
}
Expand Down
1 change: 1 addition & 0 deletions Common/Support/WindowList.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*******************************************************/

#include <List.h>
#include <Message.h>

class BWindow ;

Expand Down
8 changes: 4 additions & 4 deletions Common/UI/EditBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,28 +126,28 @@ void EditBox :: SetFloat( float f , const char * fmt )
void EditBox :: SetInt( int32 i )
{
char str[64] ;
sprintf( str, "%ld", i ) ;
sprintf( str, "%" B_PRId32, i ) ;
fpTextView->SetText( str ) ;
}

void EditBox :: SetIntOct( int32 i )
{
char str[64] ;
sprintf( str, "%lo", i ) ;
sprintf( str, "%" B_PRIo32, (uint32) i ) ;
fpTextView->SetText( str ) ;
}

void EditBox :: SetIntHex( int32 i )
{
char str[64] ;
sprintf( str, "%lx", i ) ;
sprintf( str, "%" B_PRIx32, (uint32) i ) ;
fpTextView->SetText( str ) ;
}

void EditBox :: SetIntHEX( int32 i )
{
char str[64] ;
sprintf( str, "%lX", i ) ;
sprintf( str, "%" B_PRIX32, (uint32) i ) ;
fpTextView->SetText( str ) ;
}

Expand Down
10 changes: 10 additions & 0 deletions Common/UI/Globals.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Stubbed out Globals.h for Tim Vernum's TraX.

#ifndef GLOBALS_H
#define GLOBALS_H

#include "ResultsHandler.h"

static ResultsHandler gResults;

#endif
17 changes: 17 additions & 0 deletions Common/UI/Joins.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Stubbed out Joins.h for Tim Vernum's TraX.

#ifndef JOINS_H
#define JOINS_H

static const char* const kOpenStrings[] = { "", "(" };
static const char* const kCloseStrings[] = { "", ")" };
static const char* const kNotStrings[] = { "", "not" };
static const char* const kConjunctionStrings[] = { "", "and" };

// Fixme: these are just wild guesses for now:
static const char* const kOpenValues[] = { "", "(" };
static const char* const kCloseValues[] = { "", ")" };
static const char* const kNotValues[] = { "", "!" };
static const char* const kConjunctionValues[] = { "", "&&" };

#endif
34 changes: 34 additions & 0 deletions Common/UI/ResultsHandler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Stubbed out ResultsHandler.{h,cpp} for Tim Vernum's TraX.

#include "ResultsHandler.h"
#include "ResultsWindow.h"


ResultsHandler::ResultsHandler()
{
}


void
ResultsHandler::Init()
{
}


int
ResultsHandler::AddResult(const char* foobar)
{
return ResultsWindow::AddResult(foobar);
}


void
ResultsHandler::NewSearch()
{
}


void
ResultsHandler::EndSearch()
{
}
20 changes: 20 additions & 0 deletions Common/UI/ResultsHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Stubbed out ResultsHandler.{h,cpp} for Tim Vernum's TraX.

#ifndef RESULTSHANDLER_H
#define RESULTSHANDLER_H


class ResultsHandler {
public:
ResultsHandler();

void Init();

void NewSearch();
void EndSearch();

static int AddResult(const char*);
};


#endif
6 changes: 3 additions & 3 deletions Common/UI/ResultsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ResultsWindow :: ResultsWindow( void )
ResultsWindow :: ~ResultsWindow( void )
{
BListItem * bli ;
while( (bli = fpList->RemoveItem(0L)) != NULL )
while ((bli = fpList->RemoveItem(static_cast<int32>(0L))) != NULL)
delete bli ;
}

Expand Down Expand Up @@ -132,7 +132,7 @@ bool ResultsWindow :: QuitRequested( void )
}
}

return inherited::QuitRequested() ;
return BWindow::QuitRequested() ;
}

void ResultsWindow :: MessageReceived( BMessage * msg )
Expand All @@ -153,7 +153,7 @@ void ResultsWindow :: MessageReceived( BMessage * msg )

default:
{
inherited::MessageReceived( msg ) ;
BWindow::MessageReceived( msg ) ;
break ;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Common/UI/ResultsWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ class ResultsWindow : public BWindow
} ;


#endif
#endif
5 changes: 5 additions & 0 deletions Common/UI/Settings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Stubbed out Settings.cpp for Tim Vernum's TraX.

#include "Settings.h"

TraxSettings gSettings;
23 changes: 23 additions & 0 deletions Common/UI/Settings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Stubbed out Settings.h for Tim Vernum's TraX.

#ifndef SETTINGS_H
#define SETTINGS_H


typedef struct settings {
enum {
eShowBrackets,
eShowJoinPanel,
eShowNot
};

int fConjunction;
const char* fDefaultFolder;
bool fUseTracker;
int fShow;
} TraxSettings;


extern TraxSettings gSettings;

#endif
10 changes: 10 additions & 0 deletions Common/UI/SettingsWindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Stubbed out SettingsWindow.{h,cpp} for Tim Vernum's TraX.

#include "SettingsWindow.h"


SettingsWindow::SettingsWindow()
: BWindow(BRect( 100, 100, 400, 250 ) , "Settings", B_DOCUMENT_WINDOW, B_NOT_CLOSABLE | B_NOT_RESIZABLE)
{

}
Loading

0 comments on commit 26ffe79

Please sign in to comment.