[COMPILER]

* BUG: Unexpected END SUB or END FUNCTION are really detected now.

[GB.QT4]
* BUG: Color management has been fixed.
* BUG: Many fixes in the following classes: Panel, Menu, Picture, Window, TabStrip, 


git-svn-id: svn://localhost/gambas/trunk@2015 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2009-06-11 21:33:17 +00:00
parent 349424f629
commit dbaccd820f
23 changed files with 84 additions and 67 deletions

View File

@ -2052,7 +2052,7 @@ Public Sub Control_Draw(Optional iIndex As Integer)
Else
Draw.Tile(Picture["img/16/red-arrow-h.png"], 4, hCtrl.H / 2 - 4, hCtrl.W - 8, 8)
Endif
Draw.Foreground = Color.Red
Draw.Foreground = &HFF8080&
Case "VBox"
@ -2064,7 +2064,7 @@ Public Sub Control_Draw(Optional iIndex As Integer)
Else
Draw.Tile(Picture["img/16/red-arrow-v.png"], hCtrl.W / 2 - 4, 4, 8, hCtrl.H - 8)
Endif
Draw.Foreground = Color.Red
Draw.Foreground = &HFF8080&
Case "HPanel"
@ -2076,7 +2076,7 @@ Public Sub Control_Draw(Optional iIndex As Integer)
Else
Draw.Tile(Picture["img/16/red-arrow-r.png"], 4, hCtrl.H / 2 - 4, hCtrl.W - 8, 8)
Endif
Draw.Foreground = Color.Red
Draw.Foreground = &HFF8080&
Case "VPanel"
@ -2088,7 +2088,7 @@ Public Sub Control_Draw(Optional iIndex As Integer)
Else
Draw.Tile(Picture["img/16/red-arrow-c.png"], hCtrl.W / 2 - 4, 4, 8, hCtrl.H - 8)
Endif
Draw.Foreground = Color.Red
Draw.Foreground = &HFF8080&
Case Else
@ -2102,7 +2102,7 @@ Public Sub Control_Draw(Optional iIndex As Integer)
Else
Draw.Text(hCtrl.Tag, 4, 4)
Endif
Draw.Foreground = Color.Black
Draw.Foreground = &H808080&
End Select

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 187 B

View File

@ -1,5 +1,5 @@
# Gambas Project File 3.0
# Compiled with Gambas 2.99.0
# Compiled with Gambas 2.99.0 (r1989)
Startup=FFocusBug
StackTrace=1
Version=2.99.0

View File

@ -10,7 +10,7 @@
MoveScaled(0,0,86,50)
Expand = True
{ panBookmark SidePanel
MoveScaled(2,2,19,47)
MoveScaled(2,2,17,47)
Visible = False
Arrangement = Arrange.Vertical
Spacing = True
@ -50,32 +50,32 @@
Visible = False
}
{ btnParent ToolButton
MoveScaled(37,0,4,4)
MoveScaled(38,0,4,4)
ToolTip = ("Parent directory")
Text = ("")
Picture = Picture["icon:/small/up"]
}
{ btnRefresh ToolButton
MoveScaled(41,0,4,4)
MoveScaled(42,0,4,4)
ToolTip = ("Refresh")
Text = ("")
Picture = Picture["icon:/small/refresh"]
}
{ btnNewDir ToolButton
MoveScaled(45,0,4,4)
MoveScaled(46,0,4,4)
ToolTip = ("Create directory")
Text = ("")
Picture = Picture["icon:/small/new-dir"]
}
{ btnShowHidden ToolButton
MoveScaled(49,0,4,4)
MoveScaled(50,0,4,4)
ToolTip = ("View hidden files")
Text = ("")
Picture = Picture["icon:/small/lamp"]
Toggle = True
}
{ btnDetailed ToolButton
MoveScaled(53,0,4,4)
MoveScaled(54,0,4,4)
Visible = False
ToolTip = ("Toggle view")
Text = ("")

View File

@ -51,13 +51,13 @@ File[3]="_MySQL.class:28.0"
Fold[3]=[]
File[4]="_Index.class:0.0"
Fold[4]=[]
Active=5
File[5]="DB.class:12.0"
Fold[5]=[]
File[6]="_DataBase.class:0.0"
Fold[6]=[]
File[7]="modMain.module:19.0"
Fold[7]=[]
Active=8
File[8]="Connection.class:11.3"
Fold[8]=[]
File[9]="_DataTypes.class:78.2"

View File

@ -630,8 +630,6 @@ static void toggle_menu(CMENU *_object)
if (!THIS->parent)
return;
//qDebug("toggle_menu: %s", THIS->text);
cont = (QPopupMenu *)THIS->container;
cont->setItemChecked(THIS->id, !cont->isItemChecked(THIS->id));
THIS->checked = cont->isItemChecked(THIS->id);

View File

@ -1,7 +1,7 @@
# Gambas Project File 3.0
# Compiled with Gambas 2.99.0 (r1759)
# Compiled with Gambas 2.99.0 (r1989)
Startup=FMain
Version=0.0.304
Version=0.0.306
Component=gb.qt
TabSize=2
KeepDebugInfo=1

View File

@ -450,8 +450,14 @@ Private Function Value_Read() As Boolean
Dim hCtrl As Object
'Debug $sKey
For Each hCtrl In GetControls()
If IsToggle(hCtrl) Then Return GetToggle(hCtrl)
'Debug hCtrl.Name;; Object.Type(hCtrl)
If IsToggle(hCtrl) Then
'Debug "-->";; GetToggle(hCtrl)
Return GetToggle(hCtrl)
Endif
Next
End

View File

@ -90,7 +90,6 @@ static void *temp_image(GB_IMG *img)
image = new QImage();
else
image = new QImage((uchar *)img->data, img->width, img->height, QImage::Format_ARGB32);
image->setAlphaBuffer(true);
return image;
}
@ -126,7 +125,11 @@ CIMAGE *CIMAGE_create(QImage *image)
GB.New(POINTER(&img), class_id, NULL, NULL);
if (image)
{
if (!image->isNull() && image->format() != QImage::Format_ARGB32)
*image = image->convertToFormat(QImage::Format_ARGB32);
take_image(img, image);
}
else
take_image(img, new QImage());

View File

@ -41,6 +41,12 @@
#include "CConst.h"
#include "CLabel.h"
/*#undef CLABEL_PROPERTIES
#define CLABEL_PROPERTIES "*,Padding{Range:0;63},AutoResize,Text,Alignment{Align.*}=Normal,Border{Border.*},Transparent=True"
#undef CTEXTLABEL_PROPERTIES
#define CTEXTLABEL_PROPERTIES "*,Padding{Range:0;63},AutoResize,Text,Alignment{Align.*}=TopNormal,Border{Border.*},Transparent=True"*/
/*#define DEBUG_CBUTTON*/
@ -243,7 +249,7 @@ void MyLabel::calcMinimumHeight(bool adjust)
//qDebug("calcMinimumHeight: %p %s", ob, ((CWIDGET *)ob)->name);
int w, h, nw, nh;
int f = frameWidth();
int f = frameWidth() + margin();
QRect br;
if (f > 0 && f < 4)

View File

@ -94,16 +94,21 @@ static void delete_menu(CMENU *_object)
THIS->deleted = true;
}
#if 0
static void toggle_menu(CMENU *_object)
{
if (CMENU_is_toplevel(THIS))
return;
//qDebug("toggle_menu: %s", THIS->text);
qDebug("toggle_menu: %s %d", TO_UTF8(ACTION->text()), ACTION->isChecked());
//ACTION->setCheckable(true);
ACTION->setChecked(!ACTION->isChecked());
//ACTION->setCheckable(false);
qDebug("--> %d", ACTION->isChecked());
}
#endif
BEGIN_METHOD(CMENU_new, GB_OBJECT parent; GB_BOOLEAN hidden)
@ -288,7 +293,10 @@ BEGIN_PROPERTY(CMENU_toggle)
if (READ_PROPERTY)
GB.ReturnBoolean(THIS->toggle);
else
{
THIS->toggle = VPROP(GB_BOOLEAN);
ACTION->setCheckable(VPROP(GB_BOOLEAN));
}
END_PROPERTY
@ -537,8 +545,8 @@ QHash<QAction *, CMENU *> CMenu::dict;
static void send_click_event(CMENU *_object)
{
if (THIS->toggle)
toggle_menu(THIS);
//if (THIS->toggle)
// toggle_menu(THIS);
GB.Raise(THIS, EVENT_Click, 0);
CACTION_raise((CWIDGET *)THIS);
GB.Unref(POINTER(&_object));
@ -562,15 +570,14 @@ void CMenu::slotTriggered(QAction *action)
void CMenu::slotShown(void)
{
GET_SENDER(menu);
hideSeparators((CMENU *)menu);
GET_MENU_SENDER(menu);
GB.Raise(menu, EVENT_Show, 0);
}
void CMenu::slotHidden(void)
{
GET_SENDER(menu);
GET_MENU_SENDER(menu);
if (GB.CanRaise(menu, EVENT_Hide))
{

View File

@ -47,6 +47,8 @@ extern GB_DESC CMenuChildrenDesc[];
#define CMENU_is_toplevel(_menu) (GB.Is((_menu)->parent, CLASS_Window))
#define GET_MENU_SENDER(_menu) CMENU *_menu = CMenu::dict[((QMenu *)sender())->menuAction()]
#endif
typedef

View File

@ -37,7 +37,7 @@ BEGIN_METHOD(CPANEL_new, GB_OBJECT parent)
MyContainer *wid = new MyContainer(QCONTAINER(VARG(parent)));
THIS->container = wid;
THIS->widget.flag.fillBackground = true;
//THIS->widget.flag.fillBackground = true;
CWIDGET_new(wid, (void *)_object);
END_METHOD

View File

@ -346,9 +346,7 @@ BEGIN_PROPERTY(CPICTURE_image)
QImage *image = new QImage();
*image = THIS->pixmap->toImage();
if (!image->isNull())
image->convertToFormat(QImage::Format_ARGB32);
GB.ReturnObject(CIMAGE_create(image));
END_PROPERTY

View File

@ -78,6 +78,8 @@ CTab::CTab(CTABSTRIP *parent, QWidget *page)
id = WIDGET->stack.count();
visible = true;
setEnabled(WIDGET->isEnabled());
page->setAutoFillBackground(true);
}
CTab::~CTab()

View File

@ -119,6 +119,7 @@ static void set_design_object(CWIDGET *_object)
CWidget::removeFocusPolicy(WIDGET);
set_mouse(WIDGET, CMOUSE_DEFAULT, 0);
//THIS->flag.fillBackground = true;
}
static void set_design_recursive(QWidget *w, bool set = false)
@ -1022,7 +1023,7 @@ void CWIDGET_reset_color(CWIDGET *_object)
QWidget *w = get_color_widget(WIDGET);
//qDebug("reset_color: %s", THIS->name);
//qDebug("set_color: (%s %p) bg = %06X (%d) fg = %06X (%d)", GB.GetClassName(THIS), THIS, bg, w->backgroundRole(), fg, w->foregroundRole());
//qDebug("set_color: (%s %p) bg = %08X (%d) fg = %08X (%d)", GB.GetClassName(THIS), THIS, THIS->bg, w->backgroundRole(), THIS->fg, w->foregroundRole());
if (THIS->bg == COLOR_DEFAULT && THIS->fg == COLOR_DEFAULT)
{
@ -1034,7 +1035,7 @@ void CWIDGET_reset_color(CWIDGET *_object)
}
else
{
palette = w->palette();
palette = QPalette(); //w->palette();
bg = THIS->bg;
fg = THIS->fg;

View File

@ -135,7 +135,7 @@ static void clear_mask(CWINDOW *_object)
THIS->reallyMasked = false;
//THIS->container->setPalette(QPalette());
CWIDGET_set_color((CWIDGET *)THIS, THIS->widget.bg, THIS->widget.fg);
CWIDGET_reset_color((CWIDGET *)THIS);
if (!THIS->toplevel)
{
@ -167,7 +167,7 @@ static void define_mask(CWINDOW *_object, CPICTURE *new_pict, bool new_mask)
QWidget *root = THIS->container;
QPalette palette;
//qDebug("define_mask: (%s %p) new_pict = %p new_mask = %d", GB.GetClassName(THIS), THIS, new_pict, new_mask);
qDebug("define_mask: (%s %p) new_pict = %p new_mask = %d", GB.GetClassName(THIS), THIS, new_pict, new_mask);
//if (THIS->embedded)
// return;
@ -215,12 +215,7 @@ static void define_mask(CWINDOW *_object, CPICTURE *new_pict, bool new_mask)
//root->setErasePixmap(p);
}
//palette = root->palette();
//palette.setBrush(root->backgroundRole(), QBrush(p));
//root->setPalette(palette);
//WINDOW->setAutoFillBackground();
//WINDOW->setBackgroundPixmap(p);
QPalette palette;
palette = WINDOW->palette();
palette.setBrush(WINDOW->backgroundRole(), QBrush(p));
WINDOW->setPalette(palette);
}
@ -820,10 +815,7 @@ BEGIN_PROPERTY(CWINDOW_picture)
if (READ_PROPERTY)
GB.ReturnObject(THIS->picture);
else
{
//GB.StoreObject(PROP(GB_OBJECT), POINTER(&THIS->picture));
define_mask(THIS, (CPICTURE *)VPROP(GB_OBJECT), THIS->masked);;
}
define_mask(THIS, (CPICTURE *)VPROP(GB_OBJECT), THIS->masked);
END_PROPERTY
@ -1619,7 +1611,7 @@ void MyMainWindow::showActivate(QWidget *transient)
CWINDOW *parent;
QWidget *newParentWidget;
//qDebug(">> Show %d %d %d %d", x(), y(), width(), height());
//qDebug("showActivate: %s %d", THIS->widget.name, isToolbar());
// Reparent the window if, for example, there is an already modal window displayed
@ -1634,8 +1626,8 @@ void MyMainWindow::showActivate(QWidget *transient)
if (parent != THIS && parentWidget() != newParentWidget)
doReparent(newParentWidget, windowFlags(), pos());
else
newParentWidget = 0;
//else
// newParentWidget = 0;
#ifndef NO_X_WINDOW
if (newParentWidget && isToolbar())
@ -1713,8 +1705,6 @@ void MyMainWindow::showModal(void)
Qt::WindowFlags flags = windowFlags();
CWIDGET *_object = CWidget::get(this);
bool persistent = CWIDGET_test_flag(THIS, WF_PERSISTENT);
//QWidget *parent = parentWidget();
//QWidget *reparent;
CWINDOW *save = CWINDOW_Current;
QPoint p = pos();
QEventLoop *old;
@ -1728,15 +1718,9 @@ void MyMainWindow::showModal(void)
mustCenter = true;
/*reparent = qApp->activeWindow();
if (!reparent && CWINDOW_Main)
{
reparent = CWINDOW_Main->widget.widget;
if (reparent == this)
reparent = 0;
}
if (CWINDOW_Active)
X11_set_transient_for(winId(), CWINDOW_Active->widget.widget->winId());
doReparent(reparent, windowFlags(), p);*/
setWindowModality(Qt::WindowModal);
if (_resizable && _border)
@ -1747,8 +1731,6 @@ void MyMainWindow::showModal(void)
THIS->enterLoop = false; // Do not call exitLoop() if we do not entered the loop yet!
//CWIDGET_clear_flag(THIS, WF_CLOSED); // Normaly done in showActivate()
show();
afterShow();
@ -1766,9 +1748,7 @@ void MyMainWindow::showModal(void)
if (persistent)
{
setSizeGrip(false);
//clearWState(WShowModal);
setWindowModality(Qt::NonModal);
//doReparent(parent, flags, p);
}
}

View File

@ -1,7 +1,7 @@
# Gambas Project File 3.0
# Compiled with Gambas 2.99.0 (r1759)
# Compiled with Gambas 2.99.0 (r1989)
Startup=FMain
Version=0.0.267
Version=0.0.269
Component=gb.qt
TabSize=2
KeepDebugInfo=1

View File

@ -619,7 +619,7 @@ static bool header_function(TRANS_FUNC *func)
if (!PATTERN_is_newline(*(JOB->current)))
THROW("Syntax error at function declaration");
func->line = PATTERN_index(*(JOB->current)) + 1; /* <20> commence <20>la ligne suivante ! */
func->line = PATTERN_index(*(JOB->current)) + 1;
func->start = JOB->current + 1;
for(;;)
@ -627,10 +627,13 @@ static bool header_function(TRANS_FUNC *func)
pat = *JOB->current;
if (PATTERN_is_end(pat) || PATTERN_is_command(pat))
{
THROW("Missing END");
THROW("Missing End");
}
if (PATTERN_is_newline(pat))
{
JOB->line = PATTERN_index(pat) + 1;
if (PATTERN_is(JOB->current[1], RS_END))
{
if (PATTERN_is_newline(JOB->current[2]))
@ -643,7 +646,15 @@ static bool header_function(TRANS_FUNC *func)
JOB->current += 3;
break;
}
else
{
if (is_proc && PATTERN_is(JOB->current[2], RS_FUNCTION))
THROW("End Sub expected");
else if (!is_proc && PATTERN_is(JOB->current[2], RS_SUB))
THROW("End Function expected");
}
}
}
JOB->current++;
}
@ -738,7 +749,7 @@ static bool header_inherits(void)
JOB->current++;
if (!PATTERN_is_class(*JOB->current))
THROW("Syntax error. INHERITS needs a class name");
THROW("Syntax error. Inherits needs a class name");
if (JOB->class->parent != NO_SYMBOL)
THROW("Cannot inherit twice");

View File

@ -657,8 +657,11 @@ void IMAGE_make_transparent(GB_IMG *img, GB_COLOR col)
);
*p = BGRA_to_format(color, img->format);
//fprintf(stderr, "[%d] %08X\n", p - (uint *)img->data, *p);
p++;
}
//fprintf(stderr, "IMAGE_make_transparent: ** DONE **\n");
}