mirror of https://github.com/buggins/dlangui.git
fixes
This commit is contained in:
parent
0a47398344
commit
54c67d9a0b
|
|
@ -3,7 +3,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProductVersion>10.0.0</ProductVersion>
|
<ProductVersion>8.0.30703</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{440816C8-DBD6-454C-A0D7-B6E59CA1ED86}</ProjectGuid>
|
<ProjectGuid>{440816C8-DBD6-454C-A0D7-B6E59CA1ED86}</ProjectGuid>
|
||||||
<UseDefaultCompiler>true</UseDefaultCompiler>
|
<UseDefaultCompiler>true</UseDefaultCompiler>
|
||||||
|
|
@ -12,11 +12,11 @@
|
||||||
<Compiler>DMD2</Compiler>
|
<Compiler>DMD2</Compiler>
|
||||||
<Includes>
|
<Includes>
|
||||||
<Includes>
|
<Includes>
|
||||||
<Path>/home/lve/src/d/DerelictFT/source</Path>
|
<Path>\home\lve\src\d\DerelictFT\source</Path>
|
||||||
<Path>/home/lve/src/d/DerelictGL3/source</Path>
|
<Path>\home\lve\src\d\DerelictGL3\source</Path>
|
||||||
<Path>/home/lve/src/d/DerelictUtil/source</Path>
|
<Path>\home\lve\src\d\DerelictUtil\source</Path>
|
||||||
<Path>/home/lve/src/d/dlangui/3rdparty/X11</Path>
|
<Path>\home\lve\src\d\dlangui\3rdparty\X11</Path>
|
||||||
<Path>/home/lve/src/d/dlangui/3rdparty/X11/xcb</Path>
|
<Path>\home\lve\src\d\dlangui\3rdparty\X11\xcb</Path>
|
||||||
</Includes>
|
</Includes>
|
||||||
</Includes>
|
</Includes>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -217,6 +217,7 @@
|
||||||
<Compile Include="..\DerelictSDL2\source\derelict\sdl2\types.d">
|
<Compile Include="..\DerelictSDL2\source\derelict\sdl2\types.d">
|
||||||
<Link>3rdparty\FreetypeSDL2\types.d</Link>
|
<Link>3rdparty\FreetypeSDL2\types.d</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="src\dlangui\widgets\grid.d" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="src\dlangui\platforms\x11\" />
|
<Folder Include="src\dlangui\platforms\x11\" />
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@
|
||||||
<resfile />
|
<resfile />
|
||||||
<exefile>$(OutDir)\$(ProjectName).lib</exefile>
|
<exefile>$(OutDir)\$(ProjectName).lib</exefile>
|
||||||
<useStdLibPath>1</useStdLibPath>
|
<useStdLibPath>1</useStdLibPath>
|
||||||
|
<cRuntime>2</cRuntime>
|
||||||
<additionalOptions />
|
<additionalOptions />
|
||||||
<preBuildCommand />
|
<preBuildCommand />
|
||||||
<postBuildCommand />
|
<postBuildCommand />
|
||||||
|
|
@ -183,6 +184,7 @@
|
||||||
<resfile />
|
<resfile />
|
||||||
<exefile>$(OutDir)\$(ProjectName).lib</exefile>
|
<exefile>$(OutDir)\$(ProjectName).lib</exefile>
|
||||||
<useStdLibPath>1</useStdLibPath>
|
<useStdLibPath>1</useStdLibPath>
|
||||||
|
<cRuntime>1</cRuntime>
|
||||||
<additionalOptions />
|
<additionalOptions />
|
||||||
<preBuildCommand />
|
<preBuildCommand />
|
||||||
<postBuildCommand />
|
<postBuildCommand />
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ private shared class UIStringList {
|
||||||
private dstring[string] _map;
|
private dstring[string] _map;
|
||||||
/// remove all items
|
/// remove all items
|
||||||
void clear() {
|
void clear() {
|
||||||
_map.clear();
|
_map.destroy();
|
||||||
}
|
}
|
||||||
/// set item value
|
/// set item value
|
||||||
void set(string id, dstring value) {
|
void set(string id, dstring value) {
|
||||||
|
|
|
||||||
|
|
@ -15,43 +15,43 @@ Copyright: Vadim Lopatin, 2014
|
||||||
License: Boost License 1.0
|
License: Boost License 1.0
|
||||||
Authors: Vadim Lopatin, coolreader.org@gmail.com
|
Authors: Vadim Lopatin, coolreader.org@gmail.com
|
||||||
*/
|
*/
|
||||||
module dlangui.dialogs.dialog;
|
module dlangui.dialogs.dialog;
|
||||||
|
|
||||||
import dlangui.core.i18n;
|
import dlangui.core.i18n;
|
||||||
import dlangui.core.signals;
|
import dlangui.core.signals;
|
||||||
import dlangui.widgets.layouts;
|
import dlangui.widgets.layouts;
|
||||||
import dlangui.widgets.controls;
|
import dlangui.widgets.controls;
|
||||||
import dlangui.platforms.common.platform;
|
import dlangui.platforms.common.platform;
|
||||||
|
|
||||||
import std.conv;
|
import std.conv;
|
||||||
|
|
||||||
/// dialog flag bits
|
/// dialog flag bits
|
||||||
enum DialogFlag : uint {
|
enum DialogFlag : uint {
|
||||||
/// dialog is modal
|
/// dialog is modal
|
||||||
Modal = 1,
|
Modal = 1,
|
||||||
/// dialog can be resized
|
/// dialog can be resized
|
||||||
Resizable = 2,
|
Resizable = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DialogResultHandler {
|
interface DialogResultHandler {
|
||||||
public void onDialogResult(Dialog dlg, Action result);
|
public void onDialogResult(Dialog dlg, Action result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// base for all dialogs
|
/// base for all dialogs
|
||||||
class Dialog : VerticalLayout {
|
class Dialog : VerticalLayout {
|
||||||
protected Window _window;
|
protected Window _window;
|
||||||
protected Window _parentWindow;
|
protected Window _parentWindow;
|
||||||
protected UIString _caption;
|
protected UIString _caption;
|
||||||
protected uint _flags;
|
protected uint _flags;
|
||||||
|
|
||||||
Signal!DialogResultHandler onDialogResult;
|
Signal!DialogResultHandler onDialogResult;
|
||||||
|
|
||||||
this(UIString caption, Window parentWindow = null, uint flags = DialogFlag.Modal) {
|
this(UIString caption, Window parentWindow = null, uint flags = DialogFlag.Modal) {
|
||||||
super("dlg");
|
super("dlg");
|
||||||
_caption = caption;
|
_caption = caption;
|
||||||
_parentWindow = parentWindow;
|
_parentWindow = parentWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property UIString windowCaption() {
|
@property UIString windowCaption() {
|
||||||
return _caption;
|
return _caption;
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +62,7 @@ class Dialog : VerticalLayout {
|
||||||
_window.windowCaption = caption;
|
_window.windowCaption = caption;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property Dialog windowCaption(UIString caption) {
|
@property Dialog windowCaption(UIString caption) {
|
||||||
_caption = caption;
|
_caption = caption;
|
||||||
if (_window)
|
if (_window)
|
||||||
|
|
@ -93,17 +93,17 @@ class Dialog : VerticalLayout {
|
||||||
/// override to implement creation of dialog controls
|
/// override to implement creation of dialog controls
|
||||||
void init() {
|
void init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// shows dialog
|
/// shows dialog
|
||||||
void show() {
|
void show() {
|
||||||
init();
|
init();
|
||||||
uint wflags = 0;
|
uint wflags = 0;
|
||||||
if (_flags & DialogFlag.Modal)
|
if (_flags & DialogFlag.Modal)
|
||||||
wflags |= WindowFlag.Modal;
|
wflags |= WindowFlag.Modal;
|
||||||
if (_flags & DialogFlag.Resizable)
|
if (_flags & DialogFlag.Resizable)
|
||||||
wflags |= WindowFlag.Resizable;
|
wflags |= WindowFlag.Resizable;
|
||||||
_window = Platform.instance.createWindow(_caption, _parentWindow, wflags);
|
_window = Platform.instance.createWindow(_caption, _parentWindow, wflags);
|
||||||
_window.mainWidget = this;
|
_window.mainWidget = this;
|
||||||
_window.show();
|
_window.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,8 +151,13 @@ class Font : RefCountedObject {
|
||||||
|
|
||||||
/// returns true if font is fixed
|
/// returns true if font is fixed
|
||||||
@property int spaceWidth() {
|
@property int spaceWidth() {
|
||||||
if (_spaceWidth < 0)
|
if (_spaceWidth < 0) {
|
||||||
_spaceWidth = charWidth(' ');
|
_spaceWidth = charWidth(' ');
|
||||||
|
if (_spaceWidth <= 0)
|
||||||
|
_spaceWidth = charWidth('0');
|
||||||
|
if (_spaceWidth <= 0)
|
||||||
|
_spaceWidth = size;
|
||||||
|
}
|
||||||
return _spaceWidth;
|
return _spaceWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,8 +126,8 @@ private class FreeTypeFontFile {
|
||||||
|
|
||||||
private static string familyName(FT_Face face)
|
private static string familyName(FT_Face face)
|
||||||
{
|
{
|
||||||
string faceName = cast(string)fromStringz(face.family_name);
|
string faceName = fromStringz(face.family_name).dup;
|
||||||
string styleName = cast(string)fromStringz(face.style_name);
|
string styleName = fromStringz(face.style_name).dup;
|
||||||
if (faceName.equal("Arial") && styleName.equal("Narrow"))
|
if (faceName.equal("Arial") && styleName.equal("Narrow"))
|
||||||
faceName ~= " Narrow";
|
faceName ~= " Narrow";
|
||||||
else if (styleName.equal("Condensed"))
|
else if (styleName.equal("Condensed"))
|
||||||
|
|
@ -147,7 +147,7 @@ private class FreeTypeFontFile {
|
||||||
} else if (exists(kernFile ~ ".pfm" )) {
|
} else if (exists(kernFile ~ ".pfm" )) {
|
||||||
kernFile ~= ".pfm";
|
kernFile ~= ".pfm";
|
||||||
} else {
|
} else {
|
||||||
kernFile.clear();
|
kernFile.destroy();
|
||||||
}
|
}
|
||||||
if (kernFile.length > 0)
|
if (kernFile.length > 0)
|
||||||
error = FT_Attach_File(_face, kernFile.toStringz);
|
error = FT_Attach_File(_face, kernFile.toStringz);
|
||||||
|
|
|
||||||
|
|
@ -654,7 +654,7 @@ class ImageCache {
|
||||||
destroy(item);
|
destroy(item);
|
||||||
item = null;
|
item = null;
|
||||||
}
|
}
|
||||||
_map.clear();
|
_map.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -705,7 +705,7 @@ class DrawableCache {
|
||||||
_drawable.clear();
|
_drawable.clear();
|
||||||
foreach(ref t; _transformed)
|
foreach(ref t; _transformed)
|
||||||
t.clear();
|
t.clear();
|
||||||
_transformed.clear();
|
_transformed.destroy();
|
||||||
debug(resalloc) Log.d("Destroyed DrawableCacheItem, count=", --_instanceCount);
|
debug(resalloc) Log.d("Destroyed DrawableCacheItem, count=", --_instanceCount);
|
||||||
}
|
}
|
||||||
/// remove from memory, will cause reload on next access
|
/// remove from memory, will cause reload on next access
|
||||||
|
|
@ -714,7 +714,7 @@ class DrawableCache {
|
||||||
_drawable.clear();
|
_drawable.clear();
|
||||||
foreach(t; _transformed)
|
foreach(t; _transformed)
|
||||||
t.clear();
|
t.clear();
|
||||||
_transformed.clear();
|
_transformed.destroy();
|
||||||
}
|
}
|
||||||
/// mark as not used
|
/// mark as not used
|
||||||
void checkpoint() {
|
void checkpoint() {
|
||||||
|
|
@ -800,10 +800,10 @@ class DrawableCache {
|
||||||
}
|
}
|
||||||
void clear() {
|
void clear() {
|
||||||
Log.d("DrawableCache.clear()");
|
Log.d("DrawableCache.clear()");
|
||||||
_idToFileMap.clear();
|
_idToFileMap.destroy();
|
||||||
foreach(DrawableCacheItem item; _idToDrawableMap)
|
foreach(DrawableCacheItem item; _idToDrawableMap)
|
||||||
item.drawable.clear();
|
item.drawable.clear();
|
||||||
_idToDrawableMap.clear();
|
_idToDrawableMap.destroy();
|
||||||
}
|
}
|
||||||
// clear usage flags for all entries
|
// clear usage flags for all entries
|
||||||
void checkpoint() {
|
void checkpoint() {
|
||||||
|
|
@ -925,7 +925,7 @@ class DrawableCache {
|
||||||
destroy(item);
|
destroy(item);
|
||||||
item = null;
|
item = null;
|
||||||
}
|
}
|
||||||
_idToDrawableMap.clear();
|
_idToDrawableMap.destroy();
|
||||||
debug(resalloc) Log.e("Drawable instace count after destroying of DrawableCache: ", ImageDrawable.instanceCount);
|
debug(resalloc) Log.e("Drawable instace count after destroying of DrawableCache: ", ImageDrawable.instanceCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -598,7 +598,7 @@ version(USE_SDL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool processTextInput(const char * s) {
|
bool processTextInput(const char * s) {
|
||||||
string str = cast(string)fromStringz(s);
|
string str = fromStringz(s).dup;
|
||||||
dstring ds = toUTF32(str);
|
dstring ds = toUTF32(str);
|
||||||
uint flags = convertKeyFlags(SDL_GetModState());
|
uint flags = convertKeyFlags(SDL_GetModState());
|
||||||
bool res = dispatchKeyEvent(new KeyEvent(KeyAction.Text, 0, flags, ds));
|
bool res = dispatchKeyEvent(new KeyEvent(KeyAction.Text, 0, flags, ds));
|
||||||
|
|
@ -910,7 +910,7 @@ version(USE_SDL) {
|
||||||
char * txt = SDL_GetClipboardText();
|
char * txt = SDL_GetClipboardText();
|
||||||
if (!txt)
|
if (!txt)
|
||||||
return ""d;
|
return ""d;
|
||||||
string s = cast(string)fromStringz(txt);
|
string s = fromStringz(txt).dup;
|
||||||
SDL_free(txt);
|
SDL_free(txt);
|
||||||
return toUTF32(s);
|
return toUTF32(s);
|
||||||
}
|
}
|
||||||
|
|
@ -988,7 +988,7 @@ version(USE_SDL) {
|
||||||
Log.d("myWinMain()");
|
Log.d("myWinMain()");
|
||||||
string basePath = exePath();
|
string basePath = exePath();
|
||||||
Log.i("Current executable: ", exePath());
|
Log.i("Current executable: ", exePath());
|
||||||
string cmdline = cast(string)fromStringz(lpCmdLine);
|
string cmdline = fromStringz(lpCmdLine).dup;
|
||||||
Log.i("Command line: ", cmdline);
|
Log.i("Command line: ", cmdline);
|
||||||
string[] args = splitCmdLine(cmdline);
|
string[] args = splitCmdLine(cmdline);
|
||||||
Log.i("Command line params: ", args);
|
Log.i("Command line params: ", args);
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ class Win32Font : Font {
|
||||||
0,
|
0,
|
||||||
null,
|
null,
|
||||||
&identity );
|
&identity );
|
||||||
if (res==GDI_ERROR)
|
if (res == GDI_ERROR)
|
||||||
return null;
|
return null;
|
||||||
int gs = GetGlyphOutlineW( _drawbuf.dc, cast(wchar)ch,
|
int gs = GetGlyphOutlineW( _drawbuf.dc, cast(wchar)ch,
|
||||||
GGO_GRAY8_BITMAP, //GGO_METRICS
|
GGO_GRAY8_BITMAP, //GGO_METRICS
|
||||||
|
|
@ -287,6 +287,7 @@ class Win32FontManager : FontManager {
|
||||||
override ref FontRef getFont(int size, int weight, bool italic, FontFamily family, string face) {
|
override ref FontRef getFont(int size, int weight, bool italic, FontFamily family, string face) {
|
||||||
//Log.i("getFont()");
|
//Log.i("getFont()");
|
||||||
FontDef * def = findFace(family, face);
|
FontDef * def = findFace(family, face);
|
||||||
|
Log.i("getFont() found face ", def.face, " by requested face ", face);
|
||||||
if (def !is null) {
|
if (def !is null) {
|
||||||
int index = _activeFonts.find(size, weight, italic, def.family, def.face);
|
int index = _activeFonts.find(size, weight, italic, def.family, def.face);
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
|
|
@ -415,7 +416,7 @@ extern(Windows) {
|
||||||
{
|
{
|
||||||
void * p = cast(void*)lParam;
|
void * p = cast(void*)lParam;
|
||||||
Win32FontManager fontman = cast(Win32FontManager)p;
|
Win32FontManager fontman = cast(Win32FontManager)p;
|
||||||
string face = cast(string)fromStringz(lf.lfFaceName.ptr);
|
string face = fromStringz(lf.lfFaceName.ptr).dup;
|
||||||
FontFamily family = pitchAndFamilyToFontFamily(lf.lfPitchAndFamily);
|
FontFamily family = pitchAndFamilyToFontFamily(lf.lfPitchAndFamily);
|
||||||
if (face.length < 2 || face[0] == '@')
|
if (face.length < 2 || face[0] == '@')
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -527,61 +527,61 @@ class GridWidgetBase : WidgetGroup, OnScrollHandler {
|
||||||
return false; // same position
|
return false; // same position
|
||||||
if (col < _headerCols || row < _headerRows || col >= _cols || row >= _rows)
|
if (col < _headerCols || row < _headerRows || col >= _cols || row >= _rows)
|
||||||
return false; // out of range
|
return false; // out of range
|
||||||
_col = col;
|
_col = col;
|
||||||
_row = row;
|
_row = row;
|
||||||
invalidate();
|
invalidate();
|
||||||
calcScrollableAreaPos();
|
calcScrollableAreaPos();
|
||||||
if (makeVisible)
|
if (makeVisible)
|
||||||
makeCellVisible(_col, _row);
|
makeCellVisible(_col, _row);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// handle mouse wheel events
|
/// handle mouse wheel events
|
||||||
override bool onMouseEvent(MouseEvent event) {
|
override bool onMouseEvent(MouseEvent event) {
|
||||||
if (visibility != Visibility.Visible)
|
if (visibility != Visibility.Visible)
|
||||||
return false;
|
return false;
|
||||||
int c, r; // col, row
|
int c, r; // col, row
|
||||||
Rect rc;
|
Rect rc;
|
||||||
bool cellFound = false;
|
bool cellFound = false;
|
||||||
bool normalCell = false;
|
bool normalCell = false;
|
||||||
// convert coordinates
|
// convert coordinates
|
||||||
if (event.action == MouseAction.ButtonUp || event.action == MouseAction.ButtonDown || event.action == MouseAction.Move) {
|
if (event.action == MouseAction.ButtonUp || event.action == MouseAction.ButtonDown || event.action == MouseAction.Move) {
|
||||||
int x = event.x;
|
int x = event.x;
|
||||||
int y = event.y;
|
int y = event.y;
|
||||||
x -= _clientRect.left;
|
x -= _clientRect.left;
|
||||||
y -= _clientRect.top;
|
y -= _clientRect.top;
|
||||||
cellFound = pointToCell(x, y, c, r, rc);
|
cellFound = pointToCell(x, y, c, r, rc);
|
||||||
normalCell = c >= _headerCols && r >= _headerRows;
|
normalCell = c >= _headerCols && r >= _headerRows;
|
||||||
}
|
}
|
||||||
if (event.action == MouseAction.ButtonDown && event.button == MouseButton.Left) {
|
if (event.action == MouseAction.ButtonDown && event.button == MouseButton.Left) {
|
||||||
if (cellFound && normalCell) {
|
if (cellFound && normalCell) {
|
||||||
selectCell(c, r);
|
selectCell(c, r);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (event.action == MouseAction.Move && (event.flags & MouseFlag.LButton)) {
|
if (event.action == MouseAction.Move && (event.flags & MouseFlag.LButton)) {
|
||||||
// TODO: selection
|
// TODO: selection
|
||||||
if (cellFound && normalCell) {
|
if (cellFound && normalCell) {
|
||||||
selectCell(c, r);
|
selectCell(c, r);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (event.action == MouseAction.Wheel) {
|
if (event.action == MouseAction.Wheel) {
|
||||||
if (event.flags & MouseFlag.Shift)
|
if (event.flags & MouseFlag.Shift)
|
||||||
scrollBy(-event.wheelDelta, 0);
|
scrollBy(-event.wheelDelta, 0);
|
||||||
else
|
else
|
||||||
scrollBy(0, -event.wheelDelta);
|
scrollBy(0, -event.wheelDelta);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onMouseEvent(event);
|
return super.onMouseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// calculate scrollable area info
|
/// calculate scrollable area info
|
||||||
protected void calcScrollableAreaPos() {
|
protected void calcScrollableAreaPos() {
|
||||||
_maxScrollCol = _maxScrollRow = 0;
|
_maxScrollCol = _maxScrollRow = 0;
|
||||||
_fullyVisibleCells.left = _headerCols + _fixedCols + _scrollCol;
|
_fullyVisibleCells.left = _headerCols + _fixedCols + _scrollCol;
|
||||||
_fullyVisibleCells.top = _headerRows + _fixedRows + _scrollRow;
|
_fullyVisibleCells.top = _headerRows + _fixedRows + _scrollRow;
|
||||||
Rect rc;
|
Rect rc;
|
||||||
int xx = 0;
|
int xx = 0;
|
||||||
for (int i = 0; i < _cols && xx < _clientRect.width; i++) {
|
for (int i = 0; i < _cols && xx < _clientRect.width; i++) {
|
||||||
|
|
@ -607,12 +607,12 @@ class GridWidgetBase : WidgetGroup, OnScrollHandler {
|
||||||
yy += w;
|
yy += w;
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxVisibleScrollWidth = _clientRect.width - _fullyVisibleCellsRect.left;
|
int maxVisibleScrollWidth = _clientRect.width - _fullyVisibleCellsRect.left;
|
||||||
int maxVisibleScrollHeight = _clientRect.height - _fullyVisibleCellsRect.top;
|
int maxVisibleScrollHeight = _clientRect.height - _fullyVisibleCellsRect.top;
|
||||||
if (maxVisibleScrollWidth < 0)
|
if (maxVisibleScrollWidth < 0)
|
||||||
maxVisibleScrollWidth = 0;
|
maxVisibleScrollWidth = 0;
|
||||||
if (maxVisibleScrollHeight < 0)
|
if (maxVisibleScrollHeight < 0)
|
||||||
maxVisibleScrollHeight = 0;
|
maxVisibleScrollHeight = 0;
|
||||||
|
|
||||||
|
|
||||||
// calc scroll area in pixels
|
// calc scroll area in pixels
|
||||||
|
|
@ -632,17 +632,17 @@ class GridWidgetBase : WidgetGroup, OnScrollHandler {
|
||||||
if (i >= _fullyVisibleCells.left) {
|
if (i >= _fullyVisibleCells.left) {
|
||||||
_visibleScrollableArea.right = xx;
|
_visibleScrollableArea.right = xx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xx = 0;
|
xx = 0;
|
||||||
for (int i = _cols - 1; i >= _headerCols + _fixedCols; i--) {
|
for (int i = _cols - 1; i >= _headerCols + _fixedCols; i--) {
|
||||||
int w = _colWidths[i];
|
int w = _colWidths[i];
|
||||||
if (xx + w > maxVisibleScrollWidth) {
|
if (xx + w > maxVisibleScrollWidth) {
|
||||||
_fullScrollableArea.right += maxVisibleScrollWidth - xx;
|
_fullScrollableArea.right += maxVisibleScrollWidth - xx;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_maxScrollCol = i - _headerCols - _fixedCols;
|
_maxScrollCol = i - _headerCols - _fixedCols;
|
||||||
xx += w;
|
xx += w;
|
||||||
}
|
}
|
||||||
yy = 0;
|
yy = 0;
|
||||||
for (int i = 0; i < _rows; i++) {
|
for (int i = 0; i < _rows; i++) {
|
||||||
if (i == _headerRows + _fixedRows) {
|
if (i == _headerRows + _fixedRows) {
|
||||||
|
|
@ -659,26 +659,26 @@ class GridWidgetBase : WidgetGroup, OnScrollHandler {
|
||||||
if (i >= _fullyVisibleCells.top) {
|
if (i >= _fullyVisibleCells.top) {
|
||||||
_visibleScrollableArea.bottom = yy;
|
_visibleScrollableArea.bottom = yy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
yy = 0;
|
yy = 0;
|
||||||
for (int i = _rows - 1; i >= _headerRows + _fixedRows; i--) {
|
for (int i = _rows - 1; i >= _headerRows + _fixedRows; i--) {
|
||||||
int w = _rowHeights[i];
|
int w = _rowHeights[i];
|
||||||
if (yy + w > maxVisibleScrollHeight) {
|
if (yy + w > maxVisibleScrollHeight) {
|
||||||
_fullScrollableArea.bottom += maxVisibleScrollHeight - yy;
|
_fullScrollableArea.bottom += maxVisibleScrollHeight - yy;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_maxScrollRow = i - _headerRows - _fixedRows;
|
_maxScrollRow = i - _headerRows - _fixedRows;
|
||||||
yy += w;
|
yy += w;
|
||||||
}
|
}
|
||||||
// crop scroll area by client rect
|
// crop scroll area by client rect
|
||||||
//if (visibleScrollableArea.width > maxVisibleScrollWidth)
|
//if (visibleScrollableArea.width > maxVisibleScrollWidth)
|
||||||
_visibleScrollableArea.right = _visibleScrollableArea.left + maxVisibleScrollWidth;
|
_visibleScrollableArea.right = _visibleScrollableArea.left + maxVisibleScrollWidth;
|
||||||
//if (visibleScrollableArea.height > maxVisibleScrollHeight)
|
//if (visibleScrollableArea.height > maxVisibleScrollHeight)
|
||||||
_visibleScrollableArea.bottom = _visibleScrollableArea.top + maxVisibleScrollHeight;
|
_visibleScrollableArea.bottom = _visibleScrollableArea.top + maxVisibleScrollHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int _maxScrollCol;
|
protected int _maxScrollCol;
|
||||||
protected int _maxScrollRow;
|
protected int _maxScrollRow;
|
||||||
protected Rect _fullyVisibleCells;
|
protected Rect _fullyVisibleCells;
|
||||||
protected Rect _fullyVisibleCellsRect;
|
protected Rect _fullyVisibleCellsRect;
|
||||||
protected Rect _fullScrollableArea;
|
protected Rect _fullScrollableArea;
|
||||||
|
|
@ -711,26 +711,26 @@ class GridWidgetBase : WidgetGroup, OnScrollHandler {
|
||||||
scrollBy(-1, 0);
|
scrollBy(-1, 0);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.Left:
|
case GridActions.Left:
|
||||||
selectCell(_col - 1, _row);
|
selectCell(_col - 1, _row);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.ScrollRight:
|
case GridActions.ScrollRight:
|
||||||
scrollBy(1, 0);
|
scrollBy(1, 0);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.Right:
|
case GridActions.Right:
|
||||||
selectCell(_col + 1, _row);
|
selectCell(_col + 1, _row);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.ScrollUp:
|
case GridActions.ScrollUp:
|
||||||
scrollBy(0, -1);
|
scrollBy(0, -1);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.Up:
|
case GridActions.Up:
|
||||||
selectCell(_col, _row - 1);
|
selectCell(_col, _row - 1);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.ScrollDown:
|
case GridActions.ScrollDown:
|
||||||
if (_fullyVisibleCells.bottom < _rows - 1)
|
if (_fullyVisibleCells.bottom < _rows - 1)
|
||||||
scrollBy(0, 1);
|
scrollBy(0, 1);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.Down:
|
case GridActions.Down:
|
||||||
selectCell(_col, _row + 1);
|
selectCell(_col, _row + 1);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.ScrollPageLeft:
|
case GridActions.ScrollPageLeft:
|
||||||
// scroll left cell by cell
|
// scroll left cell by cell
|
||||||
|
|
@ -766,18 +766,18 @@ class GridWidgetBase : WidgetGroup, OnScrollHandler {
|
||||||
return true;
|
return true;
|
||||||
case GridActions.LineBegin:
|
case GridActions.LineBegin:
|
||||||
if (_scrollCol > 0 && _col > _headerCols + _fixedCols + _scrollCol && !_rowSelect)
|
if (_scrollCol > 0 && _col > _headerCols + _fixedCols + _scrollCol && !_rowSelect)
|
||||||
selectCell(_headerCols + _fixedCols + _scrollCol, _row);
|
selectCell(_headerCols + _fixedCols + _scrollCol, _row);
|
||||||
else {
|
else {
|
||||||
if (_scrollCol > 0) {
|
if (_scrollCol > 0) {
|
||||||
_scrollCol = 0;
|
_scrollCol = 0;
|
||||||
updateScrollBars();
|
updateScrollBars();
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
selectCell(_headerCols, _row);
|
selectCell(_headerCols, _row);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case GridActions.LineEnd:
|
case GridActions.LineEnd:
|
||||||
selectCell(_cols - 1, _row);
|
selectCell(_cols - 1, _row);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.DocumentBegin:
|
case GridActions.DocumentBegin:
|
||||||
if (_scrollRow > 0) {
|
if (_scrollRow > 0) {
|
||||||
|
|
@ -785,16 +785,16 @@ class GridWidgetBase : WidgetGroup, OnScrollHandler {
|
||||||
updateScrollBars();
|
updateScrollBars();
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
selectCell(_col, _headerRows);
|
selectCell(_col, _headerRows);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.DocumentEnd:
|
case GridActions.DocumentEnd:
|
||||||
selectCell(_col, _rows - 1);
|
selectCell(_col, _rows - 1);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.PageBegin:
|
case GridActions.PageBegin:
|
||||||
if (_scrollRow > 0)
|
if (_scrollRow > 0)
|
||||||
selectCell(_col, _headerRows + _fixedRows + _scrollRow);
|
selectCell(_col, _headerRows + _fixedRows + _scrollRow);
|
||||||
else
|
else
|
||||||
selectCell(_col, _headerRows);
|
selectCell(_col, _headerRows);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.PageEnd:
|
case GridActions.PageEnd:
|
||||||
int found = -1;
|
int found = -1;
|
||||||
|
|
@ -806,7 +806,7 @@ class GridWidgetBase : WidgetGroup, OnScrollHandler {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (found >= 0)
|
if (found >= 0)
|
||||||
selectCell(_col, found);
|
selectCell(_col, found);
|
||||||
return true;
|
return true;
|
||||||
case GridActions.PageUp:
|
case GridActions.PageUp:
|
||||||
if (_row > _fullyVisibleCells.top) {
|
if (_row > _fullyVisibleCells.top) {
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,7 @@ class ListWidget : WidgetGroup, OnScrollHandler {
|
||||||
int sbsize = _orientation == Orientation.Vertical ? _scrollbar.measuredWidth : _scrollbar.measuredHeight;
|
int sbsize = _orientation == Orientation.Vertical ? _scrollbar.measuredWidth : _scrollbar.measuredHeight;
|
||||||
// measure children
|
// measure children
|
||||||
Point sz;
|
Point sz;
|
||||||
_sbsz.clear;
|
_sbsz.destroy();
|
||||||
for (int i = 0; i < itemCount; i++) {
|
for (int i = 0; i < itemCount; i++) {
|
||||||
Widget w = itemWidget(i);
|
Widget w = itemWidget(i);
|
||||||
if (w is null || w.visibility == Visibility.Gone) {
|
if (w is null || w.visibility == Visibility.Gone) {
|
||||||
|
|
|
||||||
|
|
@ -558,12 +558,12 @@ class Style {
|
||||||
destroy(item);
|
destroy(item);
|
||||||
item = null;
|
item = null;
|
||||||
}
|
}
|
||||||
_substates.clear();
|
_substates.destroy();
|
||||||
foreach(ref Style item; _children) {
|
foreach(ref Style item; _children) {
|
||||||
destroy(item);
|
destroy(item);
|
||||||
item = null;
|
item = null;
|
||||||
}
|
}
|
||||||
_children.clear();
|
_children.destroy();
|
||||||
_backgroundDrawable.clear();
|
_backgroundDrawable.clear();
|
||||||
_font.clear();
|
_font.clear();
|
||||||
debug(resalloc) _instanceCount--;
|
debug(resalloc) _instanceCount--;
|
||||||
|
|
@ -638,7 +638,7 @@ class Theme : Style {
|
||||||
destroy(item);
|
destroy(item);
|
||||||
item = null;
|
item = null;
|
||||||
}
|
}
|
||||||
_byId.clear();
|
_byId.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// create wrapper style which will have currentTheme.get(id) as parent instead of fixed parent - to modify some base style properties in widget
|
/// create wrapper style which will have currentTheme.get(id) as parent instead of fixed parent - to modify some base style properties in widget
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue