Merge pull request #3 from bbjimmy/master

pulling from upstream
This commit is contained in:
Samuel Crow 2020-07-19 21:37:17 -05:00 committed by GitHub
commit 5f81a3f4b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 699 additions and 162 deletions

View File

@ -53,7 +53,7 @@ OPT = -O
## ##
## set libtrary name ## set libtrary name
## ##
YABLIBRARY := libyab.so YABLIBRARY := libyab1.so
## ##
# #
@ -69,7 +69,7 @@ GPP_OPT = $(DBG) $(OPT) -I. -DHAVE_CONFIG -DUNIX $(HAIKUOPT)
## find out if we need to change the library to libyab_x86.so and use gcc instead of ld ## find out if we need to change the library to libyab_x86.so and use gcc instead of ld
ifeq ($(USEDARCH), x86) ifeq ($(USEDARCH), x86)
LD = gcc LD = gcc
YABLIBRARY:=libyab_x86.so YABLIBRARY:=libyab1_x86.so
else else
LD = ld LD = ld
endif endif
@ -87,7 +87,7 @@ LD_OPT = -shared
LIBPATHS = $(shell findpaths -a `getarch` B_FIND_PATH_LIB_DIRECTORY;findpaths -a `getarch` B_FIND_PATH_DEVELOP_LIB_DIRECTORY) . LIBPATHS = $(shell findpaths -a `getarch` B_FIND_PATH_LIB_DIRECTORY;findpaths -a `getarch` B_FIND_PATH_DEVELOP_LIB_DIRECTORY) .
LIBPATH=$(addprefix -L,$(LIBPATHS)) LIBPATH=$(addprefix -L,$(LIBPATHS))
##LIBPATH = -L`finddir B_SYSTEM_LIB_DIRECTORY` ##/boot/system/lib ##LIBPATH = -L`finddir B_SYSTEM_LIB_DIRECTORY` ##/boot/system/lib
LIB = -lbe -lroot -ltranslation -ltracker -lmedia -llocalestub LIB = -lbe -lroot -ltranslation -ltracker -lmedia -llocalestub -lgame
## flags for flex (-d for debugging) ## flags for flex (-d for debugging)
FLEXFLAGS = -i -I -L -s FLEXFLAGS = -i -I -L -s

11
src/MediaPlay.h Normal file
View File

@ -0,0 +1,11 @@
/*
* Copyright 2017, Dario Casalinuovo. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _MEDIA_CLIENT_PLAY
#define _MEDIA_CLIENT_PLAY
int media_play(const char* uri);
#endif

View File

@ -15,7 +15,7 @@
#include <MessageFilter.h> #include <MessageFilter.h>
#include <ControlLook.h> #include <ControlLook.h>
#include "global.h" #include "global.h"
#include <TextView.h>
enum enum
{ {
M_UP='mmup', M_UP='mmup',
@ -130,24 +130,37 @@ Spinner::Spinner(BRect frame, const char *name, const char *label, int32 min, in
BFont f(be_plain_font); BFont f(be_plain_font);
float width1 = f.StringWidth(t.String())+2; float width1 = f.StringWidth(t.String())+2;
float width2 = f.StringWidth(label); float width2 = f.StringWidth(label);
ResizeTo(width1+width2+18+14, 14*2-2); ResizeTo(width1+width2+30, textheight+6); //14*2-2); //+18+14 length of textcontrol
r = Bounds();
r.right-=14+3;
r.bottom=r.top+textheight+8;
r = Bounds();
r.right -= 14+3; //Distance between textcontrol and spinnerbutton
r.bottom=r.top+textheight+8; //+10; //Changed from 8 to 10, because the spinnerbutton look nicer
r.OffsetTo(0, ( (Bounds().Height()-r.Height())/2) ); r.OffsetTo(0, ( (Bounds().Height()-r.Height())/2) );
fTextControl=new BTextControl(r,"textcontrol",label,"0",new BMessage(M_TEXT_CHANGED), fTextControl=new BTextControl(r,"textcontrol",label,"0",new BMessage(M_TEXT_CHANGED),
B_FOLLOW_ALL,B_WILL_DRAW|B_NAVIGABLE); B_FOLLOW_ALL,B_WILL_DRAW|B_NAVIGABLE);
AddChild(fTextControl);
BTextView *tview=fTextControl->TextView();
tview->SetAlignment(B_ALIGN_LEFT);
tview->SetWordWrap(false);
fTextControl->SetDivider(width2+5); AddChild(fTextControl);
BTextView *tview=fTextControl->TextView();
tview->SetAlignment(B_ALIGN_RIGHT); //change from left to right not completed
tview->SetWordWrap(false);
if (strcmp(label, "") == 0) //check if Label was set
{
fTextControl->SetDivider(width2);
}
else if (strcmp(label,"") != 0)
{
fTextControl->SetDivider(width2+4);
}
//fTextControl->SetDivider(width2+5);
//fTextControl->SetAlignment(B_ALIGN_RIGHT,B_ALIGN_RIGHT);
BString string("QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,/qwertyuiop{}| " BString string("QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,/qwertyuiop{}| "
"asdfghjkl:\"zxcvbnm<>?!@#$%^&*()-_=+`~\r"); "asdfghjkl:\"zxcvbnm<>?!@#$%^&*()-_=+`~\r");
for(int32 i=0; i<string.CountChars(); i++) for(int32 i=0; i<string.CountChars(); i++)
{ {
@ -156,16 +169,17 @@ Spinner::Spinner(BRect frame, const char *name, const char *label, int32 min, in
} }
r=Bounds(); r=Bounds();
r.left=r.right-15; r.left=r.right-15;
r.bottom/=2; //r.bottom/=2+4;
//r.top
fUpButton=new SpinnerArrowButton(BPoint(r.left, r.top),"up",ARROW_UP); fUpButton=new SpinnerArrowButton(BPoint(r.left, r.top-1),"up",ARROW_UP); //to make one line with the textcontrol
AddChild(fUpButton); AddChild(fUpButton);
r=Bounds(); r=Bounds();
r.left=r.right-15; r.left=r.right-15;
r.top=r.bottom/2+1; r.top=r.bottom/2; //remove +1 to make one line with the textcontrol
fDownButton=new SpinnerArrowButton(BPoint(r.left, r.top-1),"down",ARROW_DOWN); fDownButton=new SpinnerArrowButton(BPoint(r.left, r.top),"down",ARROW_DOWN);
AddChild(fDownButton); AddChild(fDownButton);
fStep=step; fStep=step;
@ -206,6 +220,7 @@ void Spinner::SetValue(int32 value)
char string[50]; char string[50];
sprintf(string,"%ld",value); sprintf(string,"%ld",value);
fTextControl->SetText(string); fTextControl->SetText(string);
} }
void Spinner::SetViewColor(rgb_color color) void Spinner::SetViewColor(rgb_color color)
@ -224,10 +239,12 @@ void Spinner::SetLabel(const char *text)
void Spinner::ValueChanged(int32 value) void Spinner::ValueChanged(int32 value)
{ {
} }
void Spinner::MessageReceived(BMessage *msg) void Spinner::MessageReceived(BMessage *msg)
{ {
if(msg->what==M_TEXT_CHANGED) if(msg->what==M_TEXT_CHANGED)
{ {
BString string(fTextControl->Text()); BString string(fTextControl->Text());
@ -241,6 +258,7 @@ void Spinner::MessageReceived(BMessage *msg)
Invoke(); Invoke();
Draw(Bounds()); Draw(Bounds());
ValueChanged(Value()); ValueChanged(Value());
} }
else else
{ {
@ -252,6 +270,7 @@ void Spinner::MessageReceived(BMessage *msg)
Invoke(); Invoke();
Draw(Bounds()); Draw(Bounds());
ValueChanged(Value()); ValueChanged(Value());
} }
else else
if(newvalue>GetMax() && Value()!=GetMax()) if(newvalue>GetMax() && Value()!=GetMax())
@ -260,17 +279,23 @@ void Spinner::MessageReceived(BMessage *msg)
Invoke(); Invoke();
Draw(Bounds()); Draw(Bounds());
ValueChanged(Value()); ValueChanged(Value());
} }
else else
{ {
char string[100]; char string[100];
sprintf(string,"%ld",Value()); sprintf(string,"%ld",Value());
fTextControl->SetText(string); fTextControl->SetText(string);
} }
} }
} }
else else
BControl::MessageReceived(msg); BControl::MessageReceived(msg);
} }
void Spinner::SetSteps(int32 stepsize) void Spinner::SetSteps(int32 stepsize)

View File

@ -46,7 +46,7 @@ URLView::URLView( BRect frame, const char *name, const char *label,
// Set the default values for the other definable instance variables. // Set the default values for the other definable instance variables.
this->color = blue; this->color = blue;
this->clickColor = red; this->clickColor = dark_green;
this->hoverColor = dark_blue; this->hoverColor = dark_blue;
this->disabledColor = gray; this->disabledColor = gray;
this->hoverEnabled = true; this->hoverEnabled = true;
@ -120,6 +120,7 @@ void URLView::AttachedToWindow() {
void URLView::Draw( BRect updateRect ) { void URLView::Draw( BRect updateRect ) {
BRect rect = Frame(); BRect rect = Frame();
rect.OffsetTo( B_ORIGIN ); rect.OffsetTo( B_ORIGIN );
@ -157,17 +158,27 @@ void URLView::Draw( BRect updateRect ) {
// Note: DrawString() draws the text at one pixel above the pen's // Note: DrawString() draws the text at one pixel above the pen's
// current y coordinate. // current y coordinate.
DrawString( Text() ); DrawString( Text() );
} }
void URLView::MessageReceived( BMessage *message ) { void URLView::MessageReceived( BMessage *message )
{
entry_ref ref;
switch (message->what)
{
case 'DDCP':
{
// Is this a message from Tracker in response to our drag-and-drop? // Is this a message from Tracker in response to our drag-and-drop?
if( message->what == 'DDCP' ) { //if( message->what == 'DDCP' ) {
// Tracker will send back the name and path of the created file. // Tracker will send back the name and path of the created file.
// We need to read this information. // We need to read this information.
entry_ref ref; entry_ref ref;
message->FindRef( "directory", &ref ); message->FindRef( "directory", &ref );
BEntry entry( &ref ); BEntry entry( &ref );
BPath path( &entry ); BPath path( &entry );
BString *fullName = new BString( path.Path() ); BString *fullName = new BString( path.Path() );
@ -183,11 +194,17 @@ void URLView::MessageReceived( BMessage *message ) {
delete fullName; delete fullName;
delete title; delete title;
}
break;
default:
BView::MessageReceived(message);
break;
} }
} }
void URLView::MouseDown( BPoint point ) { void URLView::MouseDown( BPoint point ) {
// If the link isn't enabled, don't do anything. // If the link isn't enabled, don't do anything.
if( !IsEnabled() ) if( !IsEnabled() )
@ -201,8 +218,7 @@ void URLView::MouseDown( BPoint point ) {
// if the user clicks on the link text itself and not just // if the user clicks on the link text itself and not just
// anywhere in the view. // anywhere in the view.
if( GetTextRect().Contains( point ) ) { if( GetTextRect().Contains( point ) ) {
SetHighColor( clickColor ); SetHighColor( clickColor );
Redraw();
// Set the link as selected and track the mouse. // Set the link as selected and track the mouse.
selected = true; selected = true;
@ -223,13 +239,14 @@ void URLView::MouseDown( BPoint point ) {
// Pop up the context menu? // Pop up the context menu?
if( buttons == B_SECONDARY_MOUSE_BUTTON ) inPopup = true; if( buttons == B_SECONDARY_MOUSE_BUTTON ) inPopup = true;
} }
//Redraw();
} }
void URLView::MouseMoved( BPoint point, uint32 transit, void URLView::MouseMoved( BPoint point, uint32 transit,
const BMessage *message ) { const BMessage *message ) {
// If the link isn't enabled, don't do anything. // If the link isn't enabled, don't do anything.
if( !IsEnabled() ) if( !IsEnabled() )
return; return;
@ -242,9 +259,10 @@ void URLView::MouseMoved( BPoint point, uint32 transit,
// Is the user currently dragging the link? (i.e. is a mouse button // Is the user currently dragging the link? (i.e. is a mouse button
// currently down?) // currently down?)
bool alreadyDragging = (buttons != 0); bool alreadyDragging = (buttons != 0);
switch( transit ) { switch( transit ) {
case( B_ENTERED_VIEW ): case( B_ENTERED_VIEW ):
// Should we set the cursor to the link cursor? // Should we set the cursor to the link cursor?
if( GetTextRect().Contains( point ) && !draggedOut ) { if( GetTextRect().Contains( point ) && !draggedOut ) {
if( !alreadyDragging ) be_app->SetCursor( linkCursor ); if( !alreadyDragging ) be_app->SetCursor( linkCursor );
@ -254,13 +272,13 @@ void URLView::MouseMoved( BPoint point, uint32 transit,
// the link. // the link.
if( selected ) { if( selected ) {
SetHighColor( clickColor ); SetHighColor( clickColor );
Redraw(); //Redraw();
} }
// Should we hover-highlight the link? // Should we hover-highlight the link?
else if( hoverEnabled && !alreadyDragging ) { else if( hoverEnabled && !alreadyDragging ) {
if( buttons == 0 ) { if( buttons == 0 ) {
SetHighColor( hoverColor ); SetHighColor( hoverColor );
Redraw(); //Redraw();
hovering = true; hovering = true;
} }
} }
@ -274,11 +292,11 @@ void URLView::MouseMoved( BPoint point, uint32 transit,
if( selected && !draggedOut ) { if( selected && !draggedOut ) {
be_app->SetCursor( B_HAND_CURSOR ); be_app->SetCursor( B_HAND_CURSOR );
SetHighColor( color ); SetHighColor( color );
Redraw(); //Redraw();
// Is the user drag-and-dropping a bookmark or person? // Is the user drag-and-dropping a bookmark or person?
if( draggable ) { if( draggable ) {
draggedOut = true; // = true;
if( IsEmailLink() ) DoPersonDrag(); if( IsEmailLink() ) DoPersonDrag();
else DoBookmarkDrag(); else DoBookmarkDrag();
} }
@ -288,20 +306,23 @@ void URLView::MouseMoved( BPoint point, uint32 transit,
else if( hovering && !alreadyDragging ) { else if( hovering && !alreadyDragging ) {
be_app->SetCursor( B_HAND_CURSOR ); be_app->SetCursor( B_HAND_CURSOR );
SetHighColor( color ); SetHighColor( color );
Redraw(); //Redraw();
hovering = false; hovering = false;
} }
// Change the cursor back to the hand. // Change the cursor back to the hand.
else { else {
be_app->SetCursor( B_HAND_CURSOR ); be_app->SetCursor( B_HAND_CURSOR );
} }
break; break;
case( B_INSIDE_VIEW ): case( B_INSIDE_VIEW ):
// The user could either be moving out of the view or // The user could either be moving out of the view or
// back into it here, so we must handle both cases. // back into it here, so we must handle both cases.
// In the first case, the cursor is now over the link. // In the first case, the cursor is now over the link.
if( GetTextRect().Contains( point ) && !draggedOut ) { if( GetTextRect().Contains( point ) && !draggedOut ) {
// We only want to change the cursor if not dragging. // We only want to change the cursor if not dragging.
if( !alreadyDragging ) be_app->SetCursor( linkCursor ); if( !alreadyDragging ) be_app->SetCursor( linkCursor );
if( selected ) { if( selected ) {
@ -317,7 +338,7 @@ void URLView::MouseMoved( BPoint point, uint32 transit,
if( IsEmailLink() ) DoPersonDrag(); if( IsEmailLink() ) DoPersonDrag();
else DoBookmarkDrag(); else DoBookmarkDrag();
SetHighColor( color ); SetHighColor( color );
Redraw(); //Redraw();
} }
} }
else { else {
@ -326,14 +347,14 @@ void URLView::MouseMoved( BPoint point, uint32 transit,
// has the mouse cursor over it (like a standard // has the mouse cursor over it (like a standard
// button). // button).
SetHighColor( clickColor ); SetHighColor( clickColor );
Redraw(); //Redraw();
} }
} }
// The link isn't currently selected? If hover-highlighting // The link isn't currently selected? If hover-highlighting
// is enabled, highlight the link. // is enabled, highlight the link.
else if( hoverEnabled && !alreadyDragging ) { else if( hoverEnabled && !alreadyDragging ) {
SetHighColor( hoverColor ); SetHighColor( hoverColor );
Redraw(); //Redraw();
hovering = true; hovering = true;
} }
} }
@ -343,7 +364,7 @@ void URLView::MouseMoved( BPoint point, uint32 transit,
be_app->SetCursor( B_HAND_CURSOR ); be_app->SetCursor( B_HAND_CURSOR );
if( selected ) { if( selected ) {
SetHighColor( color ); SetHighColor( color );
Redraw();
// Is the user dragging the link? // Is the user dragging the link?
if( draggable ) { if( draggable ) {
@ -355,9 +376,10 @@ void URLView::MouseMoved( BPoint point, uint32 transit,
// Is the mouse cursor hovering over the link? // Is the mouse cursor hovering over the link?
else if( hovering ) { else if( hovering ) {
SetHighColor( color ); SetHighColor( color );
Redraw(); //Redraw();
hovering = false; hovering = false;
} }
} }
break; break;
} }
@ -396,7 +418,7 @@ void URLView::MouseUp( BPoint point ) {
// If not, restore the normal link color. // If not, restore the normal link color.
else { else {
SetHighColor( color ); SetHighColor( color );
Redraw();
} }
} }
@ -416,8 +438,11 @@ void URLView::MouseUp( BPoint point ) {
!inPopup && hoverEnabled ) { !inPopup && hoverEnabled ) {
SetHighColor( hoverColor ); SetHighColor( hoverColor );
} }
else if( !hovering ) SetHighColor( color ); else if( !hovering )
Redraw(); {
SetHighColor( color );
}
} }
@ -429,7 +454,7 @@ void URLView::WindowActivated( bool active ) {
if( !active ) { if( !active ) {
if( IsEnabled() ) { if( IsEnabled() ) {
SetHighColor( color ); SetHighColor( color );
Redraw(); //Redraw();
} }
} }
} }
@ -681,7 +706,7 @@ BPopUpMenu * URLView::CreatePopupMenu() {
returnMe->SetAsyncAutoDestruct( true ); returnMe->SetAsyncAutoDestruct( true );
entry_ref app; entry_ref app;
// Set the text of the first item according to the link type. // Set the text of the first item according to the link type.
if( IsEmailLink() ) { if( IsEmailLink() ) {
// Find the name of the default e-mail client. // Find the name of the default e-mail client.
@ -950,9 +975,8 @@ BString URLView::GetImportantURL() {
return returnMe; return returnMe;
} }
BRect URLView::GetTextRect() { BRect URLView::GetTextRect() {
// This function will return a BRect that contains only the text // This function will return a BRect that contains only the text
// and the underline, so the mouse can change and the link will // and the underline, so the mouse can change and the link will
// be activated only when the mouse is over the text itself, not // be activated only when the mouse is over the text itself, not
@ -1007,6 +1031,7 @@ BRect URLView::GetTextRect() {
BRect URLView::GetURLRect() { BRect URLView::GetURLRect() {
//Redraw();
// This function will return a BRect that contains only the URL // This function will return a BRect that contains only the URL
// and the underline, so we can draw it when the user drags. // and the underline, so we can draw it when the user drags.
// We'll use GetFontHeight() instead of bounding boxes here // We'll use GetFontHeight() instead of bounding boxes here
@ -1055,8 +1080,6 @@ bool URLView::IsHTMLLink() {
(url->FindFirst( "https://" ) == 0 ) ); (url->FindFirst( "https://" ) == 0 ) );
} }
void URLView::LaunchURL() { void URLView::LaunchURL() {
// Is the URL a mail link or HTTP? // Is the URL a mail link or HTTP?
if( IsEmailLink() ) { if( IsEmailLink() ) {
@ -1108,16 +1131,13 @@ void URLView::LaunchURL() {
// We don't know how to handle anything else. // We don't know how to handle anything else.
} }
void URLView::Redraw() { void URLView::Redraw() {
// Redraw the link without flicker. // Redraw the link without flicker.
BRect frame = Frame(); BRect frame = Frame();
frame.OffsetTo( B_ORIGIN ); frame.OffsetTo(0,0 );
Draw( frame ); Draw( frame );
} }
void URLView::WriteAttributes( int fd ) { void URLView::WriteAttributes( int fd ) {
// Write the developer-defined attributes to the newly-created file. // Write the developer-defined attributes to the newly-created file.
KeyPair *item; KeyPair *item;

View File

@ -52,7 +52,7 @@ const uint8 url_cursor[] = { 16, 1, 1, 2,
// The default link color, blue. // The default link color, blue.
const rgb_color blue = { 0, 0, 255 }; const rgb_color blue = { 0, 0, 255 };
// The default clicked-link color, red. // The default clicked-link color, red.
const rgb_color red = { 255, 0, 0 }; const rgb_color dark_green = { 107, 142, 035 };
// The default link hover color, dark blue. // The default link hover color, dark blue.
const rgb_color dark_blue = { 0, 0, 120 }; const rgb_color dark_blue = { 0, 0, 120 };
// The default disabled color, gray. // The default disabled color, gray.
@ -92,7 +92,16 @@ class URLView : public BStringView {
virtual void SetIconSize( icon_size iconSize ); virtual void SetIconSize( icon_size iconSize );
virtual void SetUnderlineThickness( int thickness ); virtual void SetUnderlineThickness( int thickness );
virtual void SetURL( const char *url ); virtual void SetURL( const char *url );
//virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
// virtual void MouseUp(BPoint point);
// virtual void MouseDown(BPoint point);
int mouseStateInfo;
int mouseMovedInfo;
int mouseX;
int mouseY;
uint mouseLButton;
uint mouseMButton;
uint mouseRButton;
private: private:
void CopyToClipboard(); void CopyToClipboard();
@ -130,6 +139,8 @@ class URLView : public BStringView {
BPoint dragOffset; BPoint dragOffset;
BList *attributes; BList *attributes;
int prevMouseStateInfo;
typedef struct kp { typedef struct kp {
BString *key; BString *key;
BString *value; BString *value;

View File

@ -12,6 +12,7 @@
#include <Clipboard.h> #include <Clipboard.h>
#include <ColorControl.h> #include <ColorControl.h>
#include <Deskbar.h> #include <Deskbar.h>
#include <Entry.h>
#include <File.h> #include <File.h>
#include <FindDirectory.h> #include <FindDirectory.h>
#include <Font.h> #include <Font.h>
@ -28,7 +29,6 @@
#include <Path.h> #include <Path.h>
#include <Picture.h> #include <Picture.h>
#include <PictureButton.h> #include <PictureButton.h>
#include <PlaySound.h>
#include <PopUpMenu.h> #include <PopUpMenu.h>
#include <PrintJob.h> #include <PrintJob.h>
#include <PropertyInfo.h> #include <PropertyInfo.h>
@ -40,6 +40,18 @@
#include <Slider.h> #include <Slider.h>
#include <StatusBar.h> #include <StatusBar.h>
#include <String.h> #include <String.h>
//#include <PlaySound.h>
//#include <FileGameSound.h>
//#include "GameSoundDevice.h"
#include <Sound.h>
#include <SoundPlayer.h>
#include <Url.h>
#include <MediaPlay.h>
#include <MediaFile.h>
#include <MediaTrack.h>
//#include <MediaFiles.h>
#include <scheduler.h>
#include <interface/StringView.h> #include <interface/StringView.h>
#include <kernel/fs_attr.h> #include <kernel/fs_attr.h>
#include <TextControl.h> #include <TextControl.h>
@ -56,7 +68,7 @@
#include "URLView.h" #include "URLView.h"
#include "Spinner.h" #include "Spinner.h"
#include "YabTabView.h" #include "YabTabView.h"
#include "TabView.h"
#ifdef LIBBSVG #ifdef LIBBSVG
#include <SVGView.h> #include <SVGView.h>
#endif #endif
@ -78,6 +90,11 @@
#include "column/ColumnListView.h" #include "column/ColumnListView.h"
BMediaTrack* playTrack;
media_format playFormat;
BSoundPlayer* player = 0;
const uint32 YABBUTTON = 'YBbu'; const uint32 YABBUTTON = 'YBbu';
const uint32 YABMENU = 'YBme'; const uint32 YABMENU = 'YBme';
const uint32 YABSUBMENU = 'YBsu'; const uint32 YABSUBMENU = 'YBsu';
@ -94,7 +111,6 @@ const uint32 YABTREEBOXINVOKE = 'YBti';
const uint32 YABFILEBOXSELECT = 'YBfs'; const uint32 YABFILEBOXSELECT = 'YBfs';
const uint32 YABFILEBOXINVOKE = 'YBfi'; const uint32 YABFILEBOXINVOKE = 'YBfi';
const uint32 YABSHORTCUT = 'YBsh'; const uint32 YABSHORTCUT = 'YBsh';
const uint32 TYPE_YABVIEW = 1; const uint32 TYPE_YABVIEW = 1;
char * refsRec=(char*)""; char * refsRec=(char*)"";
@ -113,7 +129,6 @@ const char* _L(const char* text)
return yabCatalog->GetString(text, NULL); //B_TRANSLATE_CONTEXT); return yabCatalog->GetString(text, NULL); //B_TRANSLATE_CONTEXT);
return text; return text;
} }
/** /**
* Start the interpreter thread * Start the interpreter thread
*/ */
@ -207,6 +222,7 @@ YabInterface::~YabInterface()
delete viewList; delete viewList;
// delete Roster; // delete Roster;
delete myProps; delete myProps;
delete fPlayer;
if(yabCatalog) if(yabCatalog)
delete yabCatalog; delete yabCatalog;
while(yabbitmaps->CountItems()>0) while(yabbitmaps->CountItems()>0)
@ -605,9 +621,10 @@ void YabInterface::Tab(BRect frame, const char* id, const char* mode, const char
myTabView->SetTabSide(side); myTabView->SetTabSide(side);
myTabView->SetTabWidth(B_WIDTH_FROM_LABEL); myTabView->SetTabWidth(B_WIDTH_FROM_LABEL);
//myTabView->SetTabWidth(B_WIDTH_AS_USUAL);
myView->AddChild(myTabView); myView->AddChild(myTabView);
w->Unlock(); w->Unlock();
} }
else else
@ -620,8 +637,49 @@ void YabInterface::Tab(BRect frame, const char* id, const char* mode, const char
void YabInterface::TabAdd(const char* id, const char* tabname) void YabInterface::TabAdd(const char* id, const char* tabname)
{ {
YabView *myView = NULL; YabView *myView = NULL;
YabTabView *myTabView = NULL; YabTabView *myTabView = NULL;
for(int i=0; i<viewList->CountItems(); i++)
{
myView = cast_as((BView*)viewList->ItemAt(i), YabView);
if(myView)
{
//viewList->PrintOut();
//fprintf(stderr, "Viewlist %d\n",viewList->ItemAt(i));
YabWindow *w = cast_as(myView->Window(), YabWindow);
if(w)
{
w->Lock();
myTabView = cast_as(myView->FindView(id), YabTabView);
//myTabView->FindTabName(tabname);
if(myTabView)
{
BString t(id);
t << myTabView->CountTabs()+1;
BRect contentFrame = myTabView->Bounds();
YabView *newView = new YabView(contentFrame, t.String(), B_FOLLOW_ALL_SIDES,B_WILL_DRAW|B_NAVIGABLE_JUMP);
viewList->AddView(t.String(), newView, TYPE_YABVIEW);
myTabView->AddTab(newView, tabname);
w->Unlock();
return;
}
w->Unlock();
}
}
}
Error(id, "TABVIEW");
}
void YabInterface::TabDel(const char* id, int num) //Reactivating Lorenz Glaser (aka lorglas) 20200801
{
YabView *myView = NULL;
YabTabView *myTabView=NULL;
for(int i=0; i<viewList->CountItems(); i++) for(int i=0; i<viewList->CountItems(); i++)
{ {
myView = cast_as((BView*)viewList->ItemAt(i), YabView); myView = cast_as((BView*)viewList->ItemAt(i), YabView);
@ -633,29 +691,45 @@ void YabInterface::TabAdd(const char* id, const char* tabname)
w->Lock(); w->Lock();
myTabView = cast_as(myView->FindView(id), YabTabView); myTabView = cast_as(myView->FindView(id), YabTabView);
if(myTabView) if(myTabView)
{ {
BString t(id); if(num>=0 && num<=myTabView->CountTabs() && num != myTabView->Selection())
t << myTabView->CountTabs()+1; {
if (num<=0) {
BRect contentFrame = myTabView->Bounds(); num=1; //If you deleted Tab Zero you must reselect Tab Zero
}
YabView *newView = new YabView(contentFrame, t.String(), B_FOLLOW_ALL_SIDES,B_WILL_DRAW|B_NAVIGABLE_JUMP);
viewList->AddView(t.String(), newView, TYPE_YABVIEW); myTabView->Select(num-1); //Selection of tab before
YabTabView* tabView = static_cast<YabTabView*>(myTabView);
myTabView->AddTab(newView, tabname); YabView *t = static_cast<YabView*>(tabView->TabAt(num)->View());
RemoveView(t);
//viewList->DelView(t->NameForTabView());
myTabView->RemoveTab(num); //Remove Tab
//viewList->PrintOut();
}
w->Unlock(); w->Unlock();
return; //viewList->PrintOut();
return ;
} }
w->Unlock(); //w->Unlock();
} }
} }
} }
Error(id, "TABVIEW"); Error(id, "TABVIEW");
} }
/*
void YabInterface::TabADD2(const char* id, int num) //Reactivating Lorenz Glaser (aka lorglas) 20200801
{
myTabView->AddTab(id, tabname);
myTabView->AddTab(num);
}
Error(id, "TABVIEW");
}
/*
void YabInterface::TabDel(const char* id, int num) void YabInterface::TabDel(const char* id, int num)
{ {
/*
YabView *myView = NULL; YabView *myView = NULL;
#ifdef BUILD_HAIKUTAB #ifdef BUILD_HAIKUTAB
YabTabView *myTabView = NULL; YabTabView *myTabView = NULL;
@ -669,6 +743,7 @@ void YabInterface::TabDel(const char* id, int num)
if(myView) if(myView)
{ {
YabWindow *w = cast_as(myView->Window(), YabWindow); YabWindow *w = cast_as(myView->Window(), YabWindow);
if(w) if(w)
{ {
w->Lock(); w->Lock();
@ -734,19 +809,32 @@ void YabInterface::TabDel(const char* id, int num)
BBox *box = cast_as(myView->Parent(), BBox); BBox *box = cast_as(myView->Parent(), BBox);
myView->RemoveSelf(); myView->RemoveSelf();
delete myView; delete myView;
viewList->DelView(window); //viewList->DelView(w);
//viewList->DelView(window);
//viewList->DelView(id);
viewList->PrintOut();
if(box) if(box)
{ {
box->RemoveSelf(); box->RemoveSelf();
delete box; delete box;
} }
viewList->PrintOut();
#ifdef BUILD_HAIKUTAB #ifdef BUILD_HAIKUTAB
WindowClear(myTabView->ItemAt(num-1)->Name()); WindowClear(myTabView->ItemAt(num-1)->Name());
RemoveView(myTabView->ItemAt(num-1)); RemoveView(myTabView->ItemAt(num-1));
//#endif
#else #else
WindowClear((myTabView->TabAt(num-1)).GetTargetView().Name());
//WindowClear((myTabView->Selection()));
//WindowClear(myTabView->TabAt(num-1)->Name());
//WindowClear(myTabView->ItemAt(num-1)->Name());
//RemoveView(myTabView->ItemAt(num-1));
#endif #endif
myTabView->RemoveTab(num-1); myTabView->RemoveTab(num);
w->Unlock(); w->Unlock();
return; return;
} }
@ -755,13 +843,7 @@ void YabInterface::TabDel(const char* id, int num)
} }
} }
Error(id, "TABVIEW"); Error(id, "TABVIEW");
*/ }*/
}
void YabInterface::TabSet(const char* id, int num) void YabInterface::TabSet(const char* id, int num)
{ {
@ -1239,6 +1321,7 @@ void YabInterface::StatusBarSet(const char* id, int r, int g, int b)
{ {
YabView *myView = NULL; YabView *myView = NULL;
BStatusBar *myBar = NULL; BStatusBar *myBar = NULL;
for(int i=0; i<viewList->CountItems(); i++) for(int i=0; i<viewList->CountItems(); i++)
{ {
myView = cast_as((BView*)viewList->ItemAt(i), YabView); myView = cast_as((BView*)viewList->ItemAt(i), YabView);
@ -1321,7 +1404,9 @@ void YabInterface::CreateMenu(const char* menuhead, const char* menuitem, const
void YabInterface::CreateTextControl(BRect frame, const char* id, const char* label, const char* text, const char* window) void YabInterface::CreateTextControl(BRect frame, const char* id, const char* label, const char* text, const char* window)
{ {
YabView *myView = cast_as((BView*)viewList->GetView(window), YabView); YabView *myView = cast_as((BView*)viewList->GetView(window), YabView);
//viewList->PrintOut();
if(myView) if(myView)
{ {
YabWindow *w = cast_as(myView->Window(), YabWindow); YabWindow *w = cast_as(myView->Window(), YabWindow);
@ -1329,8 +1414,15 @@ void YabInterface::CreateTextControl(BRect frame, const char* id, const char* la
{ {
w->Lock(); w->Lock();
BTextControl *textControl = new BTextControl(frame, id ,label, text, new BMessage(YABTEXTCONTROL)); BTextControl *textControl = new BTextControl(frame, id ,label, text, new BMessage(YABTEXTCONTROL));
textControl->SetDivider(textControl->StringWidth(label)+5.0); //If the label is not set, a space of 5 pixels was still reserved to the left of the field. This place is now fully used
if (strcmp(label, "") == 0) //check if Label was set
{
textControl->SetDivider(textControl->StringWidth(label)); //+5.0);
}
else if (strcmp(label,"") != 0)
{
textControl->SetDivider(textControl->StringWidth(label)+5.0);
}
if(w) if(w)
{ {
if(w->layout == -1) if(w->layout == -1)
@ -1464,7 +1556,17 @@ void YabInterface::CreateDropBox(BRect frame, const char* title, const char* lab
w->Lock(); w->Lock();
BPopUpMenu *dropmenu = new BPopUpMenu(""); BPopUpMenu *dropmenu = new BPopUpMenu("");
BMenuField *drop = new BMenuField(frame,title,label, dropmenu, true); BMenuField *drop = new BMenuField(frame,title,label, dropmenu, true);
drop->SetDivider(drop->StringWidth(label)+5.0); drop->ResizeToPreferred();
//If the label is not set, a space of 5 pixels was still reserved to the left of the field. This place is now fully used
if (strcmp(label, "") == 0) //check if label was set
{
drop->SetDivider(drop->StringWidth(label));
}
else if (strcmp(label,"") != 0)
{
drop->SetDivider(drop->StringWidth(label)+5.0);
}
//drop->SetDivider(drop->StringWidth(label)+5.0);
if(w->layout == -1) if(w->layout == -1)
drop->SetResizingMode(B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM); drop->SetResizingMode(B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM);
else else
@ -2745,6 +2847,7 @@ void YabInterface::TextControl(const char* id, int mode)
for(int i=0; i<viewList->CountItems(); i++) for(int i=0; i<viewList->CountItems(); i++)
{ {
myView = cast_as((BView*)viewList->ItemAt(i), YabView); myView = cast_as((BView*)viewList->ItemAt(i), YabView);
if(myView) if(myView)
{ {
YabWindow *w = cast_as(myView->Window(), YabWindow); YabWindow *w = cast_as(myView->Window(), YabWindow);
@ -2789,11 +2892,13 @@ void YabInterface::TextControl(const char* id, const char* option, const char* v
if(myView) if(myView)
{ {
YabWindow *w = cast_as(myView->Window(), YabWindow); YabWindow *w = cast_as(myView->Window(), YabWindow);
if(w) if(w)
{ {
w->Lock(); w->Lock();
int32 x=0; int32 x=0;
myTControl = cast_as(myView->FindView(id), BTextControl); myTControl = cast_as(myView->FindView(id), BTextControl);
if(myTControl) if(myTControl)
{ {
@ -2826,17 +2931,28 @@ void YabInterface::TextControl(const char* id, const char* option, const char* v
{ {
if(tmpValue.IFindFirst("number")!=B_ERROR) if(tmpValue.IFindFirst("number")!=B_ERROR)
{ {
for (x=0;x<48; x++)
{ //Changing from for to String Method because it was possible to enter äöü and so on
//20.02.2019 Lorent Glaser
/*for (x=0;x<48; x++)
{
myTView->DisallowChar(x); myTView->DisallowChar(x);
} }
for (x=58;x<128; x++) for (x=58;x<128; x++)
{ {
myTView->DisallowChar(x); myTView->DisallowChar(x);
} }
x=46; x=46;
myTView-> AllowChar(x); myTView-> AllowChar(x);*/
BString string("QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,/qwertyuiop{}| "
"asdfghjkl:\"zxcvbnm<>?!@#$%^&*()-_=+`´°~\röäüÖÄÜß");
for(int32 i=0; i<string.CountChars(); i++)
{
char c=string.ByteAt(i);
myTView->DisallowChar(c);
}
} }
if(tmpValue.IFindFirst("alphanumeric")!=B_ERROR) if(tmpValue.IFindFirst("alphanumeric")!=B_ERROR)
{ {
for (x=0;x<128; x++) for (x=0;x<128; x++)
@ -3626,8 +3742,9 @@ void YabInterface::TextSet(const char* title, const char* option)
myText->SelectAll(); myText->SelectAll();
else if(tmp.IFindFirst("Undo")!=B_ERROR) else if(tmp.IFindFirst("Undo")!=B_ERROR)
myText->Undo(be_clipboard); myText->Undo(be_clipboard);
// else if(tmp.IFindFirst("Redo")!=B_ERROR) else if(tmp.IFindFirst("Redo")!=B_ERROR)
// ; // myText->Redo(be_clipboard); // myText->Redo(be_clipboard);
;
else else
ErrorGen("Unknown option"); ErrorGen("Unknown option");
w->Unlock(); w->Unlock();
@ -5232,16 +5349,70 @@ void YabInterface::ToolTips(const char* view, const char* text)
Error(view, "VIEW"); Error(view, "VIEW");
} }
void YabInterface::ToolTipsNew(const char* view, const char* text, const char* color, int r, int g, int b)
{
printf("View %s",view);
printf("View %s",text);
printf("View %s",color);
printf("View %d",r);
printf("View %d",g);
printf("View %d",b);
//SetViewColor(b1);
//SetLowColor(b1);
//SetHighColor(b2);
YabView *myView = NULL;
BView *theView = NULL;
for(int i=0; i<viewList->CountItems(); i++)
{
myView = cast_as((BView*)viewList->ItemAt(i), YabView);
if(myView)
{
YabWindow *w = cast_as(myView->Window(), YabWindow);
if(w)
{
w->Lock();
theView = w->FindView(view);
if(theView)
{
if(theView->Name())
{
if(!strcmp(theView->Name(), view))
{
if(text[0] == '\0')
// tooltip->SetHelp(theView, NULL);
;
else
theView->SetLowColor(r,g,b,255);
theView->SetToolTip(text);
w->Unlock();
return;
}
}
}
w->Unlock();
}
}
}
Error(view, "VIEW");
}
void YabInterface::ToolTipsColor(const char* color, int r, int g, int b) void YabInterface::ToolTipsColor(const char* color, int r, int g, int b)
{ {
/* /*
BString tmp(color); BString tmp(color);
rgb_color rgb = {r,g,b}; rgb_color rgb = {r,g,b};
if(tmp.IFindFirst("BGColor")!=B_ERROR) if(tmp.IFindFirst("BGColor")!=B_ERROR)
tooltip->SetColor(rgb); {
//tooltip->SetColor(rgb);
}
else if(tmp.IFindFirst("TextColor")!=B_ERROR) else if(tmp.IFindFirst("TextColor")!=B_ERROR)
tooltip->SetTextColor(rgb); {
*/ //tooltip->SetTextColor(rgb);
}
*/
} }
void YabInterface::TreeSort(const char* view) void YabInterface::TreeSort(const char* view)
@ -6100,6 +6271,10 @@ int YabInterface::DesktopParam(bool isWidth)
if(isWidth) return t.virtual_width; if(isWidth) return t.virtual_width;
return t.virtual_height; return t.virtual_height;
} }
/*int YabInterface::WorkspaceGet(bool isID)
{
}*/
int YabInterface::WindowGet(const char* view, const char* option) int YabInterface::WindowGet(const char* view, const char* option)
{ {
@ -7137,7 +7312,7 @@ void YabInterface::DrawSet3(const char* option, int transparency)
if(yabAlpha>255) yabAlpha = 255; if(yabAlpha>255) yabAlpha = 255;
} }
} }
//Texturl modified by Lorenz Glaser (aka lorglas) 03.10.2019
void YabInterface::TextURL(double x, double y, const char* id, const char* text, const char* url, const char* view) void YabInterface::TextURL(double x, double y, const char* id, const char* text, const char* url, const char* view)
{ {
YabView *myView = cast_as((BView*)viewList->GetView(view), YabView); YabView *myView = cast_as((BView*)viewList->GetView(view), YabView);
@ -7148,9 +7323,11 @@ void YabInterface::TextURL(double x, double y, const char* id, const char* text,
{ {
w->Lock(); w->Lock();
double h,b; double h,b;
b = be_plain_font->StringWidth(text)+1; b = be_plain_font->StringWidth(text)+1;
h = be_plain_font->Size() + 1; h = be_plain_font->Size();
URLView *s = new URLView(BRect(x,y,x+b,y+h), id, text, url);
URLView *s = new URLView(BRect(x,y,x+b,y+h+3), id, text, url); //Correction of Height +3 added,because text wasn't fully displayed. Lorglas
s->SetHoverEnabled(true); s->SetHoverEnabled(true);
if(w->layout == -1) if(w->layout == -1)
s->SetResizingMode(B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM); s->SetResizingMode(B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM);
@ -7607,7 +7784,7 @@ void YabInterface::SpinControl(double x, double y, const char* id, const char* l
if(w) if(w)
{ {
w->Lock(); w->Lock();
Spinner *mySpin = new Spinner(BRect(x,y,x+10,y+10), id, label, min, max, step, NULL); Spinner *mySpin = new Spinner(BRect(x,y,x+10,y+10), id, label, min, max, step, NULL);
if(w->layout == -1) if(w->layout == -1)
mySpin->SetResizingMode(B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM); mySpin->SetResizingMode(B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM);
else else
@ -8265,10 +8442,12 @@ void YabInterface::BitmapDraw(double x, double y, const char* bitmap, const char
if(w) if(w)
{ {
BBitmap *newb = new BBitmap(b->Bounds(), B_RGBA32); BBitmap *newb = new BBitmap(b->Bounds(), B_RGBA32);
char* newbits = (char*)newb->Bits(); char* newbits = (char*)newb->Bits();
char* oldbits = (char*)b->Bits(); char* oldbits = (char*)b->Bits();
for(int j=0; j<b->BitsLength(); j++) for(int j=0; j<b->BitsLength(); j++)
newbits[j] = oldbits[j]; newbits[j] = oldbits[j];
w->Lock(); w->Lock();
YabDrawing *t = new YabDrawing(); YabDrawing *t = new YabDrawing();
t->command = 10; t->command = 10;
@ -8277,7 +8456,7 @@ void YabInterface::BitmapDraw(double x, double y, const char* bitmap, const char
myView->drawList->AddItem(t); myView->drawList->AddItem(t);
myView->Invalidate(); myView->Invalidate();
w->Unlock(); w->Unlock();
return; return;
} }
else else
ErrorGen("Unable to lock window"); ErrorGen("Unable to lock window");
@ -8458,25 +8637,25 @@ void YabInterface::BitmapDraw(BRect frame, const char* bitmap, const char* mode,
} }
Error(bitmap, "BITMAP"); Error(bitmap, "BITMAP");
} }
//Correction added of Width and Height and transparency Pixel of the right and bottom side
void YabInterface::BitmapGet(BRect frame, const char* id, const char* bitmap) void YabInterface::BitmapGet(BRect frame, const char* id, const char* bitmap)
{ {
for(int i=0; i<yabbitmaps->CountItems(); i++) for(int i=0; i<yabbitmaps->CountItems(); i++)
{ {
BBitmap *b = (BBitmap*)yabbitmaps->ItemAt(i); BBitmap *b = (BBitmap*)yabbitmaps->ItemAt(i);
BView *bview = b->FindView(bitmap); BView *bview = b->FindView(bitmap);
if(bview) if(bview)
{ {
char *oldbits, *newbits; char *oldbits, *newbits;
BBitmap *newbmp = new BBitmap(BRect(0,0, frame.Width(), frame.Height()), B_RGBA32, true); BBitmap *newbmp = new BBitmap(BRect(0,0, frame.Width()-1, frame.Height()-1), B_RGBA32, true); //-1 Added, because correction of right and height limit
BView *newbview = new BView(BRect(0,0, frame.Width(), frame.Height()), id, B_FOLLOW_NONE, 0); BView *newbview = new BView(BRect(0,0, frame.Width()-1, frame.Height()-1), id, B_FOLLOW_NONE, 0);//-1 Added, because correction of right and height limit
newbmp->AddChild(newbview); newbmp->AddChild(newbview);
newbits = (char*)newbmp->Bits(); newbits = (char*)newbmp->Bits();
for(int i=0; i<frame.Width()*frame.Height()*4; i = i + 4) for(int i=0; i<(frame.Width()-1)*(frame.Height()-1)*4; i = i + 4) //-1 Added, because correction of right and height limit
{ {
newbits[i] = newbits[i+1] = newbits[i+2] = 255; newbits[i] = newbits[i+1] = newbits[i+2] = 255;
newbits[i+3] = 0; newbits[i+3] = 0;
@ -8485,12 +8664,12 @@ void YabInterface::BitmapGet(BRect frame, const char* id, const char* bitmap)
b->Lock(); b->Lock();
BRect tframe = bview->Bounds(); BRect tframe = bview->Bounds();
b->Unlock(); b->Unlock();
if(frame.top>tframe.bottom || frame.left>tframe.right || frame.bottom>tframe.bottom || frame.right>tframe.right || frame.top<0 || frame.left<0 || frame.right<0 || frame.bottom<0) if(frame.top>tframe.bottom || frame.left>tframe.right || (frame.bottom-1)>tframe.bottom || (frame.right-1)>tframe.right || frame.top<0 || frame.left<0 || frame.right<0 || frame.bottom<0)
ErrorGen("Out of bounds"); ErrorGen("Out of bounds");
for(int32 j = 0; j<frame.IntegerHeight(); j++) for(int32 j = 0; j<frame.IntegerHeight(); j++)
for(int32 k = 0; k<frame.IntegerWidth(); k++) for(int32 k = 0; k<frame.IntegerWidth(); k++)
for(int32 l = 0; l<4; l++) for(int32 l = 0; l<4; l++)
newbits[j*newbmp->BytesPerRow()+k*4+l] = oldbits[(int32)((j+frame.top)*b->BytesPerRow()+(k+frame.left)*4+l)]; newbits[j*newbmp->BytesPerRow()+k*4+l] = oldbits[(int32)((j+frame.top)*b->BytesPerRow()+(k+frame.left)*4+l)];
yabbitmaps->AddItem(newbmp); yabbitmaps->AddItem(newbmp);
return; return;
} }
@ -8498,6 +8677,7 @@ void YabInterface::BitmapGet(BRect frame, const char* id, const char* bitmap)
for(int i=0; i<yabcanvas->CountItems(); i++) for(int i=0; i<yabcanvas->CountItems(); i++)
{ {
YabBitmapView *myView = (YabBitmapView*)yabcanvas->ItemAt(i); YabBitmapView *myView = (YabBitmapView*)yabcanvas->ItemAt(i);
if(!strcmp(myView->Name(), bitmap)) if(!strcmp(myView->Name(), bitmap))
{ {
YabWindow *w = cast_as(myView->Window(), YabWindow); YabWindow *w = cast_as(myView->Window(), YabWindow);
@ -8506,18 +8686,19 @@ void YabInterface::BitmapGet(BRect frame, const char* id, const char* bitmap)
w->Lock(); w->Lock();
BBitmap *b = myView->GetBitmap(); BBitmap *b = myView->GetBitmap();
char *oldbits, *newbits; char *oldbits, *newbits;
BBitmap *newbmp = new BBitmap(BRect(0,0, frame.Width(), frame.Height()), B_RGBA32, true); BBitmap *newbmp = new BBitmap(BRect(0,0, frame.Width()-1, frame.Height()-1), B_RGBA32, true);//-1 Added, because correction of right and height limit
BView *newbview = new BView(BRect(0,0, frame.Width(), frame.Height()), id, B_FOLLOW_NONE, 0); BView *newbview = new BView(BRect(0,0, frame.Width()-1, frame.Height()-1), id, B_FOLLOW_NONE, 0);//-1 Added, because correction of right and height limit
newbmp->AddChild(newbview); newbmp->AddChild(newbview);
newbits = (char*)newbmp->Bits(); newbits = (char*)newbmp->Bits();
for(int i=0; i<frame.Width()*frame.Height()*4; i = i + 4)
for(int i=0; i<(frame.Width()-1)*(frame.Height()-1)*4; i = i + 4) //-1 Added, because correction of right and height limit
{ {
newbits[i] = newbits[i+1] = newbits[i+2] = 255; newbits[i] = newbits[i+1] = newbits[i+2] = 255;
newbits[i+3] = 0; newbits[i+3] = 0;
} }
oldbits = (char*)b->Bits(); oldbits = (char*)b->Bits();
BRect tframe = myView->Bounds(); BRect tframe = myView->Bounds();
if(frame.top>tframe.bottom || frame.left>tframe.right || frame.bottom>tframe.bottom || frame.right>tframe.right || frame.top<0 || frame.left<0 || frame.right<0 || frame.bottom<0) if(frame.top>tframe.bottom || frame.left>tframe.right || (frame.bottom-1)>tframe.bottom || (frame.right-1)>tframe.right || frame.top<0 || frame.left<0 || frame.right<0 || frame.bottom<0)
ErrorGen("Out of bounds"); ErrorGen("Out of bounds");
for(int32 j = 0; j<frame.IntegerHeight(); j++) for(int32 j = 0; j<frame.IntegerHeight(); j++)
for(int32 k = 0; k<frame.IntegerWidth(); k++) for(int32 k = 0; k<frame.IntegerWidth(); k++)
@ -8540,14 +8721,17 @@ void YabInterface::BitmapGet(double w, const char* id, const char* path)
BBitmap *fBitmap = new BBitmap(iFrame, B_RGBA32, true); BBitmap *fBitmap = new BBitmap(iFrame, B_RGBA32, true);
BView *bview = new BView(iFrame, id, B_FOLLOW_NONE, 0); BView *bview = new BView(iFrame, id, B_FOLLOW_NONE, 0);
fBitmap->AddChild(bview); fBitmap->AddChild(bview);
//memset(fBitmap->Bits(), 0, fBitmap->BitsLength());
char *b; char *b;
b = (char*)fBitmap->Bits(); b = (char*)fBitmap->Bits();
for(int i=0; i<w*h*4; i = i + 4) for(int i=0; i<w*h*4; i = i + 4)
{ {
b[i] = b[i+1] = b[i+2] = 255; b[i] = b[i+1] = b[i+2] = 255;
b[i+3] = 0; b[i+3] = 0;
} }
BNode *fNode = new BNode(path); BNode *fNode = new BNode(path);
BNodeInfo fInfo(fNode); BNodeInfo fInfo(fNode);
@ -8583,6 +8767,7 @@ void YabInterface::BitmapGetIcon(const char* id, const char* option, const char*
fBitmap->AddChild(bview); fBitmap->AddChild(bview);
char *b; char *b;
//memset(fBitmap->Bits(), 0, fBitmap->BitsLength());
b = (char*)fBitmap->Bits(); b = (char*)fBitmap->Bits();
for(int i=0; i<w*h*4; i = i + 4) for(int i=0; i<w*h*4; i = i + 4)
{ {
@ -8621,6 +8806,7 @@ void YabInterface::BitmapGetIcon(const char* id, const char* option, const char*
fBitmap->AddChild(bview); fBitmap->AddChild(bview);
char *b; char *b;
memset(fBitmap->Bits(), 0, fBitmap->BitsLength());
b = (char*)fBitmap->Bits(); b = (char*)fBitmap->Bits();
for(int i=0; i<w*h*4; i = i + 4) for(int i=0; i<w*h*4; i = i + 4)
{ {
@ -8674,7 +8860,7 @@ void YabInterface::Screenshot(BRect frame, const char* bitmap)
BView *bview = new BView(area, bitmap, B_FOLLOW_NONE, 0); BView *bview = new BView(area, bitmap, B_FOLLOW_NONE, 0);
BScreen screen(B_MAIN_SCREEN_ID); BScreen screen(B_MAIN_SCREEN_ID);
fBitmap->AddChild(bview); fBitmap->AddChild(bview);
//memset(fBitmap->Bits(), 0, fBitmap->BitsLength());
t = (char*)fBitmap->Bits(); t = (char*)fBitmap->Bits();
for(int i=0; i<w*h*4; i = i + 4) for(int i=0; i<w*h*4; i = i + 4)
{ {
@ -8770,9 +8956,9 @@ int YabInterface::BitmapGet(const char* id, const char* option)
{ {
BRect r = b->Bounds(); BRect r = b->Bounds();
if(isWidth) if(isWidth)
return r.IntegerWidth()+1; return r.IntegerWidth(); //+1;
else else
return r.IntegerHeight()+1; return r.IntegerHeight(); //+1;
} }
} }
Error(id, "BITMAP"); Error(id, "BITMAP");
@ -8838,29 +9024,124 @@ void YabInterface::Canvas(BRect frame, const char* id, const char* view)
} }
Error(view, "VIEW"); Error(view, "VIEW");
} }
int YabInterface::Sound(const char* filename) //Reactivate Sound Lorglas 2020.01.02
int YabInterface::Sound(const char* filename)
{ {
int soundplayer;
entry_ref ref; entry_ref ref;
BEntry entry(filename, true); BEntry entry(filename, true);
//printf("file '%s' \n", &filename); //Check, if filename is ok
if (entry.InitCheck() == B_OK) if (entry.InitCheck() == B_OK)
if (entry.GetRef(&ref) == B_OK) if (entry.GetRef(&ref) == B_OK)
return play_sound(&ref, true, false, true); //delete playing fplayer, because we get no ID back from fplayer. So if we didn't deleting fplayer, a second sound will be played and the first one can't be stopped
return -1; delete fPlayer;
fPlayer = new BFileGameSound(&ref, false);
fPlayer->StartPlaying();
soundplayer=1;
return soundplayer;
} }
void YabInterface::SoundStop(int32 id) int YabInterface::SoundStop(int32 soundplayer) //Reactivate Sound Lorglas 2020.01.02
{ {
stop_sound(id); //Check, if fplayer is NULL, then do nothing
if (fPlayer == NULL) {
}
//Check, if fplayer is Playing, then stop playing and delete fplayer
if (fPlayer->IsPlaying()) {
fPlayer->StopPlaying();
delete fPlayer;
fPlayer = NULL;
soundplayer=0;
//printf("%d\n",finished);
return soundplayer;
}
} }
void YabInterface::SoundWait(int32 id) int YabInterface::SoundWait(int32 soundplayer) //Reactivate Sound Lorglas 2020.01.03
{
//Check, if fplayr is in Paused modus, if so Setpaused to false, so play again, if true fplayer paused
if (fPlayer->IsPaused()) {
fPlayer->SetPaused(false, 2);
}
else {
fPlayer->SetPaused(true, 0);
}
soundplayer=2;
return soundplayer;
}
void play_buffer(void *cookie, void * buffer, size_t size, const media_raw_audio_format & format)
{ {
wait_for_sound(id); int64 frames = 0;
}
playTrack->ReadFrames(buffer, &frames);
if (frames <=0) {
player->SetHasData(false);
}
}
int YabInterface::MediaSound(const char* filename) //Implementation MediaSound Lorglas 2020.01.02 code used and modified from media_client
{
BUrl url;
entry_ref ref;
BMediaFile* playFile;
int finished;
if (get_ref_for_path(filename, &ref) != B_OK)
{
url.SetUrlString(filename);
if (url.IsValid())
{
playFile = new BMediaFile(url);
}
else
{
return 2;
}
}
else
{
playFile = new BMediaFile(&ref);
}
if (playFile->InitCheck() != B_OK)
{
delete playFile;
return 2;
}
for (int i = 0; i < playFile->CountTracks(); i++)
{
BMediaTrack* track = playFile->TrackAt(i);
if (track != NULL)
{
playFormat.type = B_MEDIA_RAW_AUDIO;
if ((track->DecodedFormat(&playFormat) == B_OK) && (playFormat.type == B_MEDIA_RAW_AUDIO))
{
playTrack = track;
break;
}
playFile->ReleaseTrack(track);
}
}
player = new BSoundPlayer(&playFormat.u.raw_audio, "playFile", play_buffer);
player->SetVolume(1.0f);
player->SetHasData(true);
player->Start();
finished=1;
//printf(" %s is playing \n",filename);
return finished;
}
int YabInterface::MediaSoundStop(int32 finished) //New Version Sound Lorglas 2020.01.02
{
//Check, if fplayer is NULL, then do nothing
if (finished==1) {
player->Stop();
delete player;
finished=0;
//printf("%d\n",finished);
return finished;
}
}
void YabInterface::SetOption(const char* id, const char* option, double x, double y) void YabInterface::SetOption(const char* id, const char* option, double x, double y)
{ {
BString tmp(option); BString tmp(option);
@ -9557,6 +9838,7 @@ const char* YabInterface::GetMessageString()
} }
} }
} }
if(tmp.Length()>32766) if(tmp.Length()>32766)
tmp.Remove(32767, tmp.Length()-32766); tmp.Remove(32767, tmp.Length()-32766);
strcpy(messagebuffer, tmp.String()); strcpy(messagebuffer, tmp.String());
@ -10166,6 +10448,11 @@ void yi_ToolTip(const char* view, const char* text, YabInterface *yab)
yab->ToolTips(view,_L(text)); yab->ToolTips(view,_L(text));
} }
void yi_ToolTipNew(const char* view, const char* text,const char* color, int r, int g, int b, YabInterface *yab)
{
yab->ToolTipsNew(view, _L(text), color, r, g, b);
}
void yi_ToolTipColor(const char* color, int r, int g, int b, YabInterface *yab) void yi_ToolTipColor(const char* color, int r, int g, int b, YabInterface *yab)
{ {
yab->ToolTipsColor(color,r,g,b); yab->ToolTipsColor(color,r,g,b);
@ -10667,21 +10954,36 @@ void yi_Canvas(double x1, double y1, double x2, double y2, const char* id, const
yab->Canvas(BRect(x1,y1,x2,y2), id,view); yab->Canvas(BRect(x1,y1,x2,y2), id,view);
} }
int yi_Sound(const char* filename, YabInterface* yab) int yi_Sound(const char* filename, YabInterface* yab) //Reactivate Sound Lorglas 2020.01.02
{ {
return yab->Sound(filename); return yab->Sound(filename);
} }
void yi_SoundStop(int id, YabInterface* yab) int yi_SoundStop(int id, YabInterface* yab) //Reactivate Sound Lorglas 2020.01.02
{ {
yab->SoundStop(id); return yab->SoundStop(id);
} }
void yi_SoundWait(int id, YabInterface* yab) int yi_SoundWait(int id, YabInterface* yab) //Reactivate Sound Lorglas 2020.01.03
{ {
yab->SoundWait(id); return yab->SoundWait(id);
} }
int yi_MediaSound(const char* filename, YabInterface* yab)
{
return yab->MediaSound(filename);
}
int yi_MediaSoundStop(int id,YabInterface* yab)
{
return yab->MediaSoundStop(id);
}
/*
void yi_MediaSoundWait(int id, YabInterface* yab)
{
yab->MediaSoundWait(id);
}
*/
void yi_ShortCut(const char* view, const char* key, const char* msg, YabInterface *yab) void yi_ShortCut(const char* view, const char* key, const char* msg, YabInterface *yab)
{ {
yab->ShortCut(view,key,msg); yab->ShortCut(view,key,msg);

View File

@ -13,7 +13,7 @@
#include "YabList.h" #include "YabList.h"
#include "global.h" #include "global.h"
#include "config.h" #include "config.h"
#include <FileGameSound.h>
class YabInterface : public BApplication class YabInterface : public BApplication
{ {
public: public:
@ -122,6 +122,7 @@
void CheckboxSet(const char* id, int isActivated); void CheckboxSet(const char* id, int isActivated);
void RadioSet(const char* id, int isActivated); void RadioSet(const char* id, int isActivated);
void ToolTips(const char* view, const char* text); void ToolTips(const char* view, const char* text);
void ToolTipsNew(const char* view, const char* text, const char* color, int r, int g, int b);
void ToolTipsColor(const char* color, int r, int g, int b); void ToolTipsColor(const char* color, int r, int g, int b);
void TreeSort(const char* view); void TreeSort(const char* view);
void ListSort(const char* view); void ListSort(const char* view);
@ -215,8 +216,10 @@
int BitmapSave(const char* id, const char* filename, const char* type); int BitmapSave(const char* id, const char* filename, const char* type);
void Canvas(BRect frame, const char* id, const char* view); void Canvas(BRect frame, const char* id, const char* view);
int Sound(const char* filename); int Sound(const char* filename);
void SoundStop(int32 id); int SoundStop(int32 id);
void SoundWait(int32 id); int SoundWait(int32 id);
int MediaSound(const char* filename);
int MediaSoundStop(int32 finished);
int IsComputerOn(); int IsComputerOn();
void ShortCut(const char* view, const char* key, const char* msg); void ShortCut(const char* view, const char* key, const char* msg);
void DrawSet(const char* option, const char* color,const char* view); void DrawSet(const char* option, const char* color,const char* view);
@ -242,8 +245,10 @@
void StatusBarSet(BRect frame, const char* id, const char* view); void StatusBarSet(BRect frame, const char* id, const char* view);
void StatusBarSet(const char* id, int r, int g, int b); void StatusBarSet(const char* id, int r, int g, int b);
void RefsReceived(BMessage *message); void RefsReceived(BMessage *message);
private: private:
BFileGameSound* fPlayer;
int status;
void RemoveView(BView* myView); void RemoveView(BView* myView);
void GetMMsgInfo(BString &t, int mouseStateInfo, int mouseLButton, int mouseMButton, int mouseRButton, int x, int y, const char* name); void GetMMsgInfo(BString &t, int mouseStateInfo, int mouseLButton, int mouseMButton, int mouseRButton, int x, int y, const char* name);
BBitmap* loadImage(const char* name); BBitmap* loadImage(const char* name);
@ -276,6 +281,7 @@
BList *yabbitmaps; BList *yabbitmaps;
BList *yabcanvas; BList *yabcanvas;
BString lastMouseMsg; BString lastMouseMsg;
}; };
#else #else
typedef typedef
@ -389,6 +395,7 @@ extern void yi_CheckboxSet(const char* id, int isActivated, YabInterface* yab);
extern void yi_RadioSet(const char* id, int isActivated, YabInterface* yab); extern void yi_RadioSet(const char* id, int isActivated, YabInterface* yab);
extern const char* yi_TextControlGet(const char* id, YabInterface* yab); extern const char* yi_TextControlGet(const char* id, YabInterface* yab);
extern void yi_ToolTip(const char* view, const char* text, YabInterface *yab); extern void yi_ToolTip(const char* view, const char* text, YabInterface *yab);
extern void yi_ToolTipNew(const char* view, const char* text, const char* color, int r, int g, int b, YabInterface *yab);
extern void yi_ToolTipColor(const char* color, int r, int g, int b, YabInterface *yab); extern void yi_ToolTipColor(const char* color, int r, int g, int b, YabInterface *yab);
extern void yi_TreeSort(const char* view, YabInterface *yab); extern void yi_TreeSort(const char* view, YabInterface *yab);
extern void yi_ListSort(const char* view, YabInterface *yab); extern void yi_ListSort(const char* view, YabInterface *yab);
@ -489,8 +496,10 @@ extern void yi_Screenshot(double x1, double y1, double x2, double y2, const char
extern int yi_BitmapSave(const char* id, const char* filename, const char* type, YabInterface* yab); extern int yi_BitmapSave(const char* id, const char* filename, const char* type, YabInterface* yab);
extern void yi_Canvas(double x1, double y1, double x2, double y2, const char* id, const char* view, YabInterface *yab); extern void yi_Canvas(double x1, double y1, double x2, double y2, const char* id, const char* view, YabInterface *yab);
extern int yi_Sound(const char* filename, YabInterface* yab); extern int yi_Sound(const char* filename, YabInterface* yab);
extern void yi_SoundStop(int id, YabInterface* yab); extern int yi_SoundStop(int id, YabInterface* yab);
extern void yi_SoundWait(int id, YabInterface* yab); extern int yi_SoundWait(int id, YabInterface* yab);
extern int yi_MediaSound(const char* filename, YabInterface* yab);
extern int yi_MediaSoundStop(int id, YabInterface* yab);
extern int yi_IsComputerOn(YabInterface* yab); extern int yi_IsComputerOn(YabInterface* yab);
extern void yi_ShortCut(const char* view, const char* key, const char* msg, YabInterface* yab); extern void yi_ShortCut(const char* view, const char* key, const char* msg, YabInterface* yab);
extern void yi_DrawSet4(const char* option, const char* color,const char* view, YabInterface* yab); extern void yi_DrawSet4(const char* option, const char* color,const char* view, YabInterface* yab);

View File

@ -87,6 +87,6 @@ void YabList::PrintOut()
{ {
printf("\n"); printf("\n");
for(int i=0; i<idList->CountItems(); i++) for(int i=0; i<idList->CountItems(); i++)
printf("\t%s\n", ((BString*)(idList->ItemAt(i)))->String() ); printf("\t View %s and the id %d %d \n", ((BString*)(idList->ItemAt(i)))->String() , idList->ItemAt(i), viewList->ItemAt(i));
printf("\n"); printf("\n");
} }

View File

@ -17,6 +17,7 @@ public:
const int CountItems(); const int CountItems();
const void* ItemAt(int i); const void* ItemAt(int i);
void PrintOut(); void PrintOut();
private: private:
int ViewNum(const char* id); int ViewNum(const char* id);
BList* idList; BList* idList;

View File

@ -35,6 +35,7 @@
#include <stdio.h> #include <stdio.h>
#include "YabTabView.h" #include "YabTabView.h"
YabTabView::YabTabView(BRect frame, const char* name, button_width width, uint32 resizingMode, uint32 flags) YabTabView::YabTabView(BRect frame, const char* name, button_width width, uint32 resizingMode, uint32 flags)
: BTabView(frame, name, width, resizingMode, flags) : BTabView(frame, name, width, resizingMode, flags)
{ {
@ -68,6 +69,7 @@ void YabTabView::AddTab(BView *tabView, const char* label)
tabView->Hide(); tabView->Hide();
fTabNames->AddItem(new BString(label)); fTabNames->AddItem(new BString(label));
} }
} }
@ -111,6 +113,60 @@ void YabTabView::SetFocusTab(int32 tab, bool focused)
BTabView::SetFocusTab(tab, focused); BTabView::SetFocusTab(tab, focused);
} }
void YabTabView::RemovingTab(int32 index)
{
BTabView::RemoveTab(index);
}
/*
void YabTabView::RemovingTab(int32 index, bool focused)
{
int oldindex=index;
int index_a;
int tab;
if (index < 0 || index >= CountTabs())
return NULL;
BTab* tab = (BTab*)fTabNames->RemoveItem(index);
if (tab==NULL)
return NULL;
tab->Deselect();
BTab::Private(tab).SetTabView(Null);
if (fContainerView->GetLayout())
fContainerView->GetLayout()->RemoveItem(index);
if (CountTabs()==0)
fFocus = -1;
else if (index <= fSelection)
Select (fSelection-1);
if (fFocus >=0) {
if(fFocus == CountTabs() -1 || CountTabs() == 0)
BTabView::Select(f.Focus, false);
else
BTabView::Select(f.Focus, true);
}
return tab;
BTabView::RemoveTab(oldindex);
BTabView::Select(1);
BTab* tab = TabAt(index);
if (tab)
{
FocusChanged = index;
}
int32 prevSelected = 1; //Selection();
RemoveChild(tab->View());
tab->View()->Show();
BTabView::Select(index);
if(prevSelected > -1) {
BTab* prevTab = TabAt(prevSelected); //prevSelected);
prevTab->View()->Hide();
AddChild(prevTab->View());
}
}
*/
const char* YabTabView::GetTabName(int32 index) const const char* YabTabView::GetTabName(int32 index) const
{ {
if(index < 0 || index >= CountTabs()) if(index < 0 || index >= CountTabs())
@ -118,3 +174,46 @@ const char* YabTabView::GetTabName(int32 index) const
return ((BString*)fTabNames->ItemAt(index))->String(); return ((BString*)fTabNames->ItemAt(index))->String();
} }
void YabTabView::PrintOut()
{
//printf("\n %d",fTabNames->CountItems());
if (fTabNames->CountItems()==0)
{
}
else if(fTabNames->CountItems()>0)
{
printf("\n");
for(int i=0; i<fTabNames->CountItems(); i++)
printf("\t View %s and the id %d\n", ((BString*)(fTabNames->ItemAt(i)))->String() , fTabNames->ItemAt(i));
printf("\n");
}
}
void YabTabView::FindTabName(const char* tabname )
{
BString test = NULL;
//printf("\n %d",fTabNames->CountItems());
if (fTabNames->CountItems()<=0)
{
//return NULL;
}
else if(fTabNames->CountItems()>0)
{
//printf("%s \n", tabname);
for(int i=0; i<fTabNames->CountItems(); i++)
{
printf("%s\n", ((BString*)(fTabNames->ItemAt(i)))->String());
test=((BString*)(fTabNames->ItemAt(i)))->String();
if (test == tabname)
{
//printf("stimmt");
printf("%s %d",test,i );
printf("\n");
//return tabname;
//return true;
}
}
//printf("\n");
}
}

View File

@ -46,19 +46,27 @@ public:
B_FRAME_EVENTS | B_NAVIGABLE); B_FRAME_EVENTS | B_NAVIGABLE);
~YabTabView(); ~YabTabView();
virtual const char* GetTabName(int32 index) const; virtual const char* GetTabName(int32 index) const;
virtual void AddTab(BView *target, const char* tabname); virtual void AddTab(BView *target, const char* tabname);
virtual void Select(int32 index);
virtual void Select(int32 index); virtual void MakeFocus(bool focused = true);
virtual void MakeFocus(bool focused = true); virtual void RemovingTab(int32 index);
virtual void SetFocusTab(int32 tab, bool focused); virtual void SetFocusTab(int32 tab, bool focused);
void PrintOut();
void FindTabName(const char* tabname);
int32 FocusChanged; int32 FocusChanged;
int32 OldTabView; int32 OldTabView;
//void MoveTab(int32 index, int32 newIndex);
private: private:
BList *fTabNames; BList *fTabNames;
int32 fSelection;
int32 fInitialSelection;
int32 fFocus;
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -36,6 +36,7 @@ const uint32 YABFILEBOXINVOKE = 'YBfi';
const uint32 YABSPINCONTROL = 'YBsp'; const uint32 YABSPINCONTROL = 'YBsp';
const uint32 YABSHORTCUT = 'YBsh'; const uint32 YABSHORTCUT = 'YBsh';
YabWindow::YabWindow(BRect frame, const char* title, const char* id, window_look winlook, window_feel winfeel, uint32 flags) YabWindow::YabWindow(BRect frame, const char* title, const char* id, window_look winlook, window_feel winfeel, uint32 flags)
: BWindow (frame, title, winlook, winfeel, flags) : BWindow (frame, title, winlook, winfeel, flags)
{ {

View File

@ -5,7 +5,7 @@
// #define LIBBSVG // #define LIBBSVG
#define BUILD_TIME __DATE__ #define BUILD_TIME __DATE__
/* Version number of package */ /* Version number of package */
#define VERSION "1.7.6.0" #define VERSION "1.7.8"
/* architecture of build machine */ /* architecture of build machine */
#define UNIX_ARCHITECTURE "BePC-Haiku" #define UNIX_ARCHITECTURE "BePC-Haiku"

View File

@ -1005,6 +1005,11 @@ void function(struct command *current,YabInterface* yab) /* performs a function
value = sound(str, yab, linenum, current->lib->s); value = sound(str, yab, linenum, current->lib->s);
result = stNUMBER; result = stNUMBER;
break; break;
case fMEDIASOUND:
str=a1->pointer;
value = mediasound(str, yab, linenum, current->lib->s);
result = stNUMBER;
break;
case fTREEBOXGETOPT: case fTREEBOXGETOPT:
str=a1->pointer; str=a1->pointer;
str2=a2->pointer; str2=a2->pointer;

View File

@ -1341,7 +1341,24 @@ void tooltip(struct command *cmd, YabInterface *yab)
yi_SetCurrentLineNumber(cmd->line, (const char*)cmd->lib->s, yab); yi_SetCurrentLineNumber(cmd->line, (const char*)cmd->lib->s, yab);
yi_ToolTip(view,text,yab); yi_ToolTip(view,text,yab);
} }
void tooltipnew(struct command *cmd, YabInterface *yab)
{
char *view, *text, *color;
int r,g,b;
b = pop(stNUMBER)->value;
g = pop(stNUMBER)->value;
r = pop(stNUMBER)->value;
color = pop(stSTRING)->pointer;
text = pop(stSTRING)->pointer;
view = pop(stSTRING)->pointer;
yi_SetCurrentLineNumber(cmd->line, (const char*)cmd->lib->s, yab);
yi_ToolTipNew(view,text,color,r,g,b,yab);
}
void tooltipcolor(struct command *cmd, YabInterface *yab) void tooltipcolor(struct command *cmd, YabInterface *yab)
{ {
char *color; char *color;
@ -2431,6 +2448,21 @@ void soundwait(struct command *cmd, YabInterface *yab)
yi_SoundWait(id, yab); yi_SoundWait(id, yab);
} }
int mediasound(const char* filename, YabInterface *yab, int line, const char* libname)
{
yi_SetCurrentLineNumber(line, libname, yab);
return yi_MediaSound(filename, yab);
}
void mediasoundstop(struct command *cmd, YabInterface *yab)
{
int id;
id = pop(stNUMBER)->value;
yi_SetCurrentLineNumber(cmd->line, (const char*)cmd->lib->s, yab);
yi_MediaSoundStop(id, yab);
}
int iscomputeron(YabInterface *yab, int line, const char* libname) int iscomputeron(YabInterface *yab, int line, const char* libname)
{ {
yi_SetCurrentLineNumber(line, libname, yab); yi_SetCurrentLineNumber(line, libname, yab);

BIN
src/libyab1.so Executable file

Binary file not shown.

View File

@ -26,7 +26,7 @@ can be found at www.yabasic.de
/* ------------- defines ---------------- */ /* ------------- defines ---------------- */
#define DONE {current=current->next;break;} /* reduces type-work */ #define DONE {current=current->next;break;} /* reduces type-work */
#define COPYRIGHT " Original yabasic Copyright 1995-2006 by Marc-Oliver Ihm\n\tyab improvements Copyright 2006-2014 by Jan Bungeroth\n\tyab improvements Copyright 2013-2018 by Jim Saxton\n\tyab improvements Copyright 2018 by BeSly Software Solutions (Thanks to Stephan Aßmus for Correction of Code)\n" #define COPYRIGHT " Original yabasic Copyright 1995-2006 by Marc-Oliver Ihm\n\tyab Copyright 2006-2014 by Jan Bungeroth\n\tyab improvements Copyright 2013-2020 by Jim Saxton\n\tyab improvements Copyright 2018-2020 by BeSly Software Solutions\n\t\t(Thanks to Stephan Aßmus for Correction of Code)\n"
#define BANNER \ #define BANNER \
"\n yab is yabasic, a BASIC programming language for Haiku.\n This is version " VERSION ", built on "\ "\n yab is yabasic, a BASIC programming language for Haiku.\n This is version " VERSION ", built on "\
ARCHITECTURE " on " BUILD_TIME "\n\n " COPYRIGHT "\n\n" ARCHITECTURE " on " BUILD_TIME "\n\n " COPYRIGHT "\n\n"
@ -1499,6 +1499,8 @@ static void run_it(YabInterface* yab)
radioset(current, yab); DONE; radioset(current, yab); DONE;
case cTOOLTIP: case cTOOLTIP:
tooltip(current, yab); DONE; tooltip(current, yab); DONE;
case cTOOLTIPNEW:
tooltipnew(current, yab); DONE;
case cTOOLTIPCOLOR: case cTOOLTIPCOLOR:
tooltipcolor(current, yab); DONE; tooltipcolor(current, yab); DONE;
case cFILEBOX: case cFILEBOX:
@ -1563,6 +1565,8 @@ static void run_it(YabInterface* yab)
soundstop(current, yab); DONE; soundstop(current, yab); DONE;
case cSOUNDWAIT: case cSOUNDWAIT:
soundwait(current, yab); DONE; soundwait(current, yab); DONE;
case cMEDIASOUNDSTOP:
mediasoundstop(current, yab); DONE;
case cSHORTCUT: case cSHORTCUT:
shortcut(current, yab); DONE; shortcut(current, yab); DONE;
case cTREEBOX13: case cTREEBOX13:

View File

@ -113,9 +113,9 @@ void report_missing(int severity,char *text) {
%token tBUTTON tALERT tMENU tCHECKBOX tRADIOBUTTON tTEXTCONTROL %token tBUTTON tALERT tMENU tCHECKBOX tRADIOBUTTON tTEXTCONTROL
%token tLISTBOX tDROPBOX tADD tREMOVE tLOCALIZE tFILEPANEL tSLIDER tSTATUSBAR %token tLISTBOX tDROPBOX tADD tREMOVE tLOCALIZE tFILEPANEL tSLIDER tSTATUSBAR
%token tLAYOUT tSET tTEXTEDIT tCOUNT tVIEW tBOXVIEW tTABVIEW tTEXTURL tBITMAP tCANVAS %token tLAYOUT tSET tTEXTEDIT tCOUNT tVIEW tBOXVIEW tTABVIEW tTEXTURL tBITMAP tCANVAS
%token tOPTION tDROPZONE tCOLORCONTROL tTREEBOX tCOLUMNBOX tCOLUMN tSORT tTOOLTIP tCALENDAR %token tOPTION tDROPZONE tCOLORCONTROL tTREEBOX tCOLUMNBOX tCOLUMN tSORT tTOOLTIP tTOOLTIPNEW tCALENDAR
%token tCLIPBOARD tCOPY tSUBMENU tSELECT tSCROLLBAR tEXPAND tCOLLAPSE tSPLITVIEW tSTACKVIEW %token tCLIPBOARD tCOPY tSUBMENU tSELECT tSCROLLBAR tEXPAND tCOLLAPSE tSPLITVIEW tSTACKVIEW
%token tPOPUPMENU tSPINCONTROL tMSEND tNUMMESSAGE tTHREAD tSOUND tPLAY tSTOP tSHORTCUT tISCOMPUTERON %token tPOPUPMENU tSPINCONTROL tMSEND tNUMMESSAGE tTHREAD tSOUND tPLAY tSTOP tMEDIASOUND tSHORTCUT tISCOMPUTERON
%token tDRAW tTEXT tFLUSH tELLIPSE tSAVE %token tDRAW tTEXT tFLUSH tELLIPSE tSAVE
%token tRECT tGETCHAR tPUTCHAR tNEW tCURVE tLAUNCH tATTRIBUTE %token tRECT tGETCHAR tPUTCHAR tNEW tCURVE tLAUNCH tATTRIBUTE
@ -326,6 +326,7 @@ statement: /* empty */
| tCHECKBOX tSET string_expression ',' expression {add_command(cCHECKBOXSET,NULL);} | tCHECKBOX tSET string_expression ',' expression {add_command(cCHECKBOXSET,NULL);}
| tRADIOBUTTON tSET string_expression ',' expression {add_command(cRADIOSET,NULL);} | tRADIOBUTTON tSET string_expression ',' expression {add_command(cRADIOSET,NULL);}
| tTOOLTIP string_expression ',' string_expression {add_command(cTOOLTIP,NULL);} | tTOOLTIP string_expression ',' string_expression {add_command(cTOOLTIP,NULL);}
| tTOOLTIPNEW string_expression ',' string_expression ',' string_expression ',' expression ',' expression ',' expression {add_command(cTOOLTIPNEW,NULL);}
| tTOOLTIP tCOLOUR string_expression ',' expression ',' expression ',' expression {add_command(cTOOLTIPCOLOR,NULL);} | tTOOLTIP tCOLOUR string_expression ',' expression ',' expression ',' expression {add_command(cTOOLTIPCOLOR,NULL);}
| tLISTBOX tSORT string_expression {add_command(cLISTSORT,NULL);} | tLISTBOX tSORT string_expression {add_command(cLISTSORT,NULL);}
| tTREEBOX tSORT string_expression {add_command(cTREESORT,NULL);} | tTREEBOX tSORT string_expression {add_command(cTREESORT,NULL);}
@ -359,7 +360,9 @@ statement: /* empty */
| tSOUND tSTOP expression {add_command(cSOUNDSTOP,NULL);} | tSOUND tSTOP expression {add_command(cSOUNDSTOP,NULL);}
| tSOUND tSTOP '(' expression ')' {add_command(cSOUNDSTOP,NULL);} | tSOUND tSTOP '(' expression ')' {add_command(cSOUNDSTOP,NULL);}
| tSOUND tWAIT expression {add_command(cSOUNDWAIT,NULL);} | tSOUND tWAIT expression {add_command(cSOUNDWAIT,NULL);}
| tSOUND tWAIT '(' expression ')' {add_command(cSOUNDWAIT,NULL);} | tSOUND tWAIT '(' expression ')' {add_command(cSOUNDWAIT,NULL);}
| tMEDIASOUND tSTOP expression {add_command(cMEDIASOUNDSTOP,NULL);}
| tMEDIASOUND tSTOP '(' expression ')' {add_command(cMEDIASOUNDSTOP,NULL);}
| tSPLITVIEW coordinates to coordinates ',' string_expression ',' expression ',' expression ',' string_expression {add_command(cSPLITVIEW1,NULL);} | tSPLITVIEW coordinates to coordinates ',' string_expression ',' expression ',' expression ',' string_expression {add_command(cSPLITVIEW1,NULL);}
| tSPLITVIEW tSET string_expression ',' string_expression ',' expression {add_command(cSPLITVIEW2,NULL);} | tSPLITVIEW tSET string_expression ',' string_expression ',' expression {add_command(cSPLITVIEW2,NULL);}
| tSPLITVIEW tSET string_expression ',' string_expression ',' expression ',' expression {add_command(cSPLITVIEW3,NULL);} | tSPLITVIEW tSET string_expression ',' string_expression ',' expression ',' expression {add_command(cSPLITVIEW3,NULL);}
@ -628,6 +631,7 @@ function: tSIN '(' expression ')' {create_function(fSIN);}
| tTHREAD tGETNUM string_expression ',' string_expression {create_function(fTHREADGET);} | tTHREAD tGETNUM string_expression ',' string_expression {create_function(fTHREADGET);}
| tPRINTER string_expression ',' string_expression ',' string_expression {create_function(fPRINTER);} | tPRINTER string_expression ',' string_expression ',' string_expression {create_function(fPRINTER);}
| tSOUND tPLAY string_expression {create_function(fSOUND);} | tSOUND tPLAY string_expression {create_function(fSOUND);}
| tMEDIASOUND tPLAY string_expression {create_function(fMEDIASOUND);}
| tISCOMPUTERON {create_function(fISCOMPUTERON);} | tISCOMPUTERON {create_function(fISCOMPUTERON);}
| tLISTBOX tGETNUM string_expression {create_function(fLISTBOXGETNUM);} | tLISTBOX tGETNUM string_expression {create_function(fLISTBOXGETNUM);}
| tDROPBOX tGETNUM string_expression {create_function(fDROPBOXGETNUM);} | tDROPBOX tGETNUM string_expression {create_function(fDROPBOXGETNUM);}

View File

@ -223,6 +223,7 @@ COLORCONTROL return tCOLORCONTROL;
TREEBOX return tTREEBOX; TREEBOX return tTREEBOX;
SORT return tSORT; SORT return tSORT;
TOOLTIP return tTOOLTIP; TOOLTIP return tTOOLTIP;
TOOLTIPNEW return tTOOLTIPNEW;
COLUMNBOX return tCOLUMNBOX; COLUMNBOX return tCOLUMNBOX;
COLUMN return tCOLUMN; COLUMN return tCOLUMN;
CLIPBOARD return tCLIPBOARD; CLIPBOARD return tCLIPBOARD;
@ -235,6 +236,7 @@ SCROLLBAR return tSCROLLBAR;
COLLAPSE return tCOLLAPSE; COLLAPSE return tCOLLAPSE;
EXPAND return tEXPAND; EXPAND return tEXPAND;
SOUND return tSOUND; SOUND return tSOUND;
MEDIASOUND return tMEDIASOUND;
PLAY return tPLAY; PLAY return tPLAY;
STOP return tSTOP; STOP return tSTOP;
SPLITVIEW return tSPLITVIEW; SPLITVIEW return tSPLITVIEW;

View File

@ -300,7 +300,7 @@ enum functions { /* functions in yabasic (sorted by number of arguments) */
fLTRIM,fRTRIM,fTRIM,fCHR,fTRANSLATE,fMENUTRANSLATE,fMOUSE, fISMOUSEIN,fTEXTCONTROLGET, fLTRIM,fRTRIM,fTRIM,fCHR,fTRANSLATE,fMENUTRANSLATE,fMOUSE, fISMOUSEIN,fTEXTCONTROLGET,
fKEYBOARD,fCOLUMNBOXCOUNT, fCALENDAR, fLISTBOXCOUNT, fTREEBOXCOUNT, fSTACKVIEWGET, fKEYBOARD,fCOLUMNBOXCOUNT, fCALENDAR, fLISTBOXCOUNT, fTREEBOXCOUNT, fSTACKVIEWGET,
fSPINCONTROLGET, fDROPBOXCOUNT, fSLIDERGET, fTEXTGET, fDRAWGET3, fTABVIEWGET, fSPINCONTROLGET, fDROPBOXCOUNT, fSLIDERGET, fTEXTGET, fDRAWGET3, fTABVIEWGET,
fLISTBOXGETNUM, fDROPBOXGETNUM, fCOLUMNBOXGETNUM, fTREEBOXGETNUM, fSOUND, fLISTBOXGETNUM, fDROPBOXGETNUM, fCOLUMNBOXGETNUM, fTREEBOXGETNUM, fSOUND, fMEDIASOUND,
fONEARGS, fONEARGS,
fDEC2,fATAN2,fLEFT,fAND,fOR,fEOR,fLOG2, fDEC2,fATAN2,fLEFT,fAND,fOR,fEOR,fLOG2,
fRIGHT,fINSTR,fRINSTR,fSTR2,fMOD,fMIN,fMAX,fPEEK3,fMID2,fWINDOWGET, fVIEWGET /* vasper */, fRIGHT,fINSTR,fRINSTR,fSTR2,fMOD,fMIN,fMAX,fPEEK3,fMID2,fWINDOWGET, fVIEWGET /* vasper */,
@ -378,7 +378,7 @@ enum cmd_type { /* type of command */
cVIEW, cBOXVIEW, cBOXVIEWSET, cTAB, cSLIDER1, cSLIDER2, cSLIDER3, cSLIDER4, cSLIDER5, cSLIDER6, cVIEW, cBOXVIEW, cBOXVIEWSET, cTAB, cSLIDER1, cSLIDER2, cSLIDER3, cSLIDER4, cSLIDER5, cSLIDER6,
cOPTION1, cOPTION2, cOPTION3, cDROPZONE, cTEXTCONTROL2, cTEXTCONTROL3, cTEXTCONTROL4, cTEXTCONTROL5, cOPTION1, cOPTION2, cOPTION3, cDROPZONE, cTEXTCONTROL2, cTEXTCONTROL3, cTEXTCONTROL4, cTEXTCONTROL5,
cCOLORCONTROL1, cCOLORCONTROL2, cTREEBOX1, cTREEBOX2, cTREEBOX3, cTREEBOX4, cTREEBOX5, cCOLORCONTROL1, cCOLORCONTROL2, cTREEBOX1, cTREEBOX2, cTREEBOX3, cTREEBOX4, cTREEBOX5,
cBUTTONIMAGE, cCHECKBOXIMAGE, cCHECKBOXSET, cRADIOSET, cTOOLTIP, cTOOLTIPCOLOR, cTREESORT, cBUTTONIMAGE, cCHECKBOXIMAGE, cCHECKBOXSET, cRADIOSET, cTOOLTIP, cTOOLTIPNEW, cTOOLTIPCOLOR, cTREESORT,
cLISTSORT, cFILEBOX, cFILEBOXADD2, cFILEBOXCLEAR, cCOLUMNBOXREMOVE, cLISTSORT, cFILEBOX, cFILEBOXADD2, cFILEBOXCLEAR, cCOLUMNBOXREMOVE,
cCOLUMNBOXSELECT, cCOLUMNBOXADD, cDROPBOXSELECT, cMENU2, cSUBMENU1, cSUBMENU2, cCLIPBOARDCOPY, cCOLUMNBOXSELECT, cCOLUMNBOXADD, cDROPBOXSELECT, cMENU2, cSUBMENU1, cSUBMENU2, cCLIPBOARDCOPY,
cCOLUMNBOXCOLOR, cPRINTERCONFIG, cCALENDAR, cLISTBOXSELECT, cLISTBOXADD1, cLISTBOXADD2, cCOLUMNBOXCOLOR, cPRINTERCONFIG, cCALENDAR, cLISTBOXSELECT, cLISTBOXADD1, cLISTBOXADD2,
@ -389,7 +389,7 @@ enum cmd_type { /* type of command */
cDOT, cLINE, cCIRCLE, cDRAWTEXT, cDRAWRECT, cTREEBOX12, cOPTION4, cOPTION5, cDOT, cLINE, cCIRCLE, cDRAWTEXT, cDRAWRECT, cTREEBOX12, cOPTION4, cOPTION5,
cDRAWCLEAR, cDRAWSET1, cDRAWSET2, cELLIPSE, cCURVE, /* Drawing */ cDRAWCLEAR, cDRAWSET1, cDRAWSET2, cELLIPSE, cCURVE, /* Drawing */
cBITMAP, cBITMAPDRAW, cBITMAPDRAW2, cBITMAPGET, cBITMAPGET2, cBITMAPGETICON, cBITMAPDRAG, cBITMAPREMOVE, cCANVAS, /* Bitmaps */ cBITMAP, cBITMAPDRAW, cBITMAPDRAW2, cBITMAPGET, cBITMAPGET2, cBITMAPGETICON, cBITMAPDRAG, cBITMAPREMOVE, cCANVAS, /* Bitmaps */
cSOUNDSTOP, cSOUNDWAIT, /* Sound */ cSOUNDSTOP, cSOUNDWAIT, cMEDIASOUNDSTOP, /* Sound */
cTREEBOX13, cDRAWSET4, cSHORTCUT, cMOUSESET, cTREEBOX13, cDRAWSET4, cSHORTCUT, cMOUSESET,
cSCREENSHOT, cSTATUSBAR, cSTATUSBARSET, cSTATUSBARSET2, cSTATUSBARSET3, cLAUNCH, cRESTORE2, cRESTORE3, cSCREENSHOT, cSTATUSBAR, cSTATUSBARSET, cSTATUSBARSET2, cSTATUSBARSET3, cLAUNCH, cRESTORE2, cRESTORE3,
cATTRIBUTE1, cATTRIBUTE2, cATTRIBUTECLEAR, cATTRIBUTE1, cATTRIBUTE2, cATTRIBUTECLEAR,
@ -657,6 +657,7 @@ void checkboximage(struct command *, YabInterface *yab);
void checkboxset(struct command *, YabInterface *yab); void checkboxset(struct command *, YabInterface *yab);
void radioset(struct command *, YabInterface *yab); void radioset(struct command *, YabInterface *yab);
void tooltip(struct command *, YabInterface *yab); void tooltip(struct command *, YabInterface *yab);
void tooltipnew(struct command *, YabInterface *yab);
void tooltipcolor(struct command *, YabInterface *yab); void tooltipcolor(struct command *, YabInterface *yab);
void listsort(struct command *, YabInterface *yab); void listsort(struct command *, YabInterface *yab);
void treesort(struct command *, YabInterface *yab); void treesort(struct command *, YabInterface *yab);
@ -758,6 +759,8 @@ void drawset4(struct command *, YabInterface *yab);
int sound(const char*, YabInterface *yab, int line, const char* libname); int sound(const char*, YabInterface *yab, int line, const char* libname);
void soundstop(struct command *, YabInterface *yab); void soundstop(struct command *, YabInterface *yab);
void soundwait(struct command *, YabInterface *yab); void soundwait(struct command *, YabInterface *yab);
int mediasound(const char*, YabInterface *yab, int line, const char* libname);
void mediasoundstop(struct command *, YabInterface *yab);
void shortcut(struct command *, YabInterface *yab); void shortcut(struct command *, YabInterface *yab);
int iscomputeron(YabInterface *yab, int line, const char* libname); int iscomputeron(YabInterface *yab, int line, const char* libname);
void mouseset(struct command *, YabInterface *yab); void mouseset(struct command *, YabInterface *yab);

View File

@ -36,5 +36,5 @@ OPT = -O
LIBPATHS = $(shell findpaths B_FIND_PATH_DEVELOP_LIB_DIRECTORY) LIBPATHS = $(shell findpaths B_FIND_PATH_DEVELOP_LIB_DIRECTORY)
LIBPATH=$(addprefix -L,$(LIBPATHS)) LIBPATH=$(addprefix -L,$(LIBPATHS))
LIB = -lyab -lbe -lroot -ltranslation -ltracker -lmedia -lz LIB = -lyab1 -lbe -lroot -ltranslation -ltracker -lmedia -lz