From c618b6ccb1149daf91b89725e018ceab1175199d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 28 Aug 2012 20:32:46 +0200 Subject: [PATCH 01/21] input_server: use a generated cookie instead of pointer * fixed #8831 --- src/servers/input/AddOnManager.cpp | 2 +- src/servers/input/InputServer.cpp | 22 +++++++++++++++++----- src/servers/input/InputServer.h | 2 ++ src/servers/input/InputServerMethod.cpp | 20 ++++++++++++-------- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/servers/input/AddOnManager.cpp b/src/servers/input/AddOnManager.cpp index 0d75e6a942..867903c134 100644 --- a/src/servers/input/AddOnManager.cpp +++ b/src/servers/input/AddOnManager.cpp @@ -440,7 +440,7 @@ AddOnManager::_UnregisterAddOn(BEntry& entry) gInputServer->SetMethodReplicant(NULL); } else if (method != NULL) { BMessage msg(IS_REMOVE_METHOD); - msg.AddInt32("cookie", (uint32)method); + msg.AddInt32("cookie", method->fOwner->Cookie()); if (gInputServer->MethodReplicant()) gInputServer->MethodReplicant()->SendMessage(&msg); } diff --git a/src/servers/input/InputServer.cpp b/src/servers/input/InputServer.cpp index 685c548d4e..48ca839f1b 100644 --- a/src/servers/input/InputServer.cpp +++ b/src/servers/input/InputServer.cpp @@ -625,11 +625,23 @@ void InputServer::HandleSetMethod(BMessage* message) { CALLED(); - uint32 cookie; - if (message->FindInt32("cookie", (int32*)&cookie) == B_OK) { - BInputServerMethod *method = (BInputServerMethod*)cookie; - PRINT(("%s cookie %p\n", __PRETTY_FUNCTION__, method)); - SetActiveMethod(method); + int32 cookie; + if (message->FindInt32("cookie", &cookie) != B_OK) + return; + if (cookie == gKeymapMethod.fOwner->Cookie()) { + SetActiveMethod(&gKeymapMethod); + } else { + BAutolock lock(InputServer::gInputMethodListLocker); + for (int32 i = 0; i < gInputMethodList.CountItems(); i++) { + BInputServerMethod* method + = (BInputServerMethod*)InputServer::gInputMethodList.ItemAt(i); + if (method->fOwner->Cookie() == cookie) { + PRINT(("%s cookie %" B_PRId32 "\n", __PRETTY_FUNCTION__, + cookie)); + SetActiveMethod(method); + break; + } + } } } diff --git a/src/servers/input/InputServer.h b/src/servers/input/InputServer.h index 7b70b330ed..43f540c986 100644 --- a/src/servers/input/InputServer.h +++ b/src/servers/input/InputServer.h @@ -99,6 +99,7 @@ class _BMethodAddOn_ { status_t SetMenu(const BMenu* menu, const BMessenger& messenger); status_t MethodActivated(bool activate); status_t AddMethod(); + int32 Cookie() { return fCookie; } private: BInputServerMethod* fMethod; @@ -106,6 +107,7 @@ class _BMethodAddOn_ { uchar fIcon[16*16*1]; const BMenu* fMenu; BMessenger fMessenger; + int32 fCookie; }; class KeymapMethod : public BInputServerMethod { diff --git a/src/servers/input/InputServerMethod.cpp b/src/servers/input/InputServerMethod.cpp index 06adee4289..6333dc5ec0 100644 --- a/src/servers/input/InputServerMethod.cpp +++ b/src/servers/input/InputServerMethod.cpp @@ -153,10 +153,14 @@ BInputServerMethod::_ReservedInputServerMethod4() } +static int32 sNextMethodCookie = 1; + + _BMethodAddOn_::_BMethodAddOn_(BInputServerMethod *method, const char *name, const uchar *icon) : fMethod(method), - fMenu(NULL) + fMenu(NULL), + fCookie(sNextMethodCookie++) { fName = strdup(name); if (icon != NULL) @@ -183,7 +187,7 @@ _BMethodAddOn_::SetName(const char* name) fName = strdup(name); BMessage msg(IS_UPDATE_NAME); - msg.AddInt32("cookie", (uint32)fMethod); + msg.AddInt32("cookie", fCookie); msg.AddString("name", name); if (((InputServer*)be_app)->MethodReplicant()) return ((InputServer*)be_app)->MethodReplicant()->SendMessage(&msg); @@ -203,7 +207,7 @@ _BMethodAddOn_::SetIcon(const uchar* icon) memset(fIcon, 0x1d, 16*16*1); BMessage msg(IS_UPDATE_ICON); - msg.AddInt32("cookie", (uint32)fMethod); + msg.AddInt32("cookie", fCookie); msg.AddData("icon", B_RAW_TYPE, icon, 16*16*1); if (((InputServer*)be_app)->MethodReplicant()) return ((InputServer*)be_app)->MethodReplicant()->SendMessage(&msg); @@ -220,7 +224,7 @@ _BMethodAddOn_::SetMenu(const BMenu *menu, const BMessenger &messenger) fMessenger = messenger; BMessage msg(IS_UPDATE_MENU); - msg.AddInt32("cookie", (uint32)fMethod); + msg.AddInt32("cookie", fCookie); BMessage menuMsg; if (menu) menu->Archive(&menuMsg); @@ -238,10 +242,10 @@ _BMethodAddOn_::MethodActivated(bool activate) { CALLED(); if (fMethod) { - PRINT(("%s cookie %p\n", __PRETTY_FUNCTION__, fMethod)); + PRINT(("%s cookie %" B_PRId32 "\n", __PRETTY_FUNCTION__, fCookie)); if (activate && ((InputServer*)be_app)->MethodReplicant()) { BMessage msg(IS_UPDATE_METHOD); - msg.AddInt32("cookie", (uint32)fMethod); + msg.AddInt32("cookie", fCookie); ((InputServer*)be_app)->MethodReplicant()->SendMessage(&msg); } return fMethod->MethodActivated(activate); @@ -253,9 +257,9 @@ _BMethodAddOn_::MethodActivated(bool activate) status_t _BMethodAddOn_::AddMethod() { - PRINT(("%s cookie %p\n", __PRETTY_FUNCTION__, fMethod)); + PRINT(("%s cookie %" B_PRId32 "\n", __PRETTY_FUNCTION__, fCookie)); BMessage msg(IS_ADD_METHOD); - msg.AddInt32("cookie", (uint32)fMethod); + msg.AddInt32("cookie", fCookie); msg.AddString("name", fName); msg.AddData("icon", B_RAW_TYPE, fIcon, 16*16*1); if (((InputServer*)be_app)->MethodReplicant()) From 17ce10a7705b461cf635816658a08c3e4e28b8b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 29 Aug 2012 20:44:42 +0200 Subject: [PATCH 02/21] fix libpng link introduced in 61cb4d8c6d4b2733a53c3a3f9781bc3ee7e8c4ef --- build/jam/OptionalBuildFeatures | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures index 7b25759ddc..a5ea033db1 100644 --- a/build/jam/OptionalBuildFeatures +++ b/build/jam/OptionalBuildFeatures @@ -535,7 +535,7 @@ if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 { : extracted-libpng ] ; Depends $(HAIKU_LIBPNG_LIB) $(HAIKU_LIBPNG_CURRENT_LIB) : $(HAIKU_LIBPNG_HEADERS_DEPENDENCY) ; - HAIKU_LIBPNG_CURRENT_LINK = libpng.so.15 ; + HAIKU_LIBPNG_CURRENT_LINK = libpng15.so.15 ; HAIKU_LIBPNG_HEADERS = [ FDirName $(HAIKU_LIBPNG_DIR) common include ] ; } else { From 19187c464b4598774f731cd015c4fbc893c25348 Mon Sep 17 00:00:00 2001 From: Yongcong Du Date: Tue, 3 Apr 2012 23:46:51 +0800 Subject: [PATCH 03/21] x86: Initialize IA32_MSR_ENERGY_PERF_BIAS The lowest 4 bits of the MSR serves as a hint to the hardware to favor performance or energy saving. 0 means a hint preference for highest performance while 15 corresponds to the maximum energy savings. A value of 7 translates into a hint to balance performance with energy savings. The default reset value of the MSR is 0. If BIOS doesn't intialize the MSR, the hardware will run in performance state. This patch initialize the MSR with value of 7 for balance between performance and energy savings Signed-off-by: Fredrik Holmqvist --- headers/private/kernel/arch/x86/arch_cpu.h | 1 + src/system/kernel/arch/x86/arch_cpu.cpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/headers/private/kernel/arch/x86/arch_cpu.h b/headers/private/kernel/arch/x86/arch_cpu.h index 4365fe13ca..2ce6bd0b4d 100644 --- a/headers/private/kernel/arch/x86/arch_cpu.h +++ b/headers/private/kernel/arch/x86/arch_cpu.h @@ -29,6 +29,7 @@ #define IA32_MSR_SYSENTER_CS 0x174 #define IA32_MSR_SYSENTER_ESP 0x175 #define IA32_MSR_SYSENTER_EIP 0x176 +#define IA32_MSR_ENERGY_PERF_BIAS 0x1b0 #define IA32_MSR_MTRR_DEFAULT_TYPE 0x2ff #define IA32_MSR_MTRR_PHYSICAL_BASE_0 0x200 #define IA32_MSR_MTRR_PHYSICAL_MASK_0 0x201 diff --git a/src/system/kernel/arch/x86/arch_cpu.cpp b/src/system/kernel/arch/x86/arch_cpu.cpp index 09359b64a4..08f0ed2b27 100644 --- a/src/system/kernel/arch/x86/arch_cpu.cpp +++ b/src/system/kernel/arch/x86/arch_cpu.cpp @@ -70,6 +70,16 @@ static const struct cpu_vendor_info vendor_info[VENDOR_NUM] = { #define K8_CMPHALT (K8_SMIONCMPHALT | K8_C1EONCMPHALT) +/* + * 0 favors highest performance while 15 corresponds to the maximum energy + * savings. 7 means balance between performance and energy savings. + * Refer to Section 14.3.4 in for details + */ +#define ENERGY_PERF_BIAS_PERFORMANCE 0 +#define ENERGY_PERF_BIAS_BALANCE 7 +#define ENERGY_PERF_BIAS_POWERSAVE 15 + struct set_mtrr_parameter { int32 index; uint64 base; @@ -787,6 +797,16 @@ arch_cpu_init_percpu(kernel_args *args, int cpu) else gCpuIdleFunc = halt_idle; } + + if (x86_check_feature(IA32_FEATURE_EPB, FEATURE_6_ECX)) { + uint64 msr = x86_read_msr(IA32_MSR_ENERGY_PERF_BIAS); + if ((msr & 0xf) == ENERGY_PERF_BIAS_PERFORMANCE) { + msr &= ~0xf; + msr |= ENERGY_PERF_BIAS_BALANCE; + x86_write_msr(IA32_MSR_ENERGY_PERF_BIAS, msr); + } + } + return 0; } From b7bb5837791de5bae2f089a579d6bd063b7dbc51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 29 Aug 2012 23:33:35 +0200 Subject: [PATCH 04/21] hda: mixer and audio paths fixes * avoid mixing input and output paths when building a tree. In fact, an audio input shouldn't use only a mixer used for output. * in case an audio input has more than one input, use these inputs to build a mux control. * should help with #8270, #8333 --- src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp | 6 ++++-- .../kernel/drivers/audio/hda/hda_multi_audio.cpp | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp b/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp index 74de641206..2c6f85b9ee 100644 --- a/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp +++ b/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp @@ -897,7 +897,8 @@ hda_widget_find_input_path(hda_audio_group* audioGroup, hda_widget* widget, switch (widget->type) { case WT_PIN_COMPLEX: // already used - if (widget->flags & WIDGET_FLAG_INPUT_PATH) + if ((widget->flags & (WIDGET_FLAG_INPUT_PATH + | WIDGET_FLAG_OUTPUT_PATH)) != 0) return false; if (PIN_CAP_IS_INPUT(widget->d.pin.capabilities)) { @@ -917,7 +918,8 @@ TRACE(" %*sinput: added input widget %ld\n", (int)depth * 2, "", widget->no case WT_AUDIO_SELECTOR: { // already used - if (widget->flags & WIDGET_FLAG_INPUT_PATH) + if ((widget->flags & (WIDGET_FLAG_INPUT_PATH + | WIDGET_FLAG_OUTPUT_PATH)) != 0) return false; // search for pin complex in this path diff --git a/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp b/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp index 14fcd56871..0c50f8b1b0 100644 --- a/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp +++ b/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp @@ -442,7 +442,7 @@ hda_create_control_for_complex(hda_multi* multi, uint32* index, uint32 parent, return; } - if ((widget.type & WT_AUDIO_MIXER) != 0) { + if (widget.type == WT_AUDIO_MIXER) { hda_create_channel_control(multi, index, parent, 0, widget, true, widget.capabilities.input_amplifier, 0, gain, mute); if (!gain && !mute) { @@ -451,8 +451,7 @@ hda_create_control_for_complex(hda_multi* multi, uint32* index, uint32 parent, } } - if ((widget.type & WT_AUDIO_OUTPUT) == 0 - && widget.num_inputs > 0) { + if (widget.type != WT_AUDIO_OUTPUT && widget.num_inputs > 0) { hda_widget& child = *hda_audio_group_get_widget(audioGroup, widget.inputs[widget.active_input]); hda_create_control_for_complex(multi, index, parent, child, gain, mute); @@ -543,6 +542,12 @@ hda_create_controls_list(hda_multi* multi) hda_create_channel_control(multi, &index, parent2, 0, widget, true, capabilities, 0, gain, mute); + if (widget.num_inputs > 1) { + TRACE(" create mux for nid %lu\n", widget.node_id); + hda_create_mux_control(multi, &index, parent2, widget); + continue; + } + hda_widget *mixer = hda_audio_group_get_widget(audioGroup, widget.inputs[0]); if (mixer->type != WT_AUDIO_MIXER && mixer->type != WT_AUDIO_SELECTOR) From 992c945afe166a71d08222f2e036a65bbe175caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 30 Aug 2012 23:43:27 +0200 Subject: [PATCH 05/21] hda: later specification updates --- .../kernel/drivers/audio/hda/hda_codec.cpp | 1 + .../kernel/drivers/audio/hda/hda_codec_defs.h | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp b/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp index 2c6f85b9ee..66fd766df1 100644 --- a/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp +++ b/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp @@ -159,6 +159,7 @@ dump_widget_audio_capabilities(uint32 capabilities) uint32 flag; const char* name; } kFlags[] = { + {AUDIO_CAP_CP_CAPS, "CP caps"}, {AUDIO_CAP_LEFT_RIGHT_SWAP, "L-R swap"}, {AUDIO_CAP_POWER_CONTROL, "Power"}, {AUDIO_CAP_DIGITAL, "Digital"}, diff --git a/src/add-ons/kernel/drivers/audio/hda/hda_codec_defs.h b/src/add-ons/kernel/drivers/audio/hda/hda_codec_defs.h index 1c4d021f88..94797c2f71 100644 --- a/src/add-ons/kernel/drivers/audio/hda/hda_codec_defs.h +++ b/src/add-ons/kernel/drivers/audio/hda/hda_codec_defs.h @@ -125,6 +125,21 @@ enum pin_dev_type { #define VID_GET_STRIPE_CONTROL 0xf2400 #define VID_SET_STRIPE_CONTROL 0x72000 #define VID_FUNCTION_RESET 0x7ff00 +/* later specification updates */ +#define VID_GET_EDID_LIKE_DATA 0xf2f00 +#define VID_GET_CONVERTER_CHANNEL_COUNT 0xf2d00 +#define VID_SET_CONVERTER_CHANNEL_COUNT 0x72d00 +#define VID_GET_DATA_ISLAND_PACKET_SIZE 0xf2e00 +#define VID_GET_DATA_ISLAND_PACKET_INDEX 0xf3000 +#define VID_SET_DATA_ISLAND_PACKET_INDEX 0x73000 +#define VID_GET_DATA_ISLAND_PACKET_DATA 0xf3100 +#define VID_SET_DATA_ISLAND_PACKET_DATA 0x73100 +#define VID_GET_DATA_ISLAND_PACKET_XMITCTRL 0xf3200 +#define VID_SET_DATA_ISLAND_PACKET_XMITCTRL 0x73200 +#define VID_GET_CONTENT_PROTECTION_CONTROL 0xf3300 +#define VID_SET_CONTENT_PROTECTION_CONTROL 0x73300 +#define VID_GET_ASP_CHANNEL_MAPPING 0xf3400 +#define VID_SET_ASP_CHANNEL_MAPPING 0x73400 /* Parameter IDs */ #define PID_VENDOR_ID 0x00 @@ -179,6 +194,8 @@ enum pin_dev_type { /* Audio widget capabilities */ +#define AUDIO_CAP_CHANNEL_COUNT_MASK 0x0000e000 +#define AUDIO_CAP_CHANNEL_COUNT_SHIFT 13 #define AUDIO_CAP_DELAY_MASK 0x000f0000 #define AUDIO_CAP_DELAY_SHIFT 16 #define AUDIO_CAP_TYPE_MASK 0x00f00000 @@ -196,6 +213,11 @@ enum pin_dev_type { #define AUDIO_CAP_DIGITAL (1L << 9) #define AUDIO_CAP_POWER_CONTROL (1L << 10) #define AUDIO_CAP_LEFT_RIGHT_SWAP (1L << 11) +#define AUDIO_CAP_CP_CAPS (1L << 12) + +#define AUDIO_CAP_CHANNEL_COUNT(c) \ + (((c & AUDIO_CAP_CHANNEL_COUNT_MASK) >> (AUDIO_CAP_CHANNEL_COUNT_SHIFT - 1)) \ + | AUDIO_CAP_STEREO) /* Amplifier capabilities */ #define AMP_CAP_MUTE 0xf0000000 @@ -219,20 +241,27 @@ enum pin_dev_type { #define PIN_CAP_OUTPUT (1L << 4) #define PIN_CAP_INPUT (1L << 5) #define PIN_CAP_BALANCE (1L << 6) +#define PIN_CAP_HDMI (1L << 7) #define PIN_CAP_VREF_CTRL_HIZ (1L << 8) #define PIN_CAP_VREF_CTRL_50 (1L << 9) #define PIN_CAP_VREF_CTRL_GROUND (1L << 10) #define PIN_CAP_VREF_CTRL_80 (1L << 12) #define PIN_CAP_VREF_CTRL_100 (1L << 13) #define PIN_CAP_EAPD_CAP (1L << 16) +#define PIN_CAP_DP (1L << 24) +#define PIN_CAP_HBR (1L << 27) #define PIN_CAP_IS_PRES_DETECT_CAP(c) ((c & PIN_CAP_PRES_DETECT) != 0) #define PIN_CAP_IS_OUTPUT(c) ((c & PIN_CAP_OUTPUT) != 0) #define PIN_CAP_IS_INPUT(c) ((c & PIN_CAP_INPUT) != 0) +#define PIN_CAP_IS_BALANCE(c) ((c & PIN_CAP_BALANCE) != 0) +#define PIN_CAP_IS_HDMI(c) ((c & PIN_CAP_HDMI) != 0) #define PIN_CAP_IS_VREF_CTRL_50_CAP(c) ((c & PIN_CAP_VREF_CTRL_50) != 0) #define PIN_CAP_IS_VREF_CTRL_80_CAP(c) ((c & PIN_CAP_VREF_CTRL_80) != 0) #define PIN_CAP_IS_VREF_CTRL_100_CAP(c) ((c & PIN_CAP_VREF_CTRL_100) != 0) #define PIN_CAP_IS_EAPD_CAP(c) ((c & PIN_CAP_EAPD_CAP) != 0) +#define PIN_CAP_IS_DP(c) ((c & PIN_CAP_DP) != 0) +#define PIN_CAP_IS_HBR(c) ((c & PIN_CAP_HBR) != 0) /* PCM support */ #define PCM_8_BIT (1L << 16) @@ -280,9 +309,18 @@ enum pin_dev_type { /* Unsolicited Response */ #define UNSOLRESP_ENABLE (1L << 7) +#define UNSOLRESP_TAG_MASK 0x0000003f +#define UNSOLRESP_TAG_SHIFT 0 /* Pin sense */ #define PIN_SENSE_PRESENCE_DETECT (1L << 31) +#define PIN_SENSE_ELD_VALID (1L << 30) +#define PIN_SENSE_IMPEDANCE_MASK 0x7fffffff +#define PIN_SENSE_IMPEDANCE_SHIFT 0 + +#define PIN_SENSE_IMPEDANCE_INVALID 0x7fffffff +#define PIN_SENSE_SET_CHANNEL_LEFT 0 +#define PIN_SENSE_SET_CHANNEL_RIGHT 1 /* Supported power states */ #define POWER_STATE_D0 (1L << 0) From 61306f15a11bfb9adf58f721c89fff135ce44cd6 Mon Sep 17 00:00:00 2001 From: Scott McCreary Date: Fri, 31 Aug 2012 00:07:26 -0700 Subject: [PATCH 06/21] Rebuilt many OptionalPackages for R1A4 --- build/jam/OptionalBuildFeatures | 6 +- build/jam/OptionalPackages | 405 ++++++++++++++++---------------- 2 files changed, 206 insertions(+), 205 deletions(-) diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures index a5ea033db1..7a60489dd7 100644 --- a/build/jam/OptionalBuildFeatures +++ b/build/jam/OptionalBuildFeatures @@ -23,9 +23,9 @@ if [ IsOptionalHaikuImagePackageAdded OpenSSL ] { } if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-x86-gcc4-2012-06-19.zip ; + HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-r1a4-x86-gcc4-2012-08-29.zip ; } else { - HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-x86-gcc2-2012-06-19.zip ; + HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-r1a4-x86-gcc2-2012-08-26.zip ; } HAIKU_OPENSSL_URL = $(baseURL)/$(HAIKU_OPENSSL_PACKAGE) ; @@ -382,7 +382,7 @@ if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 { } else if $(HAIKU_GCC_VERSION[1]) >= 4 { HAIKU_FREETYPE_FILE = freetype-2.4.9-x86-gcc4-2012-06-15.zip ; } else { - HAIKU_FREETYPE_FILE = freetype-2.4.9-x86-gcc2-2012-06-19.zip ; + HAIKU_FREETYPE_FILE = freetype-2.4.9-r1a4-x86-gcc2-2012-08-28.zip ; } local freetypeZipFile = [ DownloadFile $(HAIKU_FREETYPE_FILE) diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 6f88062622..77acc4dc9d 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -126,13 +126,13 @@ if [ IsOptionalHaikuImagePackageAdded APR ] { Echo "No optional package APR available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - apr-1.4.6-x86-gcc4-2012-06-19.zip - : $(baseURL)/apr-1.4.6-x86-gcc4-2012-06-19.zip + apr-1.4.6-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/apr-1.4.6-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - apr-1.4.6-x86-gcc2-2012-06-19.zip - : $(baseURL)/apr-1.4.6-x86-gcc2-2012-06-19.zip + apr-1.4.6-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/apr-1.4.6-r1a4-x86-gcc2-2012-08-27.zip : : true ; } } @@ -144,13 +144,13 @@ if [ IsOptionalHaikuImagePackageAdded APR-util ] { Echo "No optional package APR-util available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - apr-util-1.4.1-x86-gcc4-2012-06-19.zip - : $(baseURL)/apr-util-1.4.1-x86-gcc4-2012-06-19.zip + apr-util-1.4.1-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/apr-util-1.4.1-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - apr-util-1.4.1-x86-gcc2-2012-06-19.zip - : $(baseURL)/apr-util-1.4.1-x86-gcc2-2012-06-19.zip + apr-util-1.4.1-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/apr-util-1.4.1-r1a4-x86-gcc2-2012-08-27.zip : : true ; } } @@ -164,8 +164,8 @@ if [ IsOptionalHaikuImagePackageAdded ArmyKnife ] { Echo "No optional package ArmyKnife for gcc4" ; } else { InstallOptionalHaikuImagePackage - armyknife-63-r1a3-x86-gcc2-2011-06-04.zip - : $(baseURL)/armyknife-63-r1a3-x86-gcc2-2011-06-04.zip ; + armyknife-63-r1a4-x86-gcc2-2012-08-30.zip + : $(baseURL)/armyknife-63-r1a4-x86-gcc2-2012-08-30.zip ; AddSymlinkToHaikuImage home config settings deskbar Applications : /boot/apps/ArmyKnife/ArmyKnife ; } @@ -177,11 +177,11 @@ if [ IsOptionalHaikuImagePackageAdded Bazaar ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Bazaar available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage bzr-2.5.1-x86-gcc4-2012-06-22.zip - : $(baseURL)/bzr-2.5.1-x86-gcc4-2012-06-22.zip ; + InstallOptionalHaikuImagePackage bzr-2.6b1-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/bzr-2.6b1-r1a4-x86-gcc4-2012-08-30.zip ; } else { - InstallOptionalHaikuImagePackage bzr-2.5.1-x86-gcc2-2012-06-22.zip - : $(baseURL)/bzr-2.5.1-x86-gcc2-2012-06-22.zip ; + InstallOptionalHaikuImagePackage bzr-2.5.1-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/bzr-2.5.1-r1a4-x86-gcc2-2012-08-27.zip ; } } @@ -193,12 +193,12 @@ if [ IsOptionalHaikuImagePackageAdded BeAE ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - beae-22-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/beae-22-r1a3-x86-gcc4-2011-05-24.zip ; + beae-22-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/beae-22-r1a4-x86-gcc4-2012-08-30.zip ; } else { InstallOptionalHaikuImagePackage - beae-22-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/beae-22-r1a3-x86-gcc2-2011-05-18.zip ; + beae-22-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/beae-22-r1a4-x86-gcc2-2012-08-27.zip ; } AddSymlinkToHaikuImage home config settings deskbar Applications : /boot/apps/BeAE/BeAE ; @@ -217,8 +217,8 @@ if [ IsOptionalHaikuImagePackageAdded Beam ] { : $(baseURL)/beam-1.2alpha-x86-gcc4-2012-08-11.zip ; } else { InstallOptionalHaikuImagePackage - Beam-1.2alpha-x86-gcc2-2012-06-04.zip - : $(baseURL)/Beam-1.2alpha-x86-gcc2-2012-06-04.zip ; + beam-1.2alpha-r1a4-x86-gcc2-2012-08-29.zip + : $(baseURL)/beam-1.2alpha-r1a4-x86-gcc2-2012-08-29.zip ; } AddSymlinkToHaikuImage home config settings deskbar Applications : /boot/apps/Beam/Beam ; @@ -280,8 +280,8 @@ if [ IsOptionalHaikuImagePackageAdded BePDF ] { : $(baseURL)/bepdf-1.1.1b4-x86-gcc4-2012-08-11.zip ; } else { InstallOptionalHaikuImagePackage - bepdf-1.1.1b4-r1a3-x86-gcc2-2011-05-30.zip - : $(baseURL)/bepdf-1.1.1b4-r1a3-x86-gcc2-2011-05-30.zip ; + bepdf-1.1.1b4-r1a4-x86-gcc2-2012-08-30.zip + : $(baseURL)/bepdf-1.1.1b4-r1a4-x86-gcc2-2012-08-30.zip ; } AddSymlinkToHaikuImage home config settings deskbar Applications : /boot/apps/BePDF/BePDF ; @@ -338,12 +338,12 @@ if [ IsOptionalHaikuImagePackageAdded BurnItNow ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - burnitnow-39-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/burnitnow-39-r1a3-x86-gcc4-2011-05-24.zip ; + burnitnow-39-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/burnitnow-39-r1a4-x86-gcc4-2012-08-30.zip ; } else { InstallOptionalHaikuImagePackage - burnitnow-39-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/burnitnow-39-r1a3-x86-gcc2-2011-05-18.zip ; + burnitnow-39-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/burnitnow-39-r1a4-x86-gcc2-2012-08-27.zip ; } AddSymlinkToHaikuImage home config settings deskbar Applications : /boot/apps/BurnItNow/BurnItNow ; @@ -357,13 +357,13 @@ if [ IsOptionalHaikuImagePackageAdded Bzip ] { Echo "No optional package Bzip available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - bzip2-1.0.6-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/bzip2-1.0.6-r1a3-x86-gcc4-2011-05-24.zip + bzip2-1.0.6-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/bzip2-1.0.6-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - bzip2-1.0.6-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/bzip2-1.0.6-r1a3-x86-gcc2-2011-05-17.zip + bzip2-1.0.6-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/bzip2-1.0.6-r1a4-x86-gcc2-2012-08-27.zip : : true ; } } @@ -405,12 +405,12 @@ if [ IsOptionalHaikuImagePackageAdded CCache ] { Echo "No optional package CCache available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - ccache-3.0.1-r1a3-x86-gcc4-2011-05-23.zip - : $(baseURL)/ccache-3.0.1-r1a3-x86-gcc4-2011-05-23.zip ; + ccache-3.0.1-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/ccache-3.0.1-r1a4-x86-gcc4-2012-08-30.zip ; } else { InstallOptionalHaikuImagePackage - ccache-3.0.1-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/ccache-3.0.1-r1a3-x86-gcc2-2011-05-17.zip ; + ccache-3.0.1-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/ccache-3.0.1-r1a4-x86-gcc2-2012-08-27.zip ; } } @@ -421,12 +421,12 @@ if [ IsOptionalHaikuImagePackageAdded CDRecord ] { Echo "No optional package CDRecord available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - cdrtools-3.01a07-x86-gcc4-2012-06-19.zip - : $(baseURL)/cdrtools-3.01a07-x86-gcc4-2012-07-19.zip ; + cdrtools-3.01a07-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/cdrtools-3.01a07-r1a4-x86-gcc4-2012-08-30.zip ; } else { InstallOptionalHaikuImagePackage - cdrtools-3.01a07-x86-gcc2-2012-07-19-r2.zip - : $(baseURL)/cdrtools-3.01a07-x86-gcc2-2012-07-19-r2.zip ; + cdrtools-3.01a07-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/cdrtools-3.01a07-r1a4-x86-gcc2-2012-08-28.zip ; } } @@ -487,13 +487,13 @@ if [ IsOptionalHaikuImagePackageAdded CMake ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - cmake-2.8.5-x86-gcc4-2012-07-18.zip - : $(baseURL)/cmake-2.8.5-x86-gcc4-2012-07-18.zip + cmake-2.8.5-r1a4-x86-gcc4-2012-08-28.zip + : $(baseURL)/cmake-2.8.5-r1a4-x86-gcc4-2012-08-28.zip : : true ; } else { InstallOptionalHaikuImagePackage - cmake-2.8.5-x86-gcc2-2012-07-16.zip - : $(baseURL)/cmake-2.8.5-x86-gcc2-2012-07-16.zip + cmake-2.8.5-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/cmake-2.8.5-r1a4-x86-gcc2-2012-08-27.zip : : true ; } } @@ -545,11 +545,11 @@ if [ IsOptionalHaikuImagePackageAdded Curl ] { if $(TARGET_ARCH) != x86 { Echo "No optional package Curl available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage curl-7.26.0-x86-gcc4-2012-06-20.zip - : $(baseURL)/curl-7.26.0-x86-gcc4-2012-06-20.zip ; + InstallOptionalHaikuImagePackage curl-7.26.0-r1a4-x86-gcc4-2012-08-29.zip + : $(baseURL)/curl-7.26.0-r1a4-x86-gcc4-2012-08-29.zip ; } else { - InstallOptionalHaikuImagePackage curl-7.26.0-x86-gcc2-2012-06-21.zip - : $(baseURL)/curl-7.26.0-x86-gcc2-2012-06-21.zip ; + InstallOptionalHaikuImagePackage curl-7.26.0-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/curl-7.26.0-r1a4-x86-gcc2-2012-08-28.zip ; } } @@ -561,13 +561,13 @@ if [ IsOptionalHaikuImagePackageAdded CVS ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - cvs-1.12.13.1-x86-gcc4-2012-06-22.zip - : $(baseURL)/cvs-1.12.13.1-x86-gcc4-2012-06-22.zip + cvs-1.12.13.1-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/cvs-1.12.13.1-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - cvs-1.12.13.1-x86-gcc2-2012-06-20.zip - : $(baseURL)/cvs-1.12.13.1-x86-gcc2-2012-06-20.zip + cvs-1.12.13.1-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/cvs-1.12.13.1-r1a4-x86-gcc2-2012-08-28.zip : : true ; } } @@ -614,37 +614,37 @@ if [ IsOptionalHaikuImagePackageAdded Development ] && $(TARGET_ARCH) = x86 { # autotools if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - autoconf-2.68-r1a3-x86-gcc4-2011-05-23.zip - : $(baseURL)/autoconf-2.68-r1a3-x86-gcc4-2011-05-23.zip + autoconf-2.68-r1a4-x86-gcc4-2012-08-28.zip + : $(baseURL)/autoconf-2.68-r1a4-x86-gcc4-2012-08-28.zip : : true ; InstallOptionalHaikuImagePackage - automake-1.11.1-r1a3-x86-gcc4-2011-05-23.zip - : $(baseURL)/automake-1.11.1-r1a3-x86-gcc4-2011-05-23.zip + automake-1.11.1-r1a4-x86-gcc4-2012-08-28.zip + : $(baseURL)/automake-1.11.1-r1a4-x86-gcc4-2012-08-28.zip : : true ; InstallOptionalHaikuImagePackage - libtool-2.4-r1a3-x86-gcc4-2011-05-23.zip - : $(baseURL)/libtool-2.4-r1a3-x86-gcc4-2011-05-23.zip + libtool-2.4-r1a4-x86-gcc4-2012-08-28.zip + : $(baseURL)/libtool-2.4-r1a4-x86-gcc4-2012-08-28.zip : : true ; InstallOptionalHaikuImagePackage - texinfo-4.13a-x86-gcc4-2012-03-31.zip - : $(baseURL)/texinfo-4.13a-x86-gcc4-2012-03-31.zip + texinfo-4.13a-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/texinfo-4.13a-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - autoconf-2.68-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/autoconf-2.68-r1a3-x86-gcc2-2011-05-17.zip + autoconf-2.68-r1a4-x86-gcc2-2012-08-26.zip + : $(baseURL)/autoconf-2.68-r1a4-x86-gcc2-2012-08-26.zip : : true ; InstallOptionalHaikuImagePackage - automake-1.11.1-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/automake-1.11.1-r1a3-x86-gcc2-2011-05-17.zip + automake-1.11.1-r1a4-x86-gcc2-2012-08-26.zip + : $(baseURL)/automake-1.11.1-r1a4-x86-gcc2-2012-08-26.zip : : true ; InstallOptionalHaikuImagePackage - libtool-2.4-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/libtool-2.4-r1a3-x86-gcc2-2011-05-17.zip + libtool-2.4-r1a4-x86-gcc2-2012-08-26.zip + : $(baseURL)/libtool-2.4-r1a4-x86-gcc2-2012-08-26.zip : : true ; InstallOptionalHaikuImagePackage - texinfo-4.13a-x86-gcc2-2012-03-31.zip - : $(baseURL)/texinfo-4.13a-x86-gcc2-2012-03-31.zip + texinfo-4.13a-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)texinfo-4.13a-r1a4-x86-gcc2-2012-08-28.zip : : true ; } } @@ -690,42 +690,42 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentBase ] # other commonly used tools if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - bison-2.4.3-r1a3-x86-gcc4-2011-05-23.zip - : $(baseURL)/bison-2.4.3-r1a3-x86-gcc4-2011-05-23.zip ; + bison-2.4.3-r1a4-x86-gcc4-2012-08-28.zip + : $(baseURL)/bison-2.4.3-r1a4-x86-gcc4-2012-08-28.zip ; InstallOptionalHaikuImagePackage - m4-1.4.16-r1a3-x86-gcc4-2011-05-23.zip - : $(baseURL)/m4-1.4.16-r1a3-x86-gcc4-2011-05-23.zip ; + m4-1.4.16-r1a4-x86-gcc4-2012-08-28.zip + : $(baseURL)/m4-1.4.16-r1a4-x86-gcc4-2012-08-28.zip ; InstallOptionalHaikuImagePackage - flex-2.5.35-r1a3-x86-gcc4-2011-05-23.zip - : $(baseURL)/flex-2.5.35-r1a3-x86-gcc4-2011-05-23.zip ; + flex-2.5.35-r1a4-x86-gcc4-2012-08-28.zip + : $(baseURL)/flex-2.5.35-r1a4-x86-gcc4-2012-08-28.zip ; InstallOptionalHaikuImagePackage - jam-2.5-x86-gcc4-2011-12-26.zip - : $(baseURL)/jam-2.5-x86-gcc4-2011-12-26.zip ; + jam-2.5-r1a4-x86-gcc4-2012-08-28.zip + : $(baseURL)/jam-2.5-r1a4-x86-gcc4-2012-08-28.zip ; InstallOptionalHaikuImagePackage - mkdepend-1.7-r1a3-x86-gcc4-2011-05-23.zip - : $(baseURL)/mkdepend-1.7-r1a3-x86-gcc4-2011-05-23.zip ; + mkdepend-1.7-r1a4-x86-gcc4-2012-08-28.zip + : $(baseURL)/mkdepend-1.7-r1a4-x86-gcc4-2012-08-28.zip ; InstallOptionalHaikuImagePackage - make-3.82-r1a3-x86-gcc4-2011-05-23.zip - : $(baseURL)/make-3.82-r1a3-x86-gcc4-2011-05-23.zip ; + make-3.82-r1a4-x86-gcc4-2012-08-28.zip + : $(baseURL)/make-3.82-r1a4-x86-gcc4-2012-08-28.zip ; } else { InstallOptionalHaikuImagePackage - bison-2.4.3-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/bison-2.4.3-r1a3-x86-gcc2-2011-05-17.zip ; + bison-2.4.3-r1a4-x86-gcc2-2012-08-26.zip + : $(baseURL)/bison-2.4.3-r1a4-x86-gcc2-2012-08-26.zip ; InstallOptionalHaikuImagePackage - m4-1.4.16-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/m4-1.4.16-r1a3-x86-gcc2-2011-05-17.zip ; + m4-1.4.16-r1a4-x86-gcc2-2012-08-26.zip + : $(baseURL)/m4-1.4.16-r1a4-x86-gcc2-2012-08-26.zip ; InstallOptionalHaikuImagePackage - flex-2.5.35-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/flex-2.5.35-r1a3-x86-gcc2-2011-05-17.zip ; + flex-2.5.35-r1a4-x86-gcc2-2012-08-26.zip + : $(baseURL)/flex-2.5.35-r1a4-x86-gcc2-2012-08-26.zip ; InstallOptionalHaikuImagePackage - jam-2.5-x86-gcc2-2011-12-26.zip - : $(baseURL)/jam-2.5-x86-gcc2-2011-12-26.zip ; + jam-2.5-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/jam-2.5-r1a4-x86-gcc2-2012-08-27.zip ; InstallOptionalHaikuImagePackage - mkdepend-1.7-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/mkdepend-1.7-r1a3-x86-gcc2-2011-05-17.zip ; + mkdepend-1.7-r1a4-x86-gcc2-2012-08-26.zip + : $(baseURL)/mkdepend-1.7-r1a4-x86-gcc2-2012-08-26.zip ; InstallOptionalHaikuImagePackage - make-3.82-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/make-3.82-r1a3-x86-gcc2-2011-05-17.zip ; + make-3.82-r1a4-x86-gcc2-2012-08-26.zip + : $(baseURL)/make-3.82-r1a4-x86-gcc2-2012-08-26.zip ; } } @@ -918,13 +918,13 @@ if [ IsOptionalHaikuImagePackageAdded Expat ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - expat-2.0.1-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/expat-2.0.1-r1a3-x86-gcc4-2011-05-24.zip + expat-2.0.1-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/expat-2.0.1-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - expat-2.0.1-x86-gcc2-2012-06-20.zip - : $(baseURL)/expat-2.0.1-x86-gcc2-2012-06-20.zip + expat-2.0.1-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/expat-2.0.1-r1a4-x86-gcc2-2012-08-28.zip : : true ; } } @@ -937,12 +937,12 @@ if [ IsOptionalHaikuImagePackageAdded Fastdep ] { Echo "No optional package Fastdep available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - fastdep-0.16-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/fastdep-0.16-r1a3-x86-gcc4-2011-05-24.zip ; + fastdep-0.16-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/fastdep-0.16-r1a4-x86-gcc4-2012-08-30.zip ; } else { InstallOptionalHaikuImagePackage - fastdep-0.16-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/fastdep-0.16-r1a3-x86-gcc2-2011-05-18.zip ; + fastdep-0.16-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/fastdep-0.16-r1a4-x86-gcc2-2012-08-28.zip ; } } @@ -958,8 +958,8 @@ if [ IsOptionalHaikuImagePackageAdded friss ] { : $(baseURL)/friss-24-r1a3-x86-gcc4-2011-05-31.zip ; } else { InstallOptionalHaikuImagePackage - friss-24-r1a3-x86-gcc2-2011-05-31.zip - : $(baseURL)/friss-24-r1a3-x86-gcc2-2011-05-31.zip ; + friss-29-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/friss-29-r1a4-x86-gcc2-2012-08-28.zip ; } # AddSymlinkToHaikuImage home config settings deskbar Desktop\ applets # : /boot/apps/FRiSS/FRiSS ; @@ -974,13 +974,13 @@ if [ IsOptionalHaikuImagePackageAdded GetText ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - gettext-0.18.1.1-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/gettext-0.18.1.1-r1a3-x86-gcc4-2011-05-24.zip + gettext-0.18.1.1-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/gettext-0.18.1.1-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - gettext-0.18.1.1-x86-gcc2-2011-02-07.zip - : $(baseURL)/gettext-0.18.1.1-x86-gcc2-2011-02-07.zip + gettext-0.18.1.1-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/gettext-0.18.1.1-r1a4-x86-gcc2-2012-08-28.zip : : true ; } } @@ -994,13 +994,13 @@ if [ IsOptionalHaikuImagePackageAdded Git ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - git-1.7.10.2-x86-gcc4-2012-06-19.zip - : $(baseURL)/git-1.7.10.2-x86-gcc4-2012-06-19.zip + git-1.7.10.2-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/git-1.7.10.2-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - git-1.7.10.2-x86-gcc2-2012-06-20.zip - : $(baseURL)/git-1.7.10.2-x86-gcc2-2012-06-20.zip + git-1.7.10.2-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/git-1.7.10.2-r1a4-x86-gcc2-2012-08-28.zip : : true ; } } @@ -1019,8 +1019,8 @@ if [ IsOptionalHaikuImagePackageAdded GitDoc ] { : : true ; } else { InstallOptionalHaikuImagePackage - gitdoc-1.7.10.2-x86-gcc2-2012-06-20.zip - : $(baseURL)/gitdoc-1.7.10.2-x86-gcc2-2012-06-20.zip + gitdoc-1.7.10.2-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/gitdoc-1.7.10.2-r1a4-x86-gcc2-2012-08-28.zip : : true ; } } @@ -1034,13 +1034,13 @@ if [ IsOptionalHaikuImagePackageAdded GPerf ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - gperf-3.0.4-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/gperf-3.0.4-r1a3-x86-gcc4-2011-05-24.zip + gperf-3.0.4-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/gperf-3.0.4-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - gperf-3.0.4-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/gperf-3.0.4-r1a3-x86-gcc2-2011-05-18.zip + gperf-3.0.4-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/gperf-3.0.4-r1a4-x86-gcc2-2012-08-28.zip : : true ; } } @@ -1054,13 +1054,13 @@ if [ IsOptionalHaikuImagePackageAdded Groff ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - groff-1.20.1-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/groff-1.20.1-r1a3-x86-gcc4-2011-05-24.zip + groff-1.20.1-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/groff-1.20.1-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - groff-1.20.1-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/groff-1.20.1-r1a3-x86-gcc2-2011-05-18.zip + groff-1.20.1-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/groff-1.20.1-r1a4-x86-gcc2-2012-08-28.zip : : true ; } } @@ -1173,13 +1173,13 @@ if [ IsOptionalHaikuImagePackageAdded LibEvent ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - libevent-2.0.10-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/lib/libevent-2.0.10-r1a3-x86-gcc4-2011-05-24.zip + libevent-2.0.10-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/lib/libevent-2.0.10-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - libevent-2.0.10-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/lib/libevent-2.0.10-r1a3-x86-gcc2-2011-05-18.zip + libevent-2.0.10-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/lib/libevent-2.0.10-r1a4-x86-gcc2-2012-08-28.zip : : true ; } } @@ -1193,12 +1193,12 @@ if [ IsOptionalHaikuImagePackageAdded LibIconv ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - libiconv-1.13.1-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/libiconv-1.13.1-r1a3-x86-gcc4-2011-05-24.zip ; + libiconv-1.13.1-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/libiconv-1.13.1-r1a4-x86-gcc4-2012-08-30.zip ; } else { InstallOptionalHaikuImagePackage - libiconv-1.13.1-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/libiconv-1.13.1-r1a3-x86-gcc2-2011-05-18.zip ; + libiconv-1.13.1-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/libiconv-1.13.1-r1a4-x86-gcc2-2012-08-28.zip ; } } } @@ -1209,11 +1209,11 @@ if [ IsOptionalHaikuImagePackageAdded LibLayout ] { if $(TARGET_ARCH) != x86 { Echo "No optional package LibLayout available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage liblayout-1.4.1-gcc4-2012-08-11.zip - : $(baseURL)/liblayout-1.4.1-gcc4-2012-08-11.zip ; + InstallOptionalHaikuImagePackage liblayout-1.4.1-r1a4-gcc4-2012-08-30.zip + : $(baseURL)/liblayout-1.4.1-r1a4-gcc4-2012-08-30.zip ; } else { - InstallOptionalHaikuImagePackage liblayout-1.4.0-gcc2-2009-03-08.zip - : $(baseURL)/liblayout-1.4.0-gcc2-2009-03-08.zip ; + InstallOptionalHaikuImagePackage liblayout-1.4.1-r1a4-gcc2-2012-08-28.zip + : $(baseURL)/liblayout-1.4.1-r1a4-gcc2-2012-08-28.zip ; } } @@ -1228,8 +1228,8 @@ if [ IsOptionalHaikuImagePackageAdded Libmng ] { : $(baseURL)/lib/libmng-1.0.10-r1a3-x86-gcc4-2011-05-24.zip ; } else { InstallOptionalHaikuImagePackage - libmng-1.0.10-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/lib/libmng-1.0.10-r1a3-x86-gcc2-2011-05-18.zip ; + libmng-1.0.10-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/lib/libmng-1.0.10-r1a4-x86-gcc2-2012-08-28.zip ; } } @@ -1241,12 +1241,12 @@ if [ IsOptionalHaikuImagePackageAdded LibXML2 ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - libxml2-2.8.0-x86-gcc4-2012-07-18.zip - : $(baseURL)/libxml2-2.8.0-x86-gcc4-2012-07-18.zip ; + libxml2-2.8.0-r1a4-x86-gcc4-2012-08-28.zip + : $(baseURL)/libxml2-2.8.0-r1a4-x86-gcc4-2012-08-28.zip ; } else { InstallOptionalHaikuImagePackage - libxml2-2.8.0-x86-gcc2-2012-07-17.zip - : $(baseURL)/libxml2-2.8.0-x86-gcc2-2012-07-17.zip ; + libxml2-2.8.0-r1a4-x86-gcc2-2012-08-30.zip + : $(baseURL)/libxml2-2.8.0-r1a4-x86-gcc2-2012-08-30.zip ; } } } @@ -1258,12 +1258,12 @@ if [ IsOptionalHaikuImagePackageAdded LibXSLT ] { Echo "No optional package LibXSLT available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - libxslt-1.1.26-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/libxslt-1.1.26-r1a3-x86-gcc4-2011-05-24.zip ; + libxslt-1.1.26-r1a4-x86-gcc4-2012-08-29.zip + : $(baseURL)/libxslt-1.1.26-r1a4-x86-gcc4-2012-08-29.zip ; } else { InstallOptionalHaikuImagePackage - libxslt-1.1.26-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/libxslt-1.1.26-r1a3-x86-gcc2-2011-05-18.zip + libxslt-1.1.26-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/libxslt-1.1.26-r1a4-x86-gcc2-2012-08-28.zip : : true ; } } @@ -1276,8 +1276,9 @@ if [ IsOptionalHaikuImagePackageAdded Links ] { } else if $(HAIKU_GCC_VERSION[1]) >= 4 && ! $(isHybridBuild) { Echo "No optional package Links available for gcc4" ; } else { - InstallOptionalHaikuImagePackage Links.zip - : $(baseURL)/links-x86-gcc2-2008-05-03.zip ; + InstallOptionalHaikuImagePackage + links-2.3pre2-r1a4-x86-gcc2-2012-08-30.zip + : $(baseURL)/links-2.3pre2-r1a4-x86-gcc2-2012-08-30.zip ; AddSymlinkToHaikuImage home config settings deskbar Applications : /boot/home/config/bin/links ; } @@ -1296,8 +1297,8 @@ if [ IsOptionalHaikuImagePackageAdded Lua ] { : : true ; } else { InstallOptionalHaikuImagePackage - lua-5.1.4-3-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/lua-5.1.4-3-r1a3-x86-gcc2-2011-05-18.zip + lua-5.1.4-3-r1a4-x86-gcc2-2012-08-29.zip + : $(baseURL)/lua-5.1.4-3-r1a4-x86-gcc2-2012-08-29.zip : : true ; } } @@ -1310,12 +1311,12 @@ if [ IsOptionalHaikuImagePackageAdded Man ] { Echo "No optional package Man available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - man-1.6g-x86-gcc4-2012-06-19.zip - : $(baseURL)/man-1.6g-x86-gcc4-2012-06-19.zip ; + man-1.6g-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/man-1.6g-r1a4-x86-gcc4-2012-08-30.zip ; } else { InstallOptionalHaikuImagePackage - man-1.6g-x86-gcc2-2012-06-21.zip - : $(baseURL)/man-1.6g-x86-gcc2-2012-06-21.zip ; + man-1.6g-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/man-1.6g-r1a4-x86-gcc2-2012-08-28.zip ; } } @@ -1333,13 +1334,13 @@ if [ IsOptionalHaikuImagePackageAdded Mercurial ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - mercurial-2.2.2-x86-gcc4-2012-06-19.zip - : $(baseURL)/mercurial-2.2.2-x86-gcc4-2012-06-19.zip + mercurial-2.2.2-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/mercurial-2.2.2-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - mercurial-2.2.2-x86-gcc2-2012-06-20.zip - : $(baseURL)/mercurial-2.2.2-x86-gcc2-2012-06-20.zip + mercurial-2.2.2-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/mercurial-2.2.2-r1a4-x86-gcc2-2012-08-27.zip : : true ; } } @@ -1353,12 +1354,12 @@ if [ IsOptionalHaikuImagePackageAdded Nano ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - nano-2.2.6-r1a3-x86-gcc4-2011-05-24.zip - : $(baseURL)/nano-2.2.6-r1a3-x86-gcc4-2011-05-24.zip ; + nano-2.2.6-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/nano-2.2.6-r1a4-x86-gcc4-2012-08-30.zip ; } else { InstallOptionalHaikuImagePackage - nano-2.2.6-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/nano-2.2.6-r1a3-x86-gcc2-2011-05-18.zip ; + nano-2.2.6-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/nano-2.2.6-r1a4-x86-gcc2-2012-08-28.zip ; } } } @@ -1371,12 +1372,12 @@ if [ IsOptionalHaikuImagePackageAdded Neon ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - neon-0.29.6-x86-gcc4-2012-06-19.zip - : $(baseURL)/neon-0.29.6-x86-gcc4-2012-06-19.zip ; + neon-0.29.6-r1a4-x86-gcc4-2012-08-29.zip + : $(baseURL)/neon-0.29.6-r1a4-x86-gcc4-2012-08-29.zip ; } else { InstallOptionalHaikuImagePackage - neon-0.29.6-x86-gcc2-2012-06-21.zip - : $(baseURL)/neon-0.29.6-x86-gcc2-2012-06-21.zip ; + neon-0.29.6-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/neon-0.29.6-r1a4-x86-gcc2-2012-08-28.zip ; } } } @@ -1468,12 +1469,12 @@ if [ IsOptionalHaikuImagePackageAdded OpenSSH ] { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - openssh-6.0p1-x86-gcc4-2012-06-20.zip - : $(baseURL)/openssh-6.0p1-x86-gcc4-2012-06-20.zip ; + openssh-6.0p1-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/openssh-6.0p1-r1a4-x86-gcc4-2012-08-30.zip ; } else { InstallOptionalHaikuImagePackage - openssh-6.0p1-x86-gcc2-2012-06-21.zip - : $(baseURL)/openssh-6.0p1-x86-gcc2-2012-06-21.zip ; + openssh-6.0p1-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/openssh-6.0p1-r1a4-x86-gcc2-2012-08-28.zip ; } AddUserToHaikuImage sshd : 1001 : 100 : /var/empty : /bin/true @@ -1509,8 +1510,8 @@ if [ IsOptionalHaikuImagePackageAdded P7zip ] { : $(baseURL)/p7zip-9.20.1-x86-gcc4-2012-06-19.zip ; } else { InstallOptionalHaikuImagePackage - p7zip-9.20.1-x86-gcc2-2012-06-21.zip - : $(baseURL)/p7zip-9.20.1-x86-gcc2-2012-06-21.zip ; + p7zip-9.20.1-r1a4-x86-gcc2-2012-08-29.zip + : $(baseURL)/p7zip-9.20.1-r1a4-x86-gcc2-2012-08-29.zip ; } AddExpanderRuleToHaikuImage "application/x-7z-compressed" : .7z : "7za l \\0045s" @@ -1555,8 +1556,8 @@ if [ IsOptionalHaikuImagePackageAdded PCRE ] { : $(baseURL)/libpcre-8.12-r1a3-x86-gcc4-2011-05-24.zip ; } else { InstallOptionalHaikuImagePackage - libpcre-8.12-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/libpcre-8.12-r1a3-x86-gcc2-2011-05-17.zip ; + libpcre-8.21-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/libpcre-8.21-r1a4-x86-gcc2-2012-08-28.zip ; } } } @@ -1573,8 +1574,8 @@ if [ IsOptionalHaikuImagePackageAdded Pe ] { : $(baseURL)/pe-2.4.3-600-x86-gcc4-2011-12-18.zip ; } else { InstallOptionalHaikuImagePackage - pe-2.4.3-600-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/pe-2.4.3-600-r1a3-x86-gcc2-2011-05-18.zip ; + pe-2.4.3-hg-r1a4-x86-gcc2-2012-08-29.zip + : $(baseURL)/pe-2.4.3-hg-r1a4-x86-gcc2-2012-08-29.zip ; } AddSymlinkToHaikuImage home config settings deskbar Applications : /boot/apps/Pe/Pe ; @@ -1596,8 +1597,8 @@ if [ IsOptionalHaikuImagePackageAdded Perl ] { : : true ; } else { InstallOptionalHaikuImagePackage - perl-5.10.1-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/perl-5.10.1-r1a3-x86-gcc2-2011-05-17.zip + perl-5.10.1-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/perl-5.10.1-r1a4-x86-gcc2-2012-08-27.zip : : true ; } } @@ -1632,8 +1633,8 @@ if [ IsOptionalHaikuImagePackageAdded Python ] { : : true ; } else { InstallOptionalHaikuImagePackage - python-2.6.7-x86-gcc2-2011-06-24.zip - : $(baseURL)/python-2.6.7-x86-gcc2-2011-06-24.zip + python-2.6.8-r1a4-x86-gcc2-2012-08-30.zip + : $(baseURL)/python-2.6.8-r1a4-x86-gcc2-2012-08-30.zip : : true ; } } @@ -1652,8 +1653,8 @@ if [ IsOptionalHaikuImagePackageAdded Rsync ] { : : true ; } else { InstallOptionalHaikuImagePackage - rsync-3.0.7-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/rsync-3.0.7-r1a3-x86-gcc2-2011-05-18.zip + rsync-3.0.7-r1a4-x86-gcc2-2012-08-29.zip + : $(baseURL)/rsync-3.0.7-r1a4-x86-gcc2-2012-08-29.zip : : true ; } } @@ -1670,8 +1671,8 @@ if [ IsOptionalHaikuImagePackageAdded Ruby ] { : $(baseURL)/ruby-1.9.1-r1a3-x86-gcc4-2011-05-24.zip ; } else { InstallOptionalHaikuImagePackage - ruby-1.9.1-r1a3-x86-gcc2-2011-05-31.zip - : $(baseURL)/ruby-1.9.1-r1a3-x86-gcc2-2011-06-01.zip ; + ruby-1.9.1-r1a4-x86-gcc2-2012-08-29.zip + : $(baseURL)/ruby-1.9.1-r1a4-x86-gcc2-2012-08-29.zip ; } } @@ -1686,8 +1687,8 @@ if [ IsOptionalHaikuImagePackageAdded Sed ] { : $(baseURL)/sed-4.2.1-r1a3-x86-gcc4-2011-05-24.zip ; } else { InstallOptionalHaikuImagePackage - sed-4.2.1-r1a3-x86-gcc2-2011-05-17.zip - : $(baseURL)/sed-4.2.1-r1a3-x86-gcc2-2011-05-17.zip ; + sed-4.2.1-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/sed-4.2.1-r1a4-x86-gcc2-2012-08-27.zip ; } } @@ -1699,12 +1700,12 @@ if [ IsOptionalHaikuImagePackageAdded SQLite ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - sqlite-3.7.13-x86-gcc4-2012-06-19.zip - : $(baseURL)/sqlite-3.7.13-x86-gcc4-2012-06-19.zip ; + sqlite-3.7.13-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/sqlite-3.7.13-r1a4-x86-gcc4-2012-08-30.zip ; } else { InstallOptionalHaikuImagePackage - sqlite-3.7.13-x86-gcc2-2012-06-20.zip - : $(baseURL)/sqlite-3.7.13-x86-gcc2-2012-06-20.zip ; + sqlite-3.7.13-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/sqlite-3.7.13-r1a4-x86-gcc2-2012-08-27.zip ; } } } @@ -1717,13 +1718,13 @@ if [ IsOptionalHaikuImagePackageAdded Subversion ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - subversion-1.6.18-x86-gcc4-2012-06-19.zip - : $(baseURL)/subversion-1.6.18-x86-gcc4-2012-06-19.zip + subversion-1.6.18-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/subversion-1.6.18-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage - subversion-1.6.18-x86-gcc2-2012-06-21.zip - : $(baseURL)/subversion-1.6.18-x86-gcc2-2012-06-21.zip + subversion-1.6.18-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/subversion-1.6.18-r1a4-x86-gcc2-2012-08-28.zip : : true ; } } @@ -1740,8 +1741,8 @@ if [ IsOptionalHaikuImagePackageAdded TagLib ] { : $(baseURL)/taglib-1.6.3-r1r3-x86-gcc4-2011-05-24.zip ; } else { InstallOptionalHaikuImagePackage - taglib-1.6.3-r1a3-x86-gcc2-2011-05-20.zip - : $(baseURL)/taglib-1.6.3-r1a3-x86-gcc2-2011-05-20.zip ; + taglib-1.7.2-r1a4-x86-gcc2-2012-08-30.zip + : $(baseURL)/taglib-1.7.2-r1a4-x86-gcc2-2012-08-30.zip ; } } @@ -1757,8 +1758,8 @@ if [ IsOptionalHaikuImagePackageAdded Tar ] { : $(baseURL)/tar-1.26-x86-gcc4-2012-06-19.zip ; } else { InstallOptionalHaikuImagePackage - tar-1.26-x86-gcc2-2012-06-21.zip - : $(baseURL)/tar-1.26-x86-gcc2-2012-06-21.zip ; + tar-1.26-r1a4-x86-gcc2-2012-08-29.zip + : $(baseURL)/tar-1.26-r1a4-x86-gcc2-2012-08-29.zip ; } } } @@ -1792,8 +1793,8 @@ if [ IsOptionalHaikuImagePackageAdded Transmission ] { : : true ; } else { InstallOptionalHaikuImagePackage - transmission-2.21-r1a3-x86-gcc2-2011-05-27.zip - : $(baseURL)/transmission-2.21-r1a3-x86-gcc2-2011-05-27.zip + transmission-2.21-r1a4-x86-gcc2-2012-08-30.zip + : $(baseURL)/transmission-2.21-r1a4-x86-gcc2-2012-08-30.zip : : true ; } } @@ -1885,8 +1886,8 @@ if [ IsOptionalHaikuImagePackageAdded Vision ] { : $(baseURL)/vision-908-x86-gcc4-2012-02-26.zip ; } else { InstallOptionalHaikuImagePackage - vision-908-x86-gcc2-2012-02-26.zip - : $(baseURL)/vision-908-x86-gcc2-2012-02-26.zip ; + vision-908-r1a4-x86-gcc2-2012-08-29.zip + : $(baseURL)/vision-908-r1a4-x86-gcc2-2012-08-29.zip ; } AddSymlinkToHaikuImage home config settings deskbar Applications : /boot/apps/Vision/Vision ; @@ -2032,8 +2033,8 @@ if [ IsOptionalHaikuImagePackageAdded wpa_supplicant ] { # WQY-MicroHei if [ IsOptionalHaikuImagePackageAdded WQY-MicroHei ] { InstallOptionalHaikuImagePackage - wqy-microhei-0.2.0-beta-r1a3-x86-gcc2-2011-05-18.zip - : $(baseURL)/wqy-microhei-0.2.0-beta-r1a3-x86-gcc2-2011-05-18.zip ; + wqy-microhei-0.2.0-beta-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/wqy-microhei-0.2.0-beta-r1a4-x86-gcc2-2012-08-27.zip ; } @@ -2067,11 +2068,11 @@ if [ IsOptionalHaikuImagePackageAdded Yasm ] { Echo "No optional package Yasm available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - yasm-1.2.0-x86-gcc4-2012-06-18.zip - : $(baseURL)/yasm-1.2.0-x86-gcc4-2012-06-18.zip ; + yasm-1.2.0-r1a4-x86-gcc4-2012-08-29.zip + : $(baseURL)/yasm-1.2.0-r1a4-x86-gcc4-2012-08-29.zip ; } else { InstallOptionalHaikuImagePackage - yasm-1.2.0-x86-gcc2-2012-06-19.zip - : $(baseURL)/yasm-1.2.0-x86-gcc2-2012-06-19.zip ; + yasm-1.2.0-r1a4-x86-gcc2-2012-08-27.zip + : $(baseURL)/yasm-1.2.0-r1a4-x86-gcc2-2012-08-27.zip ; } } From fb5ef78df06ff1aafb72dc5d25db98fd64890cdb Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 31 Aug 2012 20:34:56 -0400 Subject: [PATCH 07/21] Slight cleanup. Fix missing separator in texinfo path. --- build/jam/OptionalPackages | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 77acc4dc9d..db27c3b918 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -28,7 +28,7 @@ if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) = 1 # Bluetooth - experimental Haiku components for Bluetooth # BurnItNow - CD burning app # Bzip - file archiving utility -#   Caya                    - a multiprotocol im client +# Caya - a multiprotocol im client # CCache - fast compiler cache # CDRecord - the command line CD writing tools # Clang - the LLVM C and C++ compiler (llvm, libs, headers) @@ -561,8 +561,8 @@ if [ IsOptionalHaikuImagePackageAdded CVS ] { } else { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - cvs-1.12.13.1-r1a4-x86-gcc4-2012-08-30.zip - : $(baseURL)/cvs-1.12.13.1-r1a4-x86-gcc4-2012-08-30.zip + cvs-1.12.13.1-r1a4-x86-gcc4-2012-08-30.zip + : $(baseURL)/cvs-1.12.13.1-r1a4-x86-gcc4-2012-08-30.zip : : true ; } else { InstallOptionalHaikuImagePackage @@ -644,7 +644,7 @@ if [ IsOptionalHaikuImagePackageAdded Development ] && $(TARGET_ARCH) = x86 { : : true ; InstallOptionalHaikuImagePackage texinfo-4.13a-r1a4-x86-gcc2-2012-08-28.zip - : $(baseURL)texinfo-4.13a-r1a4-x86-gcc2-2012-08-28.zip + : $(baseURL)/texinfo-4.13a-r1a4-x86-gcc2-2012-08-28.zip : : true ; } } @@ -1228,7 +1228,7 @@ if [ IsOptionalHaikuImagePackageAdded Libmng ] { : $(baseURL)/lib/libmng-1.0.10-r1a3-x86-gcc4-2011-05-24.zip ; } else { InstallOptionalHaikuImagePackage - libmng-1.0.10-r1a4-x86-gcc2-2012-08-28.zip + libmng-1.0.10-r1a4-x86-gcc2-2012-08-28.zip : $(baseURL)/lib/libmng-1.0.10-r1a4-x86-gcc2-2012-08-28.zip ; } } @@ -1276,7 +1276,7 @@ if [ IsOptionalHaikuImagePackageAdded Links ] { } else if $(HAIKU_GCC_VERSION[1]) >= 4 && ! $(isHybridBuild) { Echo "No optional package Links available for gcc4" ; } else { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage links-2.3pre2-r1a4-x86-gcc2-2012-08-30.zip : $(baseURL)/links-2.3pre2-r1a4-x86-gcc2-2012-08-30.zip ; AddSymlinkToHaikuImage home config settings deskbar Applications From e652fc18b67e03254f35ec2f1bb30b4a6fbe7b58 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 31 Aug 2012 21:11:43 -0400 Subject: [PATCH 08/21] Update webkit package to account for newer libpng/libjpeg. --- build/jam/OptionalBuildFeatures | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures index 7a60489dd7..9b7f443143 100644 --- a/build/jam/OptionalBuildFeatures +++ b/build/jam/OptionalBuildFeatures @@ -467,7 +467,7 @@ if [ IsOptionalHaikuImagePackageAdded WebPositive ] { HAIKU_BUILD_FEATURE_WEBKIT = 1 ; } -HAIKU_WEBKIT_FILE = haikuwebkit-1.1.3-x86-gcc4-2012-07-20-1.zip ; +HAIKU_WEBKIT_FILE = haikuwebkit-1.1.3-x86-gcc4-2012-08-31.zip ; if $(HAIKU_BUILD_FEATURE_WEBKIT) { if $(TARGET_ARCH) != x86 { From 83092a04a4ada9f91e8b45194da7de2c6183752a Mon Sep 17 00:00:00 2001 From: czeidler Date: Sat, 1 Sep 2012 14:51:10 +1200 Subject: [PATCH 09/21] Fix hrev42632. This really implements WindowSentBehind. --- src/servers/app/stackandtile/StackAndTile.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/servers/app/stackandtile/StackAndTile.cpp b/src/servers/app/stackandtile/StackAndTile.cpp index ec27493d55..2fb545478b 100644 --- a/src/servers/app/stackandtile/StackAndTile.cpp +++ b/src/servers/app/stackandtile/StackAndTile.cpp @@ -308,6 +308,24 @@ StackAndTile::WindowActitvated(Window* window) void StackAndTile::WindowSentBehind(Window* window, Window* behindOf) { + SATWindow* satWindow = GetSATWindow(window); + if (satWindow == NULL) + return; + SATGroup* group = satWindow->GetGroup(); + if (group == NULL) + return; + Desktop* desktop = satWindow->GetWindow()->Desktop(); + if (desktop == NULL) + return; + + const WindowAreaList& areaList = group->GetAreaList(); + for (int32 i = 0; i < areaList.CountItems(); i++) { + WindowArea* area = areaList.ItemAt(i); + SATWindow* topWindow = area->TopWindow(); + if (topWindow == NULL || topWindow == satWindow) + continue; + desktop->SendWindowBehind(topWindow->GetWindow(), behindOf); + } } From 7dd16a4c95aa5f0ef5ad9dbc2abf652cf6105619 Mon Sep 17 00:00:00 2001 From: czeidler Date: Sat, 1 Sep 2012 14:56:06 +1200 Subject: [PATCH 10/21] Fix crash when splitting a S&T group. - Hold a ref to the old crossings till we cleaned up. - Additionally use a safer method to delete constraints. - Clean up. --- src/servers/app/stackandtile/SATGroup.cpp | 27 ++++++++++++++--------- src/servers/app/stackandtile/SATGroup.h | 4 +--- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/servers/app/stackandtile/SATGroup.cpp b/src/servers/app/stackandtile/SATGroup.cpp index e2c4e25986..b27906d80c 100644 --- a/src/servers/app/stackandtile/SATGroup.cpp +++ b/src/servers/app/stackandtile/SATGroup.cpp @@ -47,7 +47,6 @@ WindowArea::WindowArea(Crossing* leftTop, Crossing* rightTop, fWidthConstraint(NULL), fHeightConstraint(NULL) { - } @@ -320,6 +319,12 @@ WindowArea::PropagateToGroup(SATGroup* group) if (!newLeftTop || !newRightTop || !newLeftBottom || !newRightBottom) return false; + // hold a ref to the crossings till we cleaned up everything + BReference oldLeftTop = fLeftTopCrossing; + BReference oldRightTop = fRightTopCrossing; + BReference oldLeftBottom = fLeftBottomCrossing; + BReference oldRightBottom = fRightBottomCrossing; + fLeftTopCrossing = newLeftTop; fRightTopCrossing = newRightTop; fLeftBottomCrossing = newLeftBottom; @@ -331,6 +336,7 @@ WindowArea::PropagateToGroup(SATGroup* group) // manage constraints if (Init(group) == false) return false; + oldGroup->fWindowAreaList.RemoveItem(this); for (int32 i = 0; i < fWindowList.CountItems(); i++) { SATWindow* window = fWindowList.ItemAt(i); @@ -360,12 +366,15 @@ WindowArea::MoveToTopLayer(SATWindow* window) void WindowArea::_UninitConstraints() { - delete fMinWidthConstraint; - delete fMinHeightConstraint; - delete fMaxWidthConstraint; - delete fMaxHeightConstraint; - delete fWidthConstraint; - delete fHeightConstraint; + LinearSpec* linearSpec = fGroup->GetLinearSpec(); + + linearSpec->RemoveConstraint(fMinWidthConstraint, true); + linearSpec->RemoveConstraint(fMinHeightConstraint, true); + linearSpec->RemoveConstraint(fMaxWidthConstraint, true); + linearSpec->RemoveConstraint(fMaxHeightConstraint, true); + linearSpec->RemoveConstraint(fWidthConstraint, true); + linearSpec->RemoveConstraint(fHeightConstraint, true); + fMinWidthConstraint = NULL; fMinHeightConstraint = NULL; fMaxWidthConstraint = NULL; @@ -1157,14 +1166,12 @@ SATGroup::_SplitGroupIfNecessary(WindowArea* removedArea) while (_FindConnectedGroup(neighbourWindows, removedArea, newGroup)) { STRACE_SAT("Connected group found; %i window(s)\n", (int)newGroup.CountItems()); - if (newGroup.CountItems() == 1 && newGroup.ItemAt(0)->WindowList().CountItems() == 1) { SATWindow* window = newGroup.ItemAt(0)->WindowList().ItemAt(0); RemoveWindow(window); _EnsureGroupIsOnScreen(window->GetGroup()); - } - else if (ownGroupProcessed) + } else if (ownGroupProcessed) _SpawnNewGroup(newGroup); else { _EnsureGroupIsOnScreen(this); diff --git a/src/servers/app/stackandtile/SATGroup.h b/src/servers/app/stackandtile/SATGroup.h index 74b081adfb..80897d105f 100644 --- a/src/servers/app/stackandtile/SATGroup.h +++ b/src/servers/app/stackandtile/SATGroup.h @@ -220,11 +220,9 @@ private: Constraint* fMinHeightConstraint; Constraint* fMaxWidthConstraint; Constraint* fMaxHeightConstraint; - Constraint* fKeepMaxWidthConstraint; - Constraint* fKeepMaxHeightConstraint; Constraint* fWidthConstraint; Constraint* fHeightConstraint; - + MagneticBorder fMagneticBorder; }; From 6cf32e83ada755b571a82d76a7a9407914236116 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 31 Aug 2012 23:26:17 -0400 Subject: [PATCH 11/21] Update webkit package to incorporate fixes for #8871. --- build/jam/OptionalBuildFeatures | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures index 9b7f443143..2e6a0bdeea 100644 --- a/build/jam/OptionalBuildFeatures +++ b/build/jam/OptionalBuildFeatures @@ -467,7 +467,7 @@ if [ IsOptionalHaikuImagePackageAdded WebPositive ] { HAIKU_BUILD_FEATURE_WEBKIT = 1 ; } -HAIKU_WEBKIT_FILE = haikuwebkit-1.1.3-x86-gcc4-2012-08-31.zip ; +HAIKU_WEBKIT_FILE = haikuwebkit-1.1.3-x86-gcc4-2012-08-31a.zip ; if $(HAIKU_BUILD_FEATURE_WEBKIT) { if $(TARGET_ARCH) != x86 { From 6c4a44e36ba846c54467103f884d65dfa13e7fcb Mon Sep 17 00:00:00 2001 From: czeidler Date: Sat, 1 Sep 2012 15:36:59 +1200 Subject: [PATCH 12/21] Add a list of constraints which can be associated with a BALMLayout. - Add Get{X,Y}Tabs methods. - Remove SaveLayout and RestoreLayout. These can be implemented outside of BALMLayout. --- headers/libs/alm/ALMLayout.h | 45 +++++- src/libs/alm/ALMLayout.cpp | 265 ++++++++++++++++++----------------- 2 files changed, 179 insertions(+), 131 deletions(-) diff --git a/headers/libs/alm/ALMLayout.h b/headers/libs/alm/ALMLayout.h index 3a7cf821d9..98522b8698 100644 --- a/headers/libs/alm/ALMLayout.h +++ b/headers/libs/alm/ALMLayout.h @@ -16,6 +16,8 @@ class BView; class BLayoutItem; +class Constraint; + namespace BPrivate { class SharedSolver; @@ -53,10 +55,41 @@ public: XTab* XTabAt(int32 index) const; YTab* YTabAt(int32 index, bool ordered = false); YTab* YTabAt(int32 index) const; + const XTabList GetXTabs() const; + const YTabList GetYTabs() const; int32 IndexOf(XTab* tab, bool ordered = false); int32 IndexOf(YTab* tab, bool ordered = false); + int32 CountConstraints() const; + Constraint* ConstraintAt(int32 index) const; + bool AddConstraint(Constraint* constraint); + bool RemoveConstraint(Constraint* constraint, + bool deleteConstraint = true); + + Constraint* AddConstraint(double coeff1, Variable* var1, + OperatorType op, double rightSide, + double penaltyNeg = -1, + double penaltyPos = -1); + Constraint* AddConstraint(double coeff1, Variable* var1, + double coeff2, Variable* var2, + OperatorType op, double rightSide, + double penaltyNeg = -1, + double penaltyPos = -1); + Constraint* AddConstraint(double coeff1, Variable* var1, + double coeff2, Variable* var2, + double coeff3, Variable* var3, + OperatorType op, double rightSide, + double penaltyNeg = -1, + double penaltyPos = -1); + Constraint* AddConstraint(double coeff1, Variable* var1, + double coeff2, Variable* var2, + double coeff3, Variable* var3, + double coeff4, Variable* var4, + OperatorType op, double rightSide, + double penaltyNeg = -1, + double penaltyPos = -1); + Row* AddRow(YTab* top, YTab* bottom); Column* AddColumn(XTab* left, XTab* right); @@ -66,6 +99,7 @@ public: YTab* Bottom() const; LinearProgramming::LinearSpec* Solver() const; + LinearProgramming::ResultType ValidateLayout(); void SetInsets(float insets); void SetInsets(float x, float y); @@ -106,9 +140,7 @@ public: YTab* bottom = NULL); virtual Area* AddItem(BLayoutItem* item, Row* row, Column* column); - - bool SaveLayout(BMessage* archive) const; - bool RestoreLayout(const BMessage* archive); + struct BadLayoutPolicy; void SetBadLayoutPolicy(BadLayoutPolicy* policy); @@ -192,6 +224,9 @@ private: friend class YTab; friend class Area; + class BALMLayoutSpecListener; + friend class BALMLayoutSpecListener; + float InsetForTab(XTab* tab) const; float InsetForTab(YTab* tab) const; @@ -208,6 +243,7 @@ private: void _SetSolver(BPrivate::SharedSolver* solver); BPrivate::SharedSolver* fSolver; + BALMLayoutSpecListener* fSpecListener; BReference fLeft; BReference fRight; @@ -231,9 +267,12 @@ private: YTabList fYTabList; bool fYTabsSorted; + BObjectList fConstraints; + RowColumnManager* fRowColumnManager; BadLayoutPolicy* fBadLayoutPolicy; + uint32 _reserved[5]; }; diff --git a/src/libs/alm/ALMLayout.cpp b/src/libs/alm/ALMLayout.cpp index 647ef82b43..a294f0143b 100644 --- a/src/libs/alm/ALMLayout.cpp +++ b/src/libs/alm/ALMLayout.cpp @@ -184,6 +184,25 @@ BALM::BALMLayout::DefaultPolicy::Instantiate(BMessage* archive) } +class BALMLayout::BALMLayoutSpecListener + : public LinearProgramming::SpecificationListener { +public: + BALMLayoutSpecListener(BALMLayout* layout) + : + fLayout(layout) + { + } + + void ConstraintRemoved(Constraint* constraint) + { + fLayout->fConstraints.RemoveItem(constraint); + } + +private: + BALMLayout* fLayout; +}; + + /*! * Constructor. * Creates new layout engine. @@ -204,6 +223,9 @@ BALMLayout::BALMLayout(float hSpacing, float vSpacing, BALMLayout* friendLayout) { _SetSolver(friendLayout ? friendLayout->fSolver : new SharedSolver()); + fSpecListener = new BALMLayoutSpecListener(this); + Solver()->AddListener(fSpecListener); + fLeft = AddXTab(); fRight = AddXTab(); fTop = AddYTab(); @@ -278,14 +300,23 @@ BALMLayout::BALMLayout(BMessage* archive) err = unarchiver.EnsureUnarchived(kSolverField); unarchiver.Finish(err); + + fSpecListener = new BALMLayoutSpecListener(this); + Solver()->AddListener(fSpecListener); } BALMLayout::~BALMLayout() { + Solver()->RemoveListener(fSpecListener); + delete fSpecListener; + delete fRowColumnManager; delete fBadLayoutPolicy; + for (int32 i = 0; i < fConstraints.CountItems(); i++) + Solver()->RemoveConstraint(fConstraints.ItemAt(i), true); + if (fSolver) { fSolver->LayoutLeaving(this); fSolver->ReleaseReference(); @@ -409,6 +440,20 @@ BALMLayout::YTabAt(int32 index) const } +const XTabList +BALMLayout::GetXTabs() const +{ + return fXTabList; +} + + +const YTabList +BALMLayout::GetYTabs() const +{ + return fYTabList; +} + + int32 BALMLayout::IndexOf(XTab* tab, bool ordered) { @@ -433,6 +478,85 @@ BALMLayout::IndexOf(YTab* tab, bool ordered) } +int32 +BALMLayout::CountConstraints() const +{ + return fConstraints.CountItems(); +} + + +Constraint* +BALMLayout::ConstraintAt(int32 index) const +{ + return fConstraints.ItemAt(index); +} + + +bool +BALMLayout::AddConstraint(Constraint* constraint) +{ + fConstraints.AddItem(constraint); + return Solver()->AddConstraint(constraint); +} + + +bool +BALMLayout::RemoveConstraint(Constraint* constraint, + bool deleteConstraint) +{ + if (!fConstraints.RemoveItem(constraint)) + return false; + return Solver()->RemoveConstraint(constraint, deleteConstraint); +} + + +Constraint* +BALMLayout::AddConstraint(double coeff1, Variable* var1, OperatorType op, + double rightSide, double penaltyNeg, double penaltyPos) +{ + Constraint* constraint = Solver()->AddConstraint(coeff1, var1, op, + rightSide, penaltyNeg, penaltyPos); + fConstraints.AddItem(constraint); + return constraint; +} + + +Constraint* +BALMLayout::AddConstraint(double coeff1, Variable* var1, double coeff2, + Variable* var2, OperatorType op, double rightSide, double penaltyNeg, + double penaltyPos) +{ + Constraint* constraint = Solver()->AddConstraint(coeff1, var1, coeff2, var2, + op, rightSide, penaltyNeg, penaltyPos); + fConstraints.AddItem(constraint); + return constraint; +} + +Constraint* +BALMLayout::AddConstraint(double coeff1, Variable* var1, double coeff2, + Variable* var2, double coeff3, Variable* var3, OperatorType op, + double rightSide, double penaltyNeg, double penaltyPos) +{ + Constraint* constraint = Solver()->AddConstraint(coeff1, var1, coeff2, var2, + coeff3, var3, op, rightSide, penaltyNeg, penaltyPos); + fConstraints.AddItem(constraint); + return constraint; +} + + +Constraint* +BALMLayout::AddConstraint(double coeff1, Variable* var1, double coeff2, + Variable* var2, double coeff3, Variable* var3, double coeff4, + Variable* var4, OperatorType op, double rightSide, double penaltyNeg, + double penaltyPos) +{ + Constraint* constraint = Solver()->AddConstraint(coeff1, var1, coeff2, var2, + coeff3, var3, coeff4, var4, op, rightSide, penaltyNeg, penaltyPos); + fConstraints.AddItem(constraint); + return constraint; +} + + namespace { @@ -775,6 +899,7 @@ BALMLayout::AddItem(BLayoutItem* item, XTab* _left, YTab* _top, XTab* _right, return NULL; } + fSolver->Invalidate(true); area->_Init(Solver(), left, top, right, bottom, fRowColumnManager); fRowColumnManager->AddArea(area); @@ -795,6 +920,7 @@ BALMLayout::AddItem(BLayoutItem* item, Row* row, Column* column) if (!area) return NULL; + fSolver->Invalidate(true); area->_Init(Solver(), row, column, fRowColumnManager); fRowColumnManager->AddArea(area); @@ -802,134 +928,6 @@ BALMLayout::AddItem(BLayoutItem* item, Row* row, Column* column) } -enum { - kLeftBorderIndex = -2, - kTopBorderIndex = -3, - kRightBorderIndex = -4, - kBottomBorderIndex = -5, -}; - - -bool -BALMLayout::SaveLayout(BMessage* archive) const -{ - archive->MakeEmpty(); - - archive->AddInt32("nXTabs", CountXTabs()); - archive->AddInt32("nYTabs", CountYTabs()); - - XTabList xTabs = fXTabList; - xTabs.RemoveItem(fLeft); - xTabs.RemoveItem(fRight); - YTabList yTabs = fYTabList; - yTabs.RemoveItem(fTop); - yTabs.RemoveItem(fBottom); - - int32 nAreas = CountAreas(); - for (int32 i = 0; i < nAreas; i++) { - Area* area = AreaAt(i); - if (area->Left() == fLeft) - archive->AddInt32("left", kLeftBorderIndex); - else - archive->AddInt32("left", xTabs.IndexOf(area->Left())); - if (area->Top() == fTop) - archive->AddInt32("top", kTopBorderIndex); - else - archive->AddInt32("top", yTabs.IndexOf(area->Top())); - if (area->Right() == fRight) - archive->AddInt32("right", kRightBorderIndex); - else - archive->AddInt32("right", xTabs.IndexOf(area->Right())); - if (area->Bottom() == fBottom) - archive->AddInt32("bottom", kBottomBorderIndex); - else - archive->AddInt32("bottom", yTabs.IndexOf(area->Bottom())); - } - return true; -} - - -bool -BALMLayout::RestoreLayout(const BMessage* archive) -{ - int32 neededXTabs; - int32 neededYTabs; - if (archive->FindInt32("nXTabs", &neededXTabs) != B_OK) - return false; - if (archive->FindInt32("nYTabs", &neededYTabs) != B_OK) - return false; - // First store a reference to all needed tabs otherwise they might get lost - // while editing the layout - std::vector > newXTabs; - std::vector > newYTabs; - int32 existingXTabs = fXTabList.CountItems(); - for (int32 i = 0; i < neededXTabs; i++) { - if (i < existingXTabs) - newXTabs.push_back(BReference(fXTabList.ItemAt(i))); - else - newXTabs.push_back(AddXTab()); - } - int32 existingYTabs = fYTabList.CountItems(); - for (int32 i = 0; i < neededYTabs; i++) { - if (i < existingYTabs) - newYTabs.push_back(BReference(fYTabList.ItemAt(i))); - else - newYTabs.push_back(AddYTab()); - } - - XTabList xTabs = fXTabList; - xTabs.RemoveItem(fLeft); - xTabs.RemoveItem(fRight); - YTabList yTabs = fYTabList; - yTabs.RemoveItem(fTop); - yTabs.RemoveItem(fBottom); - - int32 nAreas = CountAreas(); - for (int32 i = 0; i < nAreas; i++) { - Area* area = AreaAt(i); - if (area == NULL) - return false; - int32 left = -1; - if (archive->FindInt32("left", i, &left) != B_OK) - break; - int32 top = archive->FindInt32("top", i); - int32 right = archive->FindInt32("right", i); - int32 bottom = archive->FindInt32("bottom", i); - - XTab* leftTab = NULL; - YTab* topTab = NULL; - XTab* rightTab = NULL; - YTab* bottomTab = NULL; - - if (left == kLeftBorderIndex) - leftTab = fLeft; - else - leftTab = xTabs.ItemAt(left); - if (top == kTopBorderIndex) - topTab = fTop; - else - topTab = yTabs.ItemAt(top); - if (right == kRightBorderIndex) - rightTab = fRight; - else - rightTab = xTabs.ItemAt(right); - if (bottom == kBottomBorderIndex) - bottomTab = fBottom; - else - bottomTab = yTabs.ItemAt(bottom); - if (leftTab == NULL || topTab == NULL || rightTab == NULL - || bottomTab == NULL) - return false; - - area->SetLeft(leftTab); - area->SetTop(topTab); - area->SetRight(rightTab); - area->SetBottom(bottomTab); - } - return true; -} - - /** * Gets the left variable. */ @@ -1337,6 +1335,17 @@ BALMLayout::Solver() const } +ResultType +BALMLayout::ValidateLayout() +{ + // we explicitly recaluclate the layout so set the invalidate flag first + fSolver->Invalidate(true); + + BLayoutContext* context = LayoutContext(); + return fSolver->ValidateLayout(context); +} + + void BALMLayout::SetInsets(float left, float top, float right, float bottom) From 08927d809f1d1ba528ebd34abd8181bf051ca7ac Mon Sep 17 00:00:00 2001 From: czeidler Date: Sat, 1 Sep 2012 15:39:09 +1200 Subject: [PATCH 13/21] Make it possible to create a constraint that is not connected to a solver. - Clean up. --- headers/libs/linprog/Constraint.h | 34 ++--- src/libs/linprog/Constraint.cpp | 233 ++++++++++++++---------------- 2 files changed, 123 insertions(+), 144 deletions(-) diff --git a/headers/libs/linprog/Constraint.h b/headers/libs/linprog/Constraint.h index 7abda49165..0a4d5b27fb 100644 --- a/headers/libs/linprog/Constraint.h +++ b/headers/libs/linprog/Constraint.h @@ -6,9 +6,6 @@ #ifndef CONSTRAINT_H #define CONSTRAINT_H -#include - -#include #include #include #include @@ -28,20 +25,26 @@ class LinearSpec; */ class Constraint { public: + Constraint(); + /*! Creates a soft copy of the constraint which is not connected + to the solver. Variables are not copied or cloned but the soft copy + has its own summand list with summands. */ + Constraint(Constraint* constraint); + int32 Index() const; SummandList* LeftSide(); - /*! This just overwrites the current list. The caller has to take - care about the old left side, i.e. delete it. */ - void SetLeftSide(SummandList* summands); + + bool SetLeftSide(SummandList* summands, + bool deleteOldSummands); - void SetLeftSide(double coeff1, Variable* var1); - void SetLeftSide(double coeff1, Variable* var1, + bool SetLeftSide(double coeff1, Variable* var1); + bool SetLeftSide(double coeff1, Variable* var1, double coeff2, Variable* var2); - void SetLeftSide(double coeff1, Variable* var1, + bool SetLeftSide(double coeff1, Variable* var1, double coeff2, Variable* var2, double coeff3, Variable* var3); - void SetLeftSide(double coeff1, Variable* var1, + bool SetLeftSide(double coeff1, Variable* var1, double coeff2, Variable* var2, double coeff3, Variable* var3, double coeff4, Variable* var4); @@ -58,11 +61,6 @@ public: const char* Label(); void SetLabel(const char* label); - Variable* DNeg() const; - Variable* DPos() const; - - bool IsSoft() const; - bool IsValid(); void Invalidate(); @@ -86,16 +84,10 @@ private: double fPenaltyNeg; double fPenaltyPos; - Summand* fDNegObjSummand; - Summand* fDPosObjSummand; BString fLabel; - bool fIsValid; - public: friend class LinearSpec; - friend class LPSolveInterface; - }; diff --git a/src/libs/linprog/Constraint.cpp b/src/libs/linprog/Constraint.cpp index e723c3a43f..6dbfe451e9 100644 --- a/src/libs/linprog/Constraint.cpp +++ b/src/libs/linprog/Constraint.cpp @@ -25,6 +25,36 @@ #endif +Constraint::Constraint() + : + fLS(NULL), + fLeftSide(new SummandList), + fOp(kEQ), + fRightSide(0), + fPenaltyNeg(-1), + fPenaltyPos(-1) +{ +} + + +Constraint::Constraint(Constraint* constraint) + : + fLS(NULL), + fLeftSide(new SummandList), + fOp(constraint->Op()), + fRightSide(constraint->RightSide()), + fPenaltyNeg(constraint->PenaltyNeg()), + fPenaltyPos(constraint->PenaltyPos()), + fLabel(constraint->Label()) +{ + SummandList* orgSummands = constraint->LeftSide(); + for (int32 i = 0; i < orgSummands->CountItems(); i++) { + Summand* summand = orgSummands->ItemAt(i); + fLeftSide->AddItem(new Summand(summand)); + } +} + + /** * Gets the index of the constraint. * @@ -33,6 +63,8 @@ int32 Constraint::Index() const { + if (fLS == NULL) + return -1; int32 i = fLS->Constraints().IndexOf(this); if (i == -1) STRACE(("Constraint not part of fLS->Constraints().")); @@ -59,11 +91,11 @@ Constraint::LeftSide() * * @param summands a BList containing the Summand objects that make up the new left side */ -void -Constraint::SetLeftSide(SummandList* summands) +bool +Constraint::SetLeftSide(SummandList* summands, bool deleteOldSummands) { - if (!fIsValid) - return; + if (summands == NULL) + debugger("Invalid summands"); // check left side for (int32 i = 0; i < summands->CountItems(); i++) { @@ -79,76 +111,76 @@ Constraint::SetLeftSide(SummandList* summands) } } + if (fLS == NULL) { + if (deleteOldSummands) + delete fLeftSide; + fLeftSide = summands; + return true; + } + + // notify the solver + SummandList oldSummands; + if (fLeftSide != NULL) + oldSummands = *fLeftSide; + if (deleteOldSummands) + delete fLeftSide; fLeftSide = summands; - fLS->UpdateLeftSide(this); + if (fLS != NULL) + fLS->UpdateLeftSide(this, &oldSummands); + + if (deleteOldSummands) { + for (int32 i = 0; i < oldSummands.CountItems(); i++) + delete oldSummands.ItemAt(i); + } + return true; } -void +bool Constraint::SetLeftSide(double coeff1, Variable* var1) { - if (!fIsValid) - return; - - for (int i=0; iCountItems(); i++) - delete fLeftSide->ItemAt(i); - fLeftSide->MakeEmpty(); - fLeftSide->AddItem(new(std::nothrow) Summand(coeff1, var1)); - SetLeftSide(fLeftSide); + SummandList* list = new SummandList; + list->AddItem(new(std::nothrow) Summand(coeff1, var1)); + return SetLeftSide(list, true); } -void +bool Constraint::SetLeftSide(double coeff1, Variable* var1, double coeff2, Variable* var2) { - if (!fIsValid) - return; - - for (int i=0; iCountItems(); i++) - delete fLeftSide->ItemAt(i); - fLeftSide->MakeEmpty(); - fLeftSide->AddItem(new(std::nothrow) Summand(coeff1, var1)); - fLeftSide->AddItem(new(std::nothrow) Summand(coeff2, var2)); - SetLeftSide(fLeftSide); + SummandList* list = new SummandList; + list->AddItem(new(std::nothrow) Summand(coeff1, var1)); + list->AddItem(new(std::nothrow) Summand(coeff2, var2)); + return SetLeftSide(list, true); } -void +bool Constraint::SetLeftSide(double coeff1, Variable* var1, double coeff2, Variable* var2, double coeff3, Variable* var3) { - if (!fIsValid) - return; - - for (int i=0; iCountItems(); i++) - delete fLeftSide->ItemAt(i); - fLeftSide->MakeEmpty(); - fLeftSide->AddItem(new(std::nothrow) Summand(coeff1, var1)); - fLeftSide->AddItem(new(std::nothrow) Summand(coeff2, var2)); - fLeftSide->AddItem(new(std::nothrow) Summand(coeff3, var3)); - SetLeftSide(fLeftSide); + SummandList* list = new SummandList; + list->AddItem(new(std::nothrow) Summand(coeff1, var1)); + list->AddItem(new(std::nothrow) Summand(coeff2, var2)); + list->AddItem(new(std::nothrow) Summand(coeff3, var3)); + return SetLeftSide(list, true); } -void +bool Constraint::SetLeftSide(double coeff1, Variable* var1, double coeff2, Variable* var2, double coeff3, Variable* var3, double coeff4, Variable* var4) { - if (!fIsValid) - return; - - for (int i=0; iCountItems(); i++) - delete fLeftSide->ItemAt(i); - fLeftSide->MakeEmpty(); - fLeftSide->AddItem(new(std::nothrow) Summand(coeff1, var1)); - fLeftSide->AddItem(new(std::nothrow) Summand(coeff2, var2)); - fLeftSide->AddItem(new(std::nothrow) Summand(coeff3, var3)); - fLeftSide->AddItem(new(std::nothrow) Summand(coeff4, var4)); - SetLeftSide(fLeftSide); + SummandList* list = new SummandList; + list->AddItem(new(std::nothrow) Summand(coeff1, var1)); + list->AddItem(new(std::nothrow) Summand(coeff2, var2)); + list->AddItem(new(std::nothrow) Summand(coeff3, var3)); + list->AddItem(new(std::nothrow) Summand(coeff4, var4)); + return SetLeftSide(list, true); } @@ -172,11 +204,9 @@ Constraint::Op() void Constraint::SetOp(OperatorType value) { - if (!fIsValid) - return; - fOp = value; - fLS->UpdateOperator(this); + if (fLS != NULL) + fLS->UpdateOperator(this); } @@ -200,15 +230,13 @@ Constraint::RightSide() const void Constraint::SetRightSide(double value) { - if (!fIsValid) - return; - if (fRightSide == value) return; fRightSide = value; - fLS->UpdateRightSide(this); + if (fLS != NULL) + fLS->UpdateRightSide(this); } @@ -235,7 +263,8 @@ Constraint::SetPenaltyNeg(double value) { fPenaltyNeg = value; - fLS->UpdateLeftSide(this); + if (fLS != NULL) + fLS->UpdatePenalties(this); } @@ -261,7 +290,8 @@ Constraint::SetPenaltyPos(double value) { fPenaltyPos = value; - fLS->UpdateLeftSide(this); + if (fLS != NULL) + fLS->UpdatePenalties(this); } @@ -279,49 +309,10 @@ Constraint::SetLabel(const char* label) } -/** - * Gets the slack variable for the negative variations. - * - * @return the slack variable for the negative variations - */ -Variable* -Constraint::DNeg() const -{ - if (fDNegObjSummand == NULL) - return NULL; - return fDNegObjSummand->Var(); -} - - -/** - * Gets the slack variable for the positive variations. - * - * @return the slack variable for the positive variations - */ -Variable* -Constraint::DPos() const -{ - if (fDPosObjSummand == NULL) - return NULL; - return fDPosObjSummand->Var(); -} - - -bool -Constraint::IsSoft() const -{ - if (fOp != kEQ) - return false; - if (fPenaltyNeg > 0. || fPenaltyPos > 0.) - return true; - return false; -} - - bool Constraint::IsValid() { - return fIsValid; + return fLS != NULL; } @@ -330,11 +321,11 @@ Constraint::Invalidate() { STRACE(("Constraint::Invalidate() on %d\n", this)); - if (!fIsValid) + if (fLS == NULL) return; - fIsValid = false; fLS->RemoveConstraint(this, false); + fLS = NULL; } @@ -346,25 +337,23 @@ Constraint::ToString() const string << fLabel; string << "(" << (int32)this << "): "; - if (fIsValid) { - for (int i = 0; i < fLeftSide->CountItems(); i++) { - Summand* s = static_cast(fLeftSide->ItemAt(i)); - if (i != 0 && s->Coeff() >= 0) - string << " + "; - string << (float)s->Coeff() << "*"; - string << "x"; - string << s->Var()->Index(); - string << " "; - } - string << ((fOp == kEQ) ? "== " - : (fOp == kGE) ? ">= " - : (fOp == kLE) ? "<= " - : "?? "); - string << (float)fRightSide; - string << " PenaltyPos=" << (float)PenaltyPos(); - string << " PenaltyNeg=" << (float)PenaltyNeg(); - } else - string << "invalid"; + for (int i = 0; i < fLeftSide->CountItems(); i++) { + Summand* s = static_cast(fLeftSide->ItemAt(i)); + if (i != 0 && s->Coeff() >= 0) + string << " + "; + string << (float)s->Coeff() << "*"; + string << "x"; + string << s->Var()->Index(); + string << " "; + } + string << ((fOp == kEQ) ? "== " + : (fOp == kGE) ? ">= " + : (fOp == kLE) ? "<= " + : "?? "); + string << (float)fRightSide; + string << " PenaltyPos=" << (float)PenaltyPos(); + string << " PenaltyNeg=" << (float)PenaltyNeg(); + return string; } @@ -384,15 +373,13 @@ Constraint::Constraint(LinearSpec* ls, SummandList* summands, OperatorType op, double rightSide, double penaltyNeg, double penaltyPos) : fLS(ls), + fLeftSide(NULL), fOp(op), fRightSide(rightSide), fPenaltyNeg(penaltyNeg), - fPenaltyPos(penaltyPos), - fDNegObjSummand(NULL), - fDPosObjSummand(NULL), - fIsValid(true) + fPenaltyPos(penaltyPos) { - SetLeftSide(summands); + SetLeftSide(summands, false); } From cf5eb5dda1cbabf89bb14b9b497deefeb6351eb6 Mon Sep 17 00:00:00 2001 From: czeidler Date: Sat, 1 Sep 2012 15:40:43 +1200 Subject: [PATCH 14/21] Add a LinearSpec listener interface. --- headers/libs/linprog/LinearSpec.h | 81 +++++---- src/libs/linprog/LinearSpec.cpp | 279 ++++++++++++++++-------------- 2 files changed, 196 insertions(+), 164 deletions(-) diff --git a/headers/libs/linprog/LinearSpec.h b/headers/libs/linprog/LinearSpec.h index b0dc5adbb2..fffb4118db 100644 --- a/headers/libs/linprog/LinearSpec.h +++ b/headers/libs/linprog/LinearSpec.h @@ -7,9 +7,7 @@ #ifndef LINEAR_SPEC_H #define LINEAR_SPEC_H -#include - -#include +#include #include #include #include @@ -36,7 +34,7 @@ class SolverInterface { public: SolverInterface(LinearSpec* linSpec); - virtual ~SolverInterface() {} + virtual ~SolverInterface(); virtual ResultType Solve() = 0; @@ -49,12 +47,10 @@ public: virtual bool LeftSideChanged(Constraint* constraint) = 0; virtual bool RightSideChanged(Constraint* constraint) = 0; virtual bool OperatorChanged(Constraint* constraint) = 0; + virtual bool PenaltiesChanged(Constraint* constraint) = 0; virtual bool SaveModel(const char* fileName) = 0; - virtual BSize MinSize(Variable* width, Variable* height) = 0; - virtual BSize MaxSize(Variable* width, Variable* height) = 0; - virtual ResultType FindMins(const VariableList* variables) = 0; virtual ResultType FindMaxs(const VariableList* variables) = 0; @@ -63,10 +59,26 @@ public: const Constraint** _max) const = 0; protected: + bool AddConstraint(Constraint* constraint, + bool notifyListener); + bool RemoveConstraint(Constraint* constraint, + bool deleteConstraint, bool notifyListener); + LinearSpec* fLinearSpec; }; +class SpecificationListener { +public: + virtual ~SpecificationListener(); + + virtual void VariableAdded(Variable* variable); + virtual void VariableRemoved(Variable* variable); + virtual void ConstraintAdded(Constraint* constraint); + virtual void ConstraintRemoved(Constraint* constraint); +}; + + /*! * Specification of a linear programming problem. */ @@ -75,6 +87,10 @@ public: LinearSpec(); virtual ~LinearSpec(); + /*! Does not takes ownership of the listener. */ + bool AddListener(SpecificationListener* listener); + bool RemoveListener(SpecificationListener* listener); + Variable* AddVariable(); bool AddVariable(Variable* variable); bool RemoveVariable(Variable* variable, @@ -87,47 +103,32 @@ public: bool RemoveConstraint(Constraint* constraint, bool deleteConstraint = true); - Constraint* AddConstraint(SummandList* summands, - OperatorType op, double rightSide); - Constraint* AddConstraint(double coeff1, Variable* var1, - OperatorType op, double rightSide); - Constraint* AddConstraint(double coeff1, Variable* var1, - double coeff2, Variable* var2, - OperatorType op, double rightSide); - Constraint* AddConstraint(double coeff1, Variable* var1, - double coeff2, Variable* var2, - double coeff3, Variable* var3, - OperatorType op, double rightSide); - Constraint* AddConstraint(double coeff1, Variable* var1, - double coeff2, Variable* var2, - double coeff3, Variable* var3, - double coeff4, Variable* var4, - OperatorType op, double rightSide); - Constraint* AddConstraint(SummandList* summands, OperatorType op, double rightSide, - double penaltyNeg, double penaltyPos); + double penaltyNeg = -1, + double penaltyPos = -1); Constraint* AddConstraint(double coeff1, Variable* var1, OperatorType op, double rightSide, - double penaltyNeg, double penaltyPos); + double penaltyNeg = -1, + double penaltyPos = -1); Constraint* AddConstraint(double coeff1, Variable* var1, double coeff2, Variable* var2, OperatorType op, double rightSide, - double penaltyNeg, double penaltyPos); + double penaltyNeg = -1, + double penaltyPos = -1); Constraint* AddConstraint(double coeff1, Variable* var1, double coeff2, Variable* var2, double coeff3, Variable* var3, OperatorType op, double rightSide, - double penaltyNeg, double penaltyPos); + double penaltyNeg = -1, + double penaltyPos = -1); Constraint* AddConstraint(double coeff1, Variable* var1, double coeff2, Variable* var2, double coeff3, Variable* var3, double coeff4, Variable* var4, OperatorType op, double rightSide, - double penaltyNeg, double penaltyPos); - - BSize MinSize(Variable* width, Variable* height); - BSize MaxSize(Variable* width, Variable* height); + double penaltyNeg = -1, + double penaltyPos = -1); ResultType FindMins(const VariableList* variables); ResultType FindMaxs(const VariableList* variables); @@ -151,9 +152,18 @@ public: protected: friend class Constraint; - bool UpdateLeftSide(Constraint* constraint); + friend class SolverInterface; + + bool UpdateLeftSide(Constraint* constraint, + const SummandList* oldSummands); bool UpdateRightSide(Constraint* constraint); bool UpdateOperator(Constraint* constraint); + bool UpdatePenalties(Constraint* constraint); + + bool AddConstraint(Constraint* constraint, + bool notifyListener); + bool RemoveConstraint(Constraint* constraint, + bool deleteConstraint, bool notifyListener); private: /*! Check if all entries != NULL otherwise delete the list and its entries. */ @@ -162,6 +172,9 @@ private: OperatorType op, double rightSide, double penaltyNeg, double penaltyPos); + void _AddConstraintRef(Variable* var); + void _RemoveConstraintRef(Variable* var); + VariableList fVariables; VariableList fUsedVariables; ConstraintList fConstraints; @@ -169,6 +182,8 @@ private: bigtime_t fSolvingTime; SolverInterface* fSolver; + + BObjectList fListeners; }; } // namespace LinearProgramming diff --git a/src/libs/linprog/LinearSpec.cpp b/src/libs/linprog/LinearSpec.cpp index a266f0485f..cb7137ed65 100644 --- a/src/libs/linprog/LinearSpec.cpp +++ b/src/libs/linprog/LinearSpec.cpp @@ -9,7 +9,6 @@ #include "LinearSpec.h" #include -#include #include "ActiveSetSolver.h" @@ -35,6 +34,56 @@ SolverInterface::SolverInterface(LinearSpec* linSpec) } +SolverInterface::~SolverInterface() +{ +} + + +bool +SolverInterface::AddConstraint(Constraint* constraint, bool notifyListener) +{ + return fLinearSpec->AddConstraint(constraint, notifyListener); +} + + +bool +SolverInterface::RemoveConstraint(Constraint* constraint, bool deleteConstraint, + bool notifyListener) +{ + return fLinearSpec->RemoveConstraint(constraint, deleteConstraint, + notifyListener); +} + + +SpecificationListener::~SpecificationListener() +{ +} + + +void +SpecificationListener::VariableAdded(Variable* variable) +{ +} + + +void +SpecificationListener::VariableRemoved(Variable* variable) +{ +} + + +void +SpecificationListener::ConstraintAdded(Constraint* constraint) +{ +} + + +void +SpecificationListener::ConstraintRemoved(Constraint* constraint) +{ +} + + /** * Constructor. * Creates a new specification for a linear programming problem. @@ -64,6 +113,20 @@ LinearSpec::~LinearSpec() } +bool +LinearSpec::AddListener(SpecificationListener* listener) +{ + return fListeners.AddItem(listener); +} + + +bool +LinearSpec::RemoveListener(SpecificationListener* listener) +{ + return fListeners.RemoveItem(listener); +} + + /** * Adds a new variable to the specification. * @@ -106,6 +169,10 @@ LinearSpec::AddVariable(Variable* variable) RemoveVariable(variable, false); return false; } + + for (int32 i = 0; i < fListeners.CountItems(); i++) + fListeners.ItemAt(i)->VariableAdded(variable); + return true; } @@ -121,7 +188,6 @@ LinearSpec::RemoveVariable(Variable* variable, bool deleteVariable) if (fVariables.RemoveItem(variable) == false) return false; fUsedVariables.RemoveItem(variable); - variable->fIsValid = false; // invalidate all constraints that use this variable @@ -130,9 +196,6 @@ LinearSpec::RemoveVariable(Variable* variable, bool deleteVariable) for (int i = 0; i < constraints.CountItems(); i++) { Constraint* constraint = constraints.ItemAt(i); - if (!constraint->IsValid()) - continue; - SummandList* summands = constraint->LeftSide(); for (int j = 0; j < summands->CountItems(); j++) { Summand* summand = summands->ItemAt(j); @@ -145,9 +208,12 @@ LinearSpec::RemoveVariable(Variable* variable, bool deleteVariable) for (int i = 0; i < markedForInvalidation.CountItems(); i++) RemoveConstraint(markedForInvalidation.ItemAt(i)); - if (deleteVariable) delete variable; + + for (int32 i = 0; i < fListeners.CountItems(); i++) + fListeners.ItemAt(i)->VariableRemoved(variable); + return true; } @@ -177,6 +243,20 @@ LinearSpec::UpdateRange(Variable* variable) bool LinearSpec::AddConstraint(Constraint* constraint) +{ + return AddConstraint(constraint, true); +} + + +bool +LinearSpec::RemoveConstraint(Constraint* constraint, bool deleteConstraint) +{ + return RemoveConstraint(constraint, deleteConstraint, true); +} + + +bool +LinearSpec::AddConstraint(Constraint* constraint, bool notifyListener) { if (!fConstraints.AddItem(constraint)) return false; @@ -185,8 +265,7 @@ LinearSpec::AddConstraint(Constraint* constraint) SummandList* leftSide = constraint->LeftSide(); for (int i = 0; i < leftSide->CountItems(); i++) { Variable* var = leftSide->ItemAt(i)->Var(); - if (var->AddReference() == 1) - fUsedVariables.AddItem(var); + _AddConstraintRef(var); } if (!fSolver->ConstraintAdded(constraint)) { @@ -194,35 +273,79 @@ LinearSpec::AddConstraint(Constraint* constraint) return false; } - constraint->fIsValid = true; + constraint->fLS = this; + + if (notifyListener) { + for (int32 i = 0; i < fListeners.CountItems(); i++) + fListeners.ItemAt(i)->ConstraintAdded(constraint); + } + return true; } bool -LinearSpec::RemoveConstraint(Constraint* constraint, bool deleteConstraint) +LinearSpec::RemoveConstraint(Constraint* constraint, bool deleteConstraint, + bool notifyListener) { fSolver->ConstraintRemoved(constraint); if (!fConstraints.RemoveItem(constraint)) return false; - constraint->fIsValid = false; SummandList* leftSide = constraint->LeftSide(); - for (int i = 0; i < leftSide->CountItems(); i++) { + for (int32 i = 0; i < leftSide->CountItems(); i++) { Variable* var = leftSide->ItemAt(i)->Var(); - if (var->RemoveReference() == 0) - fUsedVariables.RemoveItem(var); + _RemoveConstraintRef(var); } + if (notifyListener) { + for (int32 i = 0; i < fListeners.CountItems(); i++) + fListeners.ItemAt(i)->ConstraintRemoved(constraint); + } + + constraint->fLS = NULL; if (deleteConstraint) delete constraint; + return true; } -bool -LinearSpec::UpdateLeftSide(Constraint* constraint) +void +LinearSpec::_AddConstraintRef(Variable* var) { + if (var->AddReference() == 1) + fUsedVariables.AddItem(var); +} + + +void +LinearSpec::_RemoveConstraintRef(Variable* var) +{ + if (var->RemoveReference() == 0) + fUsedVariables.RemoveItem(var); +} + + +bool +LinearSpec::UpdateLeftSide(Constraint* constraint, + const SummandList* oldSummands) +{ + SummandList* leftSide = constraint->LeftSide(); + if (leftSide != NULL) { + for (int32 i = 0; i < leftSide->CountItems(); i++) { + Variable* var = leftSide->ItemAt(i)->Var(); + _AddConstraintRef(var); + } + } + if (oldSummands != NULL) { + // the summands have changed, update the var ref count + for (int32 i = 0; i < oldSummands->CountItems(); i++) { + Variable* var = oldSummands->ItemAt(i)->Var(); + _RemoveConstraintRef(var); + } + } + if (!fSolver->LeftSideChanged(constraint)) return false; return true; @@ -247,105 +370,12 @@ LinearSpec::UpdateOperator(Constraint* constraint) } -/** - * Adds a new hard linear constraint to the specification. - * - * @param coeffs the constraint's coefficients - * @param vars the constraint's variables - * @param op the constraint's operand - * @param rightSide the constant value on the constraint's right side - * @return the new constraint - */ -Constraint* -LinearSpec::AddConstraint(SummandList* summands, OperatorType op, - double rightSide) +bool +LinearSpec::UpdatePenalties(Constraint* constraint) { - return AddConstraint(summands, op, rightSide, -1, -1); -} - - -/** - * Adds a new hard linear constraint to the specification with a single summand. - * - * @param coeff1 the constraint's first coefficient - * @param var1 the constraint's first variable - * @param op the constraint's operand - * @param rightSide the constant value on the constraint's right side - * @return the new constraint - */ -Constraint* -LinearSpec::AddConstraint(double coeff1, Variable* var1, - OperatorType op, double rightSide) -{ - return AddConstraint(coeff1, var1, op, rightSide, -1, -1); -} - - -/** - * Adds a new hard linear constraint to the specification with two summands. - * - * @param coeff1 the constraint's first coefficient - * @param var1 the constraint's first variable - * @param coeff2 the constraint's second coefficient - * @param var2 the constraint's second variable - * @param op the constraint's operand - * @param rightSide the constant value on the constraint's right side - * @return the new constraint - */ -Constraint* -LinearSpec::AddConstraint(double coeff1, Variable* var1, - double coeff2, Variable* var2, OperatorType op, double rightSide) -{ - return AddConstraint(coeff1, var1, coeff2, var2, op, rightSide, -1, - -1); -} - - -/** - * Adds a new hard linear constraint to the specification with three summands. - * - * @param coeff1 the constraint's first coefficient - * @param var1 the constraint's first variable - * @param coeff2 the constraint's second coefficient - * @param var2 the constraint's second variable - * @param coeff3 the constraint's third coefficient - * @param var3 the constraint's third variable - * @param op the constraint's operand - * @param rightSide the constant value on the constraint's right side - * @return the new constraint - */ -Constraint* -LinearSpec::AddConstraint(double coeff1, Variable* var1, - double coeff2, Variable* var2, double coeff3, Variable* var3, - OperatorType op, double rightSide) -{ - return AddConstraint(coeff1, var1, coeff2, var2, coeff3, var3, op, - rightSide, -1, -1); -} - - -/** - * Adds a new hard linear constraint to the specification with four summands. - * - * @param coeff1 the constraint's first coefficient - * @param var1 the constraint's first variable - * @param coeff2 the constraint's second coefficient - * @param var2 the constraint's second variable - * @param coeff3 the constraint's third coefficient - * @param var3 the constraint's third variable - * @param coeff4 the constraint's fourth coefficient - * @param var4 the constraint's fourth variable - * @param op the constraint's operand - * @param rightSide the constant value on the constraint's right side - * @return the new constraint - */ -Constraint* -LinearSpec::AddConstraint(double coeff1, Variable* var1, - double coeff2, Variable* var2, double coeff3, Variable* var3, - double coeff4, Variable* var4, OperatorType op, double rightSide) -{ - return AddConstraint(coeff1, var1, coeff2, var2, coeff3, var3, coeff4, var4, - op, rightSide, -1, -1); + if (!fSolver->PenaltiesChanged(constraint)) + return false; + return true; } @@ -486,32 +516,19 @@ LinearSpec::AddConstraint(double coeff1, Variable* var1, } -BSize -LinearSpec::MinSize(Variable* width, Variable* height) -{ - return fSolver->MinSize(width, height); -} - - -BSize -LinearSpec::MaxSize(Variable* width, Variable* height) -{ - return fSolver->MaxSize(width, height); -} - - - ResultType LinearSpec::FindMins(const VariableList* variables) { - return fSolver->FindMins(variables); + fResult = fSolver->FindMins(variables); + return fResult; } ResultType LinearSpec::FindMaxs(const VariableList* variables) { - return fSolver->FindMaxs(variables); + fResult = fSolver->FindMaxs(variables); + return fResult; } From 18e5da6297639dd15fea0b021d22d394a4ab1852 Mon Sep 17 00:00:00 2001 From: czeidler Date: Sat, 1 Sep 2012 15:41:21 +1200 Subject: [PATCH 15/21] Remove unused variable and add copy constructor. --- headers/libs/linprog/Summand.h | 2 +- src/libs/linprog/Summand.cpp | 42 ++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/headers/libs/linprog/Summand.h b/headers/libs/linprog/Summand.h index 92efe1cb06..8c8ff2c0a6 100644 --- a/headers/libs/linprog/Summand.h +++ b/headers/libs/linprog/Summand.h @@ -19,6 +19,7 @@ class Variable; */ class Summand { public: + Summand(Summand* summand); Summand(double coeff, Variable* var); ~Summand(); @@ -31,7 +32,6 @@ public: private: double fCoeff; Variable* fVar; - bool fUsedInPenaltyFunction; //not set yet }; typedef BObjectList SummandList; diff --git a/src/libs/linprog/Summand.cpp b/src/libs/linprog/Summand.cpp index 1e98e10219..66931de6c8 100644 --- a/src/libs/linprog/Summand.cpp +++ b/src/libs/linprog/Summand.cpp @@ -9,6 +9,28 @@ #include "Variable.h" +Summand::Summand(Summand* summand) + : + fCoeff(summand->Coeff()), + fVar(summand->Var()) +{ +} + + +Summand::Summand(double coeff, Variable* var) + : + fCoeff(coeff), + fVar(var) +{ +} + + +Summand::~Summand() +{ + +} + + /** * Gets the summmand's coefficient. * @@ -62,23 +84,3 @@ Summand::VariableIndex() { return fVar->Index(); } - - -/** - * Destructor. - */ -Summand::~Summand() -{ - -} - - -/** - * Constructor. - */ -Summand::Summand(double coeff, Variable* var) -{ - fCoeff = coeff; - fVar = var; - fUsedInPenaltyFunction = false; -} From 25e1abc33cf97fa29501de74738b7a4a874df82e Mon Sep 17 00:00:00 2001 From: czeidler Date: Sat, 1 Sep 2012 15:43:46 +1200 Subject: [PATCH 16/21] Use soft inequality constraints for the max area size. Only if the alignment is set to use the full width/ height a hard inequality constraint is used. --- src/libs/alm/Area.cpp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/libs/alm/Area.cpp b/src/libs/alm/Area.cpp index 981c2faa88..9093ea82c6 100644 --- a/src/libs/alm/Area.cpp +++ b/src/libs/alm/Area.cpp @@ -549,6 +549,8 @@ Area::_Init(LinearSpec* ls, XTab* left, YTab* top, XTab* right, YTab* bottom, // really above the bottom y-tab fMinContentWidth = ls->AddConstraint(-1.0, fLeft, 1.0, fRight, kGE, 0); fMinContentHeight = ls->AddConstraint(-1.0, fTop, 1.0, fBottom, kGE, 0); + + InvalidateSizeConstraints(); } @@ -619,26 +621,41 @@ Area::_UpdateMaxSizeConstraint(BSize max) max.width += LeftInset() + RightInset(); max.height += TopInset() + BottomInset(); + const double kPriority = 100; // we only need max constraints if the alignment is full height/width // otherwise we can just align the item in the free space BAlignment alignment = fLayoutItem->Alignment(); - if (alignment.Vertical() == B_ALIGN_USE_FULL_HEIGHT) { + double priority = kPriority; + if (alignment.Vertical() == B_ALIGN_USE_FULL_HEIGHT) + priority = -1; + + if (max.Height() < 20000) { if (fMaxContentHeight == NULL) { fMaxContentHeight = fLS->AddConstraint(-1.0, fTop, 1.0, fBottom, - kLE, max.Height()); - } else + kLE, max.Height(), priority, priority); + } else { fMaxContentHeight->SetRightSide(max.Height()); + fMaxContentHeight->SetPenaltyNeg(priority); + fMaxContentHeight->SetPenaltyPos(priority); + } } else { delete fMaxContentHeight; fMaxContentHeight = NULL; } - if (alignment.Horizontal() == B_ALIGN_USE_FULL_WIDTH) { + priority = kPriority; + if (alignment.Horizontal() == B_ALIGN_USE_FULL_WIDTH) + priority = -1; + + if (max.Width() < 20000) { if (fMaxContentWidth == NULL) { fMaxContentWidth = fLS->AddConstraint(-1.0, fLeft, 1.0, fRight, kLE, - max.Width()); - } else + max.Width(), priority, priority); + } else { fMaxContentWidth->SetRightSide(max.Width()); + fMaxContentWidth->SetPenaltyNeg(priority); + fMaxContentWidth->SetPenaltyPos(priority); + } } else { delete fMaxContentWidth; fMaxContentWidth = NULL; From de679878b7397d13c743a6bff9426593172de286 Mon Sep 17 00:00:00 2001 From: czeidler Date: Sat, 1 Sep 2012 15:45:59 +1200 Subject: [PATCH 17/21] Ceil and floor min and max size respectively gives better results. --- src/libs/alm/SharedSolver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/alm/SharedSolver.cpp b/src/libs/alm/SharedSolver.cpp index f46da7e997..10a83d0a04 100644 --- a/src/libs/alm/SharedSolver.cpp +++ b/src/libs/alm/SharedSolver.cpp @@ -38,8 +38,8 @@ struct SharedSolver::MinSizeValidator { if (solveResult == LinearProgramming::kUnbounded) { solver->SetMinSize(layout, BSize(0, 0)); } else { - solver->SetMinSize(layout, BSize(layout->Right()->Value(), - layout->Bottom()->Value())); + solver->SetMinSize(layout, BSize(ceilf(layout->Right()->Value()), + ceilf(layout->Bottom()->Value()))); } } }; @@ -58,8 +58,8 @@ struct SharedSolver::MaxSizeValidator { solver->SetMaxSize(layout, BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); } else { - solver->SetMaxSize(layout, BSize(layout->Right()->Value(), - layout->Bottom()->Value())); + solver->SetMaxSize(layout, BSize(floorf(layout->Right()->Value()), + floorf(layout->Bottom()->Value()))); } } }; From 3a7067dc19a8d8b2064d380de6e3ab9ec33f6191 Mon Sep 17 00:00:00 2001 From: czeidler Date: Sat, 1 Sep 2012 15:46:31 +1200 Subject: [PATCH 18/21] Improve ToString output. --- src/libs/linprog/Variable.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/libs/linprog/Variable.cpp b/src/libs/linprog/Variable.cpp index 2febce1cff..880b38882d 100644 --- a/src/libs/linprog/Variable.cpp +++ b/src/libs/linprog/Variable.cpp @@ -8,9 +8,7 @@ #include "Variable.h" -#include // for DBL_MAX - -#include +#include #include "Constraint.h" #include "LinearSpec.h" @@ -167,18 +165,22 @@ Variable::SetLabel(const char* label) BString Variable::ToString() const { - BString string; + BString string = "x"; + string << Index() << " "; if (fLabel) { - string << fLabel; + string << fLabel << ": "; if (!fIsValid) string << "(invalid)"; } else { - string << "Variable "; if (!fIsValid) string << "(invalid," << (int32)this << ")"; else - string << Index(); + string << Index() << ": "; } + string << Value(); + BString pointerString; + pointerString.SetToFormat("%p", this); + string << " (" << pointerString << ")"; return string; } From a8859a43fb77d94014bb017f17db6528526141dd Mon Sep 17 00:00:00 2001 From: czeidler Date: Sat, 1 Sep 2012 15:47:22 +1200 Subject: [PATCH 19/21] The preferred size constraints have a label now. This helps for debugging. --- src/libs/alm/RowColumnManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/alm/RowColumnManager.cpp b/src/libs/alm/RowColumnManager.cpp index ebd4e223bf..84afb9d1fe 100644 --- a/src/libs/alm/RowColumnManager.cpp +++ b/src/libs/alm/RowColumnManager.cpp @@ -193,7 +193,8 @@ RowColumnManager::_UpdateConstraints(Row* row) if (prefSize >= 0) { if (row->fPrefSizeConstraint == NULL) { row->fPrefSizeConstraint = fLinearSpec->AddConstraint(1, - row->fBottom, -1, row->fTop, kEQ, prefSize, weight, weight); + row->fBottom, -1, row->fTop, kEQ, prefSize, weight, weight); + row->fPrefSizeConstraint->SetLabel("Pref Height"); } else { row->fPrefSizeConstraint->SetRightSide(prefSize); row->fPrefSizeConstraint->SetPenaltyNeg(weight); @@ -216,6 +217,7 @@ RowColumnManager::_UpdateConstraints(Column* column) column->fPrefSizeConstraint = fLinearSpec->AddConstraint(1, column->fRight, -1, column->fLeft, kEQ, prefSize, weight, weight); + column->fPrefSizeConstraint->SetLabel("Pref Width"); } else { column->fPrefSizeConstraint->SetRightSide(prefSize); column->fPrefSizeConstraint->SetPenaltyNeg(weight); From 82fbed2596bef370bc003ed4de174234be0787b3 Mon Sep 17 00:00:00 2001 From: czeidler Date: Sat, 1 Sep 2012 15:49:34 +1200 Subject: [PATCH 20/21] Move the soft inequalities directly into the solver. - Clean up. --- src/libs/linprog/ActiveSetSolver.cpp | 176 +++++++++++++++---------- src/libs/linprog/ActiveSetSolver.h | 11 +- src/libs/linprog/Jamfile | 1 - src/libs/linprog/LayoutOptimizer.cpp | 58 ++------ src/libs/linprog/LayoutOptimizer.h | 3 + src/libs/linprog/QPSolverInterface.cpp | 99 -------------- src/libs/linprog/QPSolverInterface.h | 43 ------ 7 files changed, 126 insertions(+), 265 deletions(-) delete mode 100644 src/libs/linprog/QPSolverInterface.cpp delete mode 100644 src/libs/linprog/QPSolverInterface.h diff --git a/src/libs/linprog/ActiveSetSolver.cpp b/src/libs/linprog/ActiveSetSolver.cpp index 95c98281e4..9410e38229 100644 --- a/src/libs/linprog/ActiveSetSolver.cpp +++ b/src/libs/linprog/ActiveSetSolver.cpp @@ -18,7 +18,6 @@ // #define DEBUG_ACTIVE_SOLVER #ifdef DEBUG_ACTIVE_SOLVER -#include #define TRACE(x...) printf(x) #else #define TRACE(x...) /* nothing */ @@ -82,6 +81,17 @@ EquationSystem::Columns() } +bool +EquationSystem::InRange(int32 row, int32 column) +{ + if (row < 0 || row >= fRows) + return false; + if (column < 0 || column >= fColumns) + return false; + return true; +} + + double& EquationSystem::A(int32 row, int32 column) { @@ -187,10 +197,6 @@ EquationSystem::GaussJordan(int32 i) void EquationSystem::RemoveLinearlyDependentRows() { - double oldB[fRows]; - for (int r = 0; r < fRows; r++) - oldB[r] = fB[r]; - double** temp = allocate_matrix(fRows, fColumns); bool independentRows[fRows]; @@ -315,7 +321,7 @@ AddMaxConstraint(LinearSpec* spec, Variable* var) ActiveSetSolver::ActiveSetSolver(LinearSpec* linearSpec) : - QPSolverInterface(linearSpec), + SolverInterface(linearSpec), fVariables(linearSpec->UsedVariables()), fConstraints(linearSpec->Constraints()) @@ -384,10 +390,77 @@ solve(EquationSystem& system) } +static bool is_soft_inequality(Constraint* constraint) +{ + if (constraint->PenaltyNeg() <= 0. && constraint->PenaltyPos() <= 0.) + return false; + if (constraint->Op() != kEQ) + return true; + return false; +} + + +class SoftInequalityAdder { +public: + SoftInequalityAdder(LinearSpec* linSpec, ConstraintList& allConstraints) + : + fLinearSpec(linSpec) + { + for (int32 c = 0; c < allConstraints.CountItems(); c++) { + Constraint* constraint = allConstraints.ItemAt(c); + if (!is_soft_inequality(constraint)) + continue; + + Variable* variable = fLinearSpec->AddVariable(); + variable->SetRange(0, 20000); + + Constraint* helperConst = fLinearSpec->AddConstraint(1, variable, + kEQ, 0, constraint->PenaltyNeg(), constraint->PenaltyPos()); + fInequalitySoftConstraints.AddItem(helperConst); + + double coeff = -1; + if (constraint->Op() == kGE) + coeff = 1; + + Constraint* modifiedConstraint = new Constraint(constraint); + allConstraints.AddItem(modifiedConstraint, c); + allConstraints.RemoveItemAt(c + 1); + fModifiedIneqConstraints.AddItem(modifiedConstraint); + modifiedConstraint->LeftSide()->AddItem( + new Summand(coeff, variable)); + } + for (int32 c = 0; c < fInequalitySoftConstraints.CountItems(); c++) + allConstraints.AddItem(fInequalitySoftConstraints.ItemAt(c)); + } + + ~SoftInequalityAdder() + { + for (int32 c = 0; c < fModifiedIneqConstraints.CountItems(); c++) + delete fModifiedIneqConstraints.ItemAt(c); + for (int32 c = 0; c < fInequalitySoftConstraints.CountItems(); c++) { + Constraint* con = fInequalitySoftConstraints.ItemAt(c); + fLinearSpec->RemoveVariable(con->LeftSide()->ItemAt(0)->Var()); + // this also deletes the constraint + } + } + +private: + LinearSpec* fLinearSpec; + ConstraintList fModifiedIneqConstraints; + ConstraintList fInequalitySoftConstraints; +}; + + ResultType ActiveSetSolver::Solve() { - int32 nConstraints = fConstraints.CountItems(); + + // make a copy of the original constraints and create soft inequality + // constraints + ConstraintList allConstraints(fConstraints); + SoftInequalityAdder adder(fLinearSpec, allConstraints); + + int32 nConstraints = allConstraints.CountItems(); int32 nVariables = fVariables.CountItems(); if (nVariables > nConstraints) { @@ -404,15 +477,16 @@ ActiveSetSolver::Solve() // setup constraint matrix and add slack variables if necessary int32 rowIndex = 0; for (int32 c = 0; c < nConstraints; c++) { - Constraint* constraint = fConstraints.ItemAt(c); - if (constraint->IsSoft()) + Constraint* constraint = allConstraints.ItemAt(c); + if (is_soft(constraint)) continue; SummandList* leftSide = constraint->LeftSide(); system.B(rowIndex) = constraint->RightSide(); for (int32 sIndex = 0; sIndex < leftSide->CountItems(); sIndex++ ) { Summand* summand = leftSide->ItemAt(sIndex); double coefficient = summand->Coeff(); - system.A(rowIndex, summand->VariableIndex()) = coefficient; + int32 columnIndex = summand->VariableIndex(); + system.A(rowIndex, columnIndex) = coefficient; } if (constraint->Op() == kLE) { system.A(rowIndex, slackIndex) = 1; @@ -436,8 +510,9 @@ ActiveSetSolver::Solve() system.Results(results, nVariables + nConstraints); TRACE("base system solved\n"); - LayoutOptimizer optimizer(fConstraints, nVariables); - optimizer.Solve(results); + LayoutOptimizer optimizer(allConstraints, nVariables); + if (!optimizer.Solve(results)) + return kInfeasible; // back to the variables for (int32 i = 0; i < nVariables; i++) @@ -487,6 +562,7 @@ ActiveSetSolver::VariableRangeChanged(Variable* variable) constraintGE = fLinearSpec->AddConstraint(1, variable, kGE, 0); if (constraintGE == NULL) return false; + constraintGE->SetLabel("Var Min"); fVariableGEConstraints.RemoveItemAt(variableIndex); fVariableGEConstraints.AddItem(constraintGE, variableIndex); } @@ -494,6 +570,7 @@ ActiveSetSolver::VariableRangeChanged(Variable* variable) constraintLE = fLinearSpec->AddConstraint(1, variable, kLE, 20000); if (constraintLE == NULL) return false; + constraintLE->SetLabel("Var Max"); fVariableLEConstraints.RemoveItemAt(variableIndex); fVariableLEConstraints.AddItem(constraintLE, variableIndex); } @@ -509,14 +586,14 @@ ActiveSetSolver::VariableRangeChanged(Variable* variable) bool ActiveSetSolver::ConstraintAdded(Constraint* constraint) { - return QPSolverInterface::ConstraintAdded(constraint); + return true; } bool ActiveSetSolver::ConstraintRemoved(Constraint* constraint) { - return QPSolverInterface::ConstraintRemoved(constraint); + return true; } @@ -541,6 +618,13 @@ ActiveSetSolver::OperatorChanged(Constraint* constraint) } +bool +ActiveSetSolver::PenaltiesChanged(Constraint* constraint) +{ + return true; +} + + bool ActiveSetSolver::SaveModel(const char* fileName) { @@ -548,57 +632,6 @@ ActiveSetSolver::SaveModel(const char* fileName) } -BSize -ActiveSetSolver::MinSize(Variable* width, Variable* height) -{ - ConstraintList softConstraints; - _RemoveSoftConstraint(softConstraints); - - Constraint* heightConstraint = fLinearSpec->AddConstraint(1, height, - kEQ, 0, 5, 5); - Constraint* widthConstraint = fLinearSpec->AddConstraint(1, width, - kEQ, 0, 5, 5); - ResultType result = Solve(); - fLinearSpec->RemoveConstraint(heightConstraint); - fLinearSpec->RemoveConstraint(widthConstraint); - - _AddSoftConstraint(softConstraints); - - if (result == kUnbounded) - return kMinSize; - if (result != kOptimal) - TRACE("Could not solve the layout specification (%d). ", result); - - return BSize(width->Value(), height->Value()); -} - - -BSize -ActiveSetSolver::MaxSize(Variable* width, Variable* height) -{ - ConstraintList softConstraints; - _RemoveSoftConstraint(softConstraints); - - const double kHugeValue = 32000; - Constraint* heightConstraint = fLinearSpec->AddConstraint(1, height, - kEQ, kHugeValue, 5, 5); - Constraint* widthConstraint = fLinearSpec->AddConstraint(1, width, - kEQ, kHugeValue, 5, 5); - ResultType result = Solve(); - fLinearSpec->RemoveConstraint(heightConstraint); - fLinearSpec->RemoveConstraint(widthConstraint); - - _AddSoftConstraint(softConstraints); - - if (result == kUnbounded) - return kMaxSize; - if (result != kOptimal) - TRACE("Could not solve the layout specification (%d). ", result); - - return BSize(width->Value(), height->Value()); -} - - ResultType ActiveSetSolver::FindMaxs(const VariableList* variables) { @@ -632,10 +665,11 @@ ActiveSetSolver::_RemoveSoftConstraint(ConstraintList& list) ConstraintList allConstraints = fLinearSpec->Constraints(); for (int i = 0; i < allConstraints.CountItems(); i++) { Constraint* constraint = allConstraints.ItemAt(i); - if (!constraint->IsSoft()) + // soft eq an ineq constraint? + if (constraint->PenaltyNeg() <= 0. && constraint->PenaltyPos() <= 0.) continue; - if (fLinearSpec->RemoveConstraint(constraint, false) == true) + if (RemoveConstraint(constraint, false, false) == true) list.AddItem(constraint); } } @@ -647,7 +681,7 @@ ActiveSetSolver::_AddSoftConstraint(const ConstraintList& list) for (int i = 0; i < list.CountItems(); i++) { Constraint* constraint = list.ItemAt(i); // at least don't leak it - if (fLinearSpec->AddConstraint(constraint) == false) + if (AddConstraint(constraint, false) == false) delete constraint; } } @@ -661,13 +695,11 @@ ActiveSetSolver::_FindWithConstraintsNoSoft(const VariableList* variables, _RemoveSoftConstraint(softConstraints); ConstraintList constraints; - for (int32 i = variables->CountItems() - 1; i >= 0; i--) { + for (int32 i = 0; i < variables->CountItems(); i++) constraints.AddItem(constraintFunc(fLinearSpec, variables->ItemAt(i))); - } ResultType result = Solve(); - - for (int32 i = constraints.CountItems() - 1; i >= 0; i--) + for (int32 i = 0; i < constraints.CountItems(); i++) fLinearSpec->RemoveConstraint(constraints.ItemAt(i)); _AddSoftConstraint(softConstraints); diff --git a/src/libs/linprog/ActiveSetSolver.h b/src/libs/linprog/ActiveSetSolver.h index 397afe5834..86de33bc3f 100644 --- a/src/libs/linprog/ActiveSetSolver.h +++ b/src/libs/linprog/ActiveSetSolver.h @@ -6,7 +6,7 @@ #define ACTICE_SET_SOLVER_H -#include "QPSolverInterface.h" +#include "LinearSpec.h" class EquationSystem { @@ -18,6 +18,8 @@ public: int32 Rows(); int32 Columns(); + //! Debug function: check bounds + bool InRange(int32 row, int32 column); inline double& A(int32 row, int32 column); inline double& B(int32 row); /*! Copy the solved variables into results, keeping the original @@ -52,7 +54,7 @@ private: }; -class ActiveSetSolver : public QPSolverInterface { +class ActiveSetSolver : public LinearProgramming::SolverInterface { public: ActiveSetSolver(LinearSpec* linearSpec); ~ActiveSetSolver(); @@ -68,18 +70,17 @@ public: bool LeftSideChanged(Constraint* constraint); bool RightSideChanged(Constraint* constraint); bool OperatorChanged(Constraint* constraint); + bool PenaltiesChanged(Constraint* constraint); bool SaveModel(const char* fileName); - BSize MinSize(Variable* width, Variable* height); - BSize MaxSize(Variable* width, Variable* height); - ResultType FindMaxs(const VariableList* variables); ResultType FindMins(const VariableList* variables); void GetRangeConstraints(const Variable* var, const Constraint** _min, const Constraint** _max) const; + private: void _RemoveSoftConstraint(ConstraintList& list); void _AddSoftConstraint(const ConstraintList& list); diff --git a/src/libs/linprog/Jamfile b/src/libs/linprog/Jamfile index 98b8dd7f06..0cbda3853d 100644 --- a/src/libs/linprog/Jamfile +++ b/src/libs/linprog/Jamfile @@ -11,7 +11,6 @@ StaticLibrary liblinprog.a : Constraint.cpp LayoutOptimizer.cpp LinearSpec.cpp - QPSolverInterface.cpp Summand.cpp Variable.cpp ; diff --git a/src/libs/linprog/LayoutOptimizer.cpp b/src/libs/linprog/LayoutOptimizer.cpp index a5325a147d..203c622806 100644 --- a/src/libs/linprog/LayoutOptimizer.cpp +++ b/src/libs/linprog/LayoutOptimizer.cpp @@ -30,6 +30,16 @@ using std::swap; using std::max; +bool is_soft(Constraint* constraint) +{ + if (constraint->Op() != LinearProgramming::kEQ) + return false; + if (constraint->PenaltyNeg() > 0. || constraint->PenaltyPos() > 0.) + return true; + return false; +} + + /*! \class BPrivate::Layout::LayoutOptimizer Given a set of layout constraints, a feasible solution, and a desired @@ -208,48 +218,6 @@ copy_matrix(const double* const* A, double** B, int m, int n) } -static inline void -multiply_optimization_matrix_vector(const double* x, int n, double* y) -{ - // The matrix has the form: - // 2 -1 0 ... 0 0 - // -1 2 -1 0 ... . . - // 0 -1 2 . . - // . 0 . . . - // . . 0 0 - // . . -1 0 - // 0 ... 0 -1 2 -1 - // 0 ... -1 1 - if (n == 1) { - y[0] = x[0]; - return; - } - - y[0] = 2 * x[0] - x[1]; - for (int i = 1; i < n - 1; i++) - y[i] = 2 * x[i] - x[i - 1] - x[i + 1]; - y[n - 1] = x[n - 1] - x[n - 2]; -} - - -static inline void -multiply_optimization_matrix_matrix(const double* const* A, int m, int n, - double** B) -{ - if (m == 1) { - memcpy(B[0], A[0], n * sizeof(double)); - return; - } - - for (int k = 0; k < n; k++) { - B[0][k] = 2 * A[0][k] - A[1][k]; - for (int i = 1; i < m - 1; i++) - B[i][k] = 2 * A[i][k] - A[i - 1][k] - A[i + 1][k]; - B[m - 1][k] = A[m - 1][k] - A[m - 2][k]; - } -} - - // #pragma mark - algorithms #if 0 @@ -542,7 +510,7 @@ LayoutOptimizer::SetConstraints(const ConstraintList& list, int32 variableCount) // set up soft constraint matrix for (int32 c = 0; c < fConstraints->CountItems(); c++) { Constraint* constraint = fConstraints->ItemAt(c); - if (!constraint->IsSoft()) { + if (!is_soft(constraint)) { rightSide[c] = 0; continue; } @@ -715,7 +683,7 @@ TRACE_ONLY( for (int32 i = 0; i < constraintCount; i++) { Constraint* constraint = fConstraints->ItemAt(i); - if (constraint->IsSoft()) + if (is_soft(constraint)) continue; double actualValue = _ActualValue(constraint, x); TRACE("constraint %ld: actual: %f constraint: %f\n", i, actualValue, @@ -760,7 +728,7 @@ TRACE_ONLY( for (int32 i = 0; i < activeCount; i++) { Constraint* constraint = activeConstraints.ItemAt(i); - if (constraint->IsSoft()) + if (is_soft(constraint)) continue; SummandList* summands = constraint->LeftSide(); for (int32 s = 0; s < summands->CountItems(); s++) { diff --git a/src/libs/linprog/LayoutOptimizer.h b/src/libs/linprog/LayoutOptimizer.h index b77e96ad5e..c96328618d 100644 --- a/src/libs/linprog/LayoutOptimizer.h +++ b/src/libs/linprog/LayoutOptimizer.h @@ -21,6 +21,9 @@ void zero_matrix(double** A, int m, int n); int compute_dependencies(double** a, int m, int n, bool* independent); +bool is_soft(Constraint* constraint); + + class LayoutOptimizer { public: LayoutOptimizer(const ConstraintList& list, diff --git a/src/libs/linprog/QPSolverInterface.cpp b/src/libs/linprog/QPSolverInterface.cpp deleted file mode 100644 index 74cd8e5973..0000000000 --- a/src/libs/linprog/QPSolverInterface.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2011, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * Clemens Zeidler - */ - - -#include "QPSolverInterface.h" - -using namespace std; -using namespace LinearProgramming; - - -QPSolverInterface::QPSolverInterface(LinearSpec* linearSpec) - : - SolverInterface(linearSpec) -{ - -} - - -QPSolverInterface::~QPSolverInterface() -{ - /*for (unsigned int i = 0; i < fInEqSlackConstraints.size(); i++) { - SoftInEqData& data = fInEqSlackConstraints[i]; - _DestroyData(data); - }*/ -} - - -bool -QPSolverInterface::ConstraintAdded(Constraint* constraint) -{ - if (_IsSoftInequality(constraint) == false) - return true; - - SoftInEqData data; - double coeff = -1; - if (constraint->Op() == kGE) - coeff = 1; - data.slack = new Summand(coeff, fLinearSpec->AddVariable()); - data.slack->Var()->SetRange(0, 20000); - data.minSlackConstraint = fLinearSpec->AddConstraint(1., - data.slack->Var(), kEQ, 0., constraint->PenaltyNeg(), - constraint->PenaltyPos()); - data.constraint = constraint; - fInEqSlackConstraints.push_back(data); - - SummandList* leftSide = constraint->LeftSide(); - leftSide->AddItem(data.slack); - constraint->SetLeftSide(leftSide); - - return true; -} - - -bool -QPSolverInterface::ConstraintRemoved(Constraint* constraint) -{ - if (_IsSoftInequality(constraint) == false) - return true; - - for (unsigned int i = 0; i < fInEqSlackConstraints.size(); i++) { - SoftInEqData& data = fInEqSlackConstraints[i]; - if (data.constraint != constraint) - continue; - - SummandList* leftSide = constraint->LeftSide(); - leftSide->RemoveItem(data.slack); - constraint->SetLeftSide(leftSide); - _DestroyData(data); - - fInEqSlackConstraints.erase(fInEqSlackConstraints.begin() + i); - break; - } - return true; -} - - -void -QPSolverInterface::_DestroyData(SoftInEqData& data) -{ - fLinearSpec->RemoveConstraint(data.minSlackConstraint); - fLinearSpec->RemoveVariable(data.slack->Var()); - delete data.slack; -} - - -bool -QPSolverInterface::_IsSoftInequality(Constraint* constraint) -{ - if (constraint->PenaltyNeg() <= 0. && constraint->PenaltyPos() <= 0.) - return false; - if (constraint->Op() != kEQ) - return true; - return false; -} diff --git a/src/libs/linprog/QPSolverInterface.h b/src/libs/linprog/QPSolverInterface.h deleted file mode 100644 index 7713a26291..0000000000 --- a/src/libs/linprog/QPSolverInterface.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2011, Clemens Zeidler - * Distributed under the terms of the MIT License. - */ -#ifndef QP_SOLVER_INTERFACE_H -#define QP_SOLVER_INTERFACE_H - - -#include "LinearSpec.h" - -#include - - -/*! The purpose of this class is to manage soft inequality constraints. This is -done by adding a slack variable which is minimized. For example: -$$width - s < maxSize$$ -$$s = 0, soft constraint$$ -*/ -class QPSolverInterface : public LinearProgramming::SolverInterface { -public: - QPSolverInterface(LinearSpec* linearSpec); - virtual ~QPSolverInterface(); - - virtual bool ConstraintAdded(Constraint* constraint); - virtual bool ConstraintRemoved(Constraint* constraint); - -private: - struct SoftInEqData { - Summand* slack; - Constraint* constraint; - Constraint* minSlackConstraint; - }; - - typedef std::vector SoftInEqList; - - inline void _DestroyData(SoftInEqData& data); - inline bool _IsSoftInequality(Constraint* constraint); - - SoftInEqList fInEqSlackConstraints; -}; - - -#endif // QP_SOLVER_INTERFACE_H From 225446ac996426a7b3dceb7f24b9084cff8c5f00 Mon Sep 17 00:00:00 2001 From: czeidler Date: Sat, 1 Sep 2012 16:30:19 +1200 Subject: [PATCH 21/21] Check if constraint is NULL. --- src/libs/linprog/LinearSpec.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/linprog/LinearSpec.cpp b/src/libs/linprog/LinearSpec.cpp index cb7137ed65..ac50ef6474 100644 --- a/src/libs/linprog/LinearSpec.cpp +++ b/src/libs/linprog/LinearSpec.cpp @@ -288,6 +288,8 @@ bool LinearSpec::RemoveConstraint(Constraint* constraint, bool deleteConstraint, bool notifyListener) { + if (constraint == NULL) + return false; fSolver->ConstraintRemoved(constraint); if (!fConstraints.RemoveItem(constraint)) return false;