Changeset 211:00180515eb65
- Timestamp:
- 03/19/08 16:36:28
(6 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Update to SWT 3.3.2
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r150 |
r211 |
|
| 51 | 51 | static import tango.text.Unicode; |
|---|
| 52 | 52 | static import tango.text.convert.Format; |
|---|
| | 53 | import dwt.dwthelper.utils; |
|---|
| 53 | 54 | |
|---|
| 54 | 55 | /** |
|---|
| … | … | |
| 1087 | 1088 | break; |
|---|
| 1088 | 1089 | case DWT.Deactivate: |
|---|
| 1089 | | dropDown (false); |
|---|
| | 1090 | /* |
|---|
| | 1091 | * Bug in GTK. When the arrow button is pressed the popup control receives a |
|---|
| | 1092 | * deactivate event and then the arrow button receives a selection event. If |
|---|
| | 1093 | * we hide the popup in the deactivate event, the selection event will show |
|---|
| | 1094 | * it again. To prevent the popup from showing again, we will let the selection |
|---|
| | 1095 | * event of the arrow button hide the popup. |
|---|
| | 1096 | */ |
|---|
| | 1097 | if ("gtk".equals(DWT.getPlatform())) { |
|---|
| | 1098 | Point point = arrow.toControl(getDisplay().getCursorLocation()); |
|---|
| | 1099 | Point size = arrow.getSize(); |
|---|
| | 1100 | Rectangle rect = new Rectangle(0, 0, size.x, size.y); |
|---|
| | 1101 | if (!rect.contains(point)) dropDown (false); |
|---|
| | 1102 | } else { |
|---|
| | 1103 | dropDown(false); |
|---|
| | 1104 | } |
|---|
| 1090 | 1105 | break; |
|---|
| 1091 | 1106 | default: |
|---|
| r108 |
r211 |
|
| 1 | | /******************************************************************************* |
|---|
| | 1 | /******************************************************************************* |
|---|
| 2 | 2 | * Copyright (c) 2000, 2007 IBM Corporation and others. |
|---|
| 3 | 3 | * All rights reserved. This program and the accompanying materials |
|---|
| … | … | |
| 34 | 34 | * DWT Minor version number (must be in the range 0..999) |
|---|
| 35 | 35 | */ |
|---|
| 36 | | static const int MINOR_VERSION = 346; |
|---|
| | 36 | static const int MINOR_VERSION = 349; |
|---|
| 37 | 37 | |
|---|
| 38 | 38 | /** |
|---|
| r166 |
r211 |
|
| 1731 | 1731 | mixin ForwardGtkOsCFunc!(.gtk_paper_size_get_height); |
|---|
| 1732 | 1732 | mixin ForwardGtkOsCFunc!(.gtk_paper_size_is_custom); |
|---|
| | 1733 | mixin ForwardGtkOsCFunc!(.gtk_paper_size_free); |
|---|
| 1733 | 1734 | mixin ForwardGtkOsCFunc!(.gtk_plug_get_id); |
|---|
| 1734 | 1735 | mixin ForwardGtkOsCFunc!(.gtk_plug_new); |
|---|
| r200 |
r211 |
|
| 76 | 76 | static const char[] GTK_LPR_BACKEND = "GtkPrintBackendLpr"; //$NON-NLS-1$ |
|---|
| 77 | 77 | |
|---|
| | 78 | static const bool disablePrinting = false;// System.getProperty("dwt.internal.gtk.disablePrinting") !is null; //$NON-NLS-1$ |
|---|
| | 79 | |
|---|
| 78 | 80 | /** |
|---|
| 79 | 81 | * Returns an array of <code>PrinterData</code> objects |
|---|
| … | … | |
| 84 | 86 | public static PrinterData[] getPrinterList() { |
|---|
| 85 | 87 | printerList = new PrinterData [0]; |
|---|
| 86 | | if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0)) { |
|---|
| | 88 | if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0) || disablePrinting) { |
|---|
| 87 | 89 | return printerList; |
|---|
| 88 | 90 | } |
|---|
| … | … | |
| 120 | 122 | public static PrinterData getDefaultPrinterData() { |
|---|
| 121 | 123 | printerList = new PrinterData [1]; |
|---|
| 122 | | if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0)) { |
|---|
| | 124 | if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0) || disablePrinting) { |
|---|
| 123 | 125 | return null; |
|---|
| 124 | 126 | } |
|---|
| … | … | |
| 633 | 635 | protected override void create(DeviceData deviceData) { |
|---|
| 634 | 636 | this.data = cast(PrinterData)deviceData; |
|---|
| 635 | | if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0)) DWT.error(DWT.ERROR_NO_HANDLES); |
|---|
| | 637 | if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0) || disablePrinting) DWT.error(DWT.ERROR_NO_HANDLES); |
|---|
| 636 | 638 | printer = gtkPrinterFromPrinterData(); |
|---|
| 637 | 639 | if (printer is null) DWT.error(DWT.ERROR_NO_HANDLES); |
|---|
| … | … | |
| 699 | 701 | } |
|---|
| 700 | 702 | OS.gtk_page_setup_set_paper_size(pageSetup, paper_size); |
|---|
| 701 | | OS.g_free(paper_size); |
|---|
| | 703 | OS.gtk_paper_size_free(paper_size); |
|---|
| 702 | 704 | } |
|---|
| 703 | 705 | |
|---|
| r152 |
r211 |
|
| 678 | 678 | if (message.length !is 0) { |
|---|
| 679 | 679 | layoutMessage = OS.gtk_widget_create_pango_layout (handle, toStringz( message )); |
|---|
| | 680 | if (OS.GTK_VERSION >= OS.buildVERSION (2, 4, 0)) { |
|---|
| | 681 | OS.pango_layout_set_auto_dir (layoutMessage, false); |
|---|
| | 682 | } |
|---|
| 680 | 683 | OS.pango_layout_set_wrap (layoutMessage, OS.PANGO_WRAP_WORD_CHAR); |
|---|
| 681 | 684 | } |
|---|
| … | … | |
| 705 | 708 | if (text.length !is 0) { |
|---|
| 706 | 709 | layoutText = OS.gtk_widget_create_pango_layout (handle, toStringz(text)); |
|---|
| | 710 | if (OS.GTK_VERSION >= OS.buildVERSION (2, 4, 0)) { |
|---|
| | 711 | OS.pango_layout_set_auto_dir (layoutText, false); |
|---|
| | 712 | } |
|---|
| 707 | 713 | auto boldAttr = OS.pango_attr_weight_new (OS.PANGO_WEIGHT_BOLD); |
|---|
| 708 | 714 | boldAttr.start_index = 0; |
|---|
| r200 |
r211 |
|
| 2311 | 2311 | auto selection = OS.gtk_tree_view_get_selection (handle); |
|---|
| 2312 | 2312 | OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED); |
|---|
| | 2313 | /* |
|---|
| | 2314 | * Bug in GTK. In version 2.8, when gtk_tree_view_set_model() is called, GTK |
|---|
| | 2315 | * does not remove the timer used to show animation when expanding a node. This |
|---|
| | 2316 | * can cause two possible crashes. The first one happens when the timer expires and |
|---|
| | 2317 | * it accesses the expanding node which has been already destroyed. The second one |
|---|
| | 2318 | * happens if a new item is created and destroyed before the timer expires. The fix |
|---|
| | 2319 | * is to remove the timer by disposing the first item in the tree. |
|---|
| | 2320 | */ |
|---|
| | 2321 | if (OS.GTK_VERSION < OS.buildVERSION(2, 10, 0)) { |
|---|
| | 2322 | if (OS.gtk_tree_model_iter_n_children (modelHandle, null) !is 0) { |
|---|
| | 2323 | GtkTreeIter iter; |
|---|
| | 2324 | OS.gtk_tree_model_iter_nth_child (modelHandle, &iter, null, 0); |
|---|
| | 2325 | OS.gtk_tree_store_remove (modelHandle, &iter); |
|---|
| | 2326 | } |
|---|
| | 2327 | } |
|---|
| 2313 | 2328 | // TODO verify if true for tree store |
|---|
| 2314 | 2329 | //OS.gtk_tree_store_clear (modelHandle); |
|---|