From axeld at mail.berlios.de Fri Jun 1 00:05:58 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 1 Jun 2007 00:05:58 +0200 Subject: [Haiku-commits] r21279 - haiku/trunk/src/system/kernel Message-ID: <200705312205.l4VM5wh9020802@sheep.berlios.de> Author: axeld Date: 2007-06-01 00:05:57 +0200 (Fri, 01 Jun 2007) New Revision: 21279 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21279&view=rev Modified: haiku/trunk/src/system/kernel/thread.c Log: Cleanup. Modified: haiku/trunk/src/system/kernel/thread.c =================================================================== --- haiku/trunk/src/system/kernel/thread.c 2007-05-30 17:39:26 UTC (rev 21278) +++ haiku/trunk/src/system/kernel/thread.c 2007-05-31 22:05:57 UTC (rev 21279) @@ -6,8 +6,9 @@ * Distributed under the terms of the NewOS License. */ -/** Threading routines */ +/*! Threading routines */ + #include #include @@ -85,6 +86,8 @@ static unsigned int volatile sDeathStackBitmap; static sem_id sDeathStackSem; +static struct thread *last_thread_dumped = NULL; + // The dead queue is used as a pool from which to retrieve and reuse previously // allocated thread structs when creating a new thread. It should be gone once // the slab allocator is in. @@ -94,10 +97,10 @@ static void thread_kthread_exit(void); -/** Inserts a thread into a team. - * You must hold the team lock when you call this function. - */ - +/*! + Inserts a thread into a team. + You must hold the team lock when you call this function. +*/ static void insert_thread_into_team(struct team *team, struct thread *thread) { @@ -113,10 +116,10 @@ } -/** Removes a thread from a team. - * You must hold the team lock when you call this function. - */ - +/*! + Removes a thread from a team. + You must hold the team lock when you call this function. +*/ static void remove_thread_from_team(struct team *team, struct thread *thread) { @@ -162,15 +165,19 @@ return (uint32)key->id % range; } -/** Allocates and fills in thread structure (or reuses one from the dead queue). - * - * \param threadID The ID to be assigned to the new thread. If - * \code < 0 \endcode a fresh one is allocated. - * \param thread initialize this thread struct if nonnull - */ +/*! + Allocates and fills in thread structure (or reuses one from the + dead queue). + + \param threadID The ID to be assigned to the new thread. If + \code < 0 \endcode a fresh one is allocated. + \param thread initialize this thread struct if nonnull +*/ + static struct thread * -create_thread_struct(struct thread *inthread, const char *name, thread_id threadID, struct cpu_ent *cpu) +create_thread_struct(struct thread *inthread, const char *name, + thread_id threadID, struct cpu_ent *cpu) { struct thread *thread; cpu_status state; @@ -275,8 +282,7 @@ } -// this function gets run by a new thread before anything else - +/*! This function gets run by a new thread before anything else */ static void thread_kthread_entry(void) { @@ -303,11 +309,11 @@ } -/** Initializes the thread and jumps to its userspace entry point. - * This function is called at creation time of every user thread, - * but not for a team's main thread. - */ - +/*! + Initializes the thread and jumps to its userspace entry point. + This function is called at creation time of every user thread, + but not for a team's main thread. +*/ static int _create_user_thread_kentry(void) { @@ -325,9 +331,7 @@ } -/** Initializes the thread and calls it kernel space entry point. - */ - +/*! Initializes the thread and calls it kernel space entry point. */ static int _create_kernel_thread_kentry(void) { @@ -339,12 +343,12 @@ } -/** Creates a new thread in the team with the specified team ID. - * - * \param threadID The ID to be assigned to the new thread. If - * \code < 0 \endcode a fresh one is allocated. - */ +/*! + Creates a new thread in the team with the specified team ID. + \param threadID The ID to be assigned to the new thread. If + \code < 0 \endcode a fresh one is allocated. +*/ static thread_id create_thread(const char *name, team_id teamID, thread_entry_func entry, void *args1, void *args2, int32 priority, bool kernel, thread_id threadID) @@ -357,7 +361,8 @@ bool abort = false; bool debugNewThread = false; - TRACE(("create_thread(%s, id = %ld, %s)\n", name, threadID, kernel ? "kernel" : "user")); + TRACE(("create_thread(%s, id = %ld, %s)\n", name, threadID, + kernel ? "kernel" : "user")); thread = create_thread_struct(NULL, name, threadID, NULL); if (thread == NULL) @@ -373,8 +378,9 @@ clear_thread_debug_info(&thread->debug_info, false); snprintf(stack_name, B_OS_NAME_LENGTH, "%s_%lx_kstack", name, thread->id); - thread->kernel_stack_area = create_area(stack_name, (void **)&thread->kernel_stack_base, - B_ANY_KERNEL_ADDRESS, KERNEL_STACK_SIZE, B_FULL_LOCK, + thread->kernel_stack_area = create_area(stack_name, + (void **)&thread->kernel_stack_base, B_ANY_KERNEL_ADDRESS, + KERNEL_STACK_SIZE, B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_KERNEL_STACK_AREA); if (thread->kernel_stack_area < 0) { @@ -454,8 +460,8 @@ if (kernel) { // this sets up an initial kthread stack that runs the entry - // Note: whatever function wants to set up a user stack later for this thread - // must initialize the TLS for it + // Note: whatever function wants to set up a user stack later for this + // thread must initialize the TLS for it arch_thread_init_kthread_stack(thread, &_create_kernel_thread_kentry, &thread_kthread_entry, &thread_kthread_exit); } else { @@ -482,7 +488,8 @@ // copy the user entry over to the args field in the thread struct // the function this will call will immediately switch the thread into // user space. - arch_thread_init_kthread_stack(thread, &_create_user_thread_kentry, &thread_kthread_entry, &thread_kthread_exit); + arch_thread_init_kthread_stack(thread, &_create_user_thread_kentry, + &thread_kthread_entry, &thread_kthread_exit); } return status; @@ -551,8 +558,6 @@ } -static struct thread *last_thread_dumped = NULL; - static void _dump_thread_info(struct thread *thread) { @@ -691,7 +696,8 @@ || (realTimeOnly && thread->priority < B_REAL_TIME_DISPLAY_PRIORITY)) continue; - kprintf("%p %6lx %-9s", thread, thread->id, state_to_text(thread, thread->state)); + kprintf("%p %6lx %-9s", thread, thread->id, state_to_text(thread, + thread->state)); // does it block on a semaphore? if (thread->state == B_THREAD_WAITING) @@ -774,10 +780,10 @@ } -/** Finds a free death stack for us and allocates it. - * Must be called with interrupts enabled. - */ - +/*! + Finds a free death stack for us and allocates it. + Must be called with interrupts enabled. +*/ static uint32 get_death_stack(void) { @@ -816,9 +822,7 @@ } -/** Returns the thread's death stack to the pool. - */ - +/*! Returns the thread's death stack to the pool. */ static void put_death_stack(uint32 index) { @@ -850,7 +854,8 @@ { struct thread_exit_args args; - // copy the arguments over, since the source is probably on the kernel stack we're about to delete + // copy the arguments over, since the source is probably on the kernel + // stack we're about to delete memcpy(&args, _args, sizeof(struct thread_exit_args)); // we can't let the interrupts disabled at this point @@ -865,7 +870,8 @@ delete_area(args.old_kernel_stack); // remove this thread from all of the global lists - TRACE(("thread_exit2: removing thread 0x%lx from global lists\n", args.thread->id)); + TRACE(("thread_exit2: removing thread 0x%lx from global lists\n", + args.thread->id)); disable_interrupts(); GRAB_TEAM_LOCK(); @@ -1075,7 +1081,8 @@ // fill all death entries death = NULL; - while ((death = list_get_next_item(&thread->exit.waiters, death)) != NULL) { + while ((death = list_get_next_item(&thread->exit.waiters, + death)) != NULL) { death->status = thread->exit.status; death->reason = thread->exit.reason; death->signal = thread->exit.signal; @@ -1105,8 +1112,8 @@ thread->kernel_stack_base = sDeathStacks[args.death_stack].address; // we will continue in thread_exit2(), on the new stack - arch_thread_switch_kstack_and_call(thread, thread->kernel_stack_base + KERNEL_STACK_SIZE, - thread_exit2, &args); + arch_thread_switch_kstack_and_call(thread, thread->kernel_stack_base + + KERNEL_STACK_SIZE, thread_exit2, &args); } panic("never can get here\n"); @@ -1142,11 +1149,11 @@ } -/** Called in the interrupt handler code when a thread enters - * the kernel for any reason. - * Only tracks time for now. - */ - +/*! + Called in the interrupt handler code when a thread enters + the kernel for any reason. + Only tracks time for now. +*/ void thread_at_kernel_entry(void) { @@ -1169,10 +1176,10 @@ } -/** Called whenever a thread exits kernel space to user space. - * Tracks time, handles signals, ... - */ - +/*! + Called whenever a thread exits kernel space to user space. + Tracks time, handles signals, ... +*/ void thread_at_kernel_exit(void) { @@ -1207,9 +1214,7 @@ // #pragma mark - private kernel API -/** Insert a thread to the tail of a queue - */ - +/*! Insert a thread to the tail of a queue */ void thread_enqueue(struct thread *thread, struct thread_queue *queue) { @@ -1306,12 +1311,12 @@ } -/** Kernel private thread creation function. - * - * \param threadID The ID to be assigned to the new thread. If - * \code < 0 \endcode a fresh one is allocated. - */ +/*! + Kernel private thread creation function. + \param threadID The ID to be assigned to the new thread. If + \code < 0 \endcode a fresh one is allocated. +*/ thread_id spawn_kernel_thread_etc(thread_func function, const char *name, int32 priority, void *arg, team_id team, thread_id threadID) @@ -1322,7 +1327,8 @@ status_t -wait_for_thread_etc(thread_id id, uint32 flags, bigtime_t timeout, status_t *_returnCode) +wait_for_thread_etc(thread_id id, uint32 flags, bigtime_t timeout, + status_t *_returnCode) { sem_id exitSem = B_BAD_THREAD_ID; struct death_entry death, *freeDeath = NULL; @@ -1492,7 +1498,8 @@ sNumDeathStacks = 8 * sizeof(sDeathStackBitmap); } sDeathStackBitmap = 0; - sDeathStacks = (struct death_stack *)malloc(sNumDeathStacks * sizeof(struct death_stack)); + sDeathStacks = (struct death_stack *)malloc(sNumDeathStacks + * sizeof(struct death_stack)); if (sDeathStacks == NULL) { panic("error creating death stacks\n"); return B_NO_MEMORY; @@ -1502,8 +1509,9 @@ for (i = 0; i < sNumDeathStacks; i++) { sprintf(temp, "death stack %lu", i); - sDeathStacks[i].area = create_area(temp, (void **)&sDeathStacks[i].address, - B_ANY_KERNEL_ADDRESS, KERNEL_STACK_SIZE, B_FULL_LOCK, + sDeathStacks[i].area = create_area(temp, + (void **)&sDeathStacks[i].address, B_ANY_KERNEL_ADDRESS, + KERNEL_STACK_SIZE, B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_KERNEL_STACK_AREA); if (sDeathStacks[i].area < 0) { panic("error creating death stacks\n"); @@ -1573,43 +1581,46 @@ static status_t -send_data_etc(thread_id tid, int32 code, const void *buffer, size_t buffer_size, int32 flags) +send_data_etc(thread_id id, int32 code, const void *buffer, + size_t bufferSize, int32 flags) { struct thread *target; - sem_id cached_sem; + sem_id cachedSem; cpu_status state; - status_t rv; + status_t status; cbuf *data; state = disable_interrupts(); GRAB_THREAD_LOCK(); - target = thread_get_thread_struct_locked(tid); + target = thread_get_thread_struct_locked(id); if (!target) { RELEASE_THREAD_LOCK(); restore_interrupts(state); return B_BAD_THREAD_ID; } - cached_sem = target->msg.write_sem; + cachedSem = target->msg.write_sem; RELEASE_THREAD_LOCK(); restore_interrupts(state); - if (buffer_size > THREAD_MAX_MESSAGE_SIZE) + if (bufferSize > THREAD_MAX_MESSAGE_SIZE) return B_NO_MEMORY; - rv = acquire_sem_etc(cached_sem, 1, flags, 0); - if (rv == B_INTERRUPTED) + status = acquire_sem_etc(cachedSem, 1, flags, 0); + if (status == B_INTERRUPTED) { // We got interrupted by a signal - return rv; - if (rv != B_OK) + return status; + } + if (status != B_OK) { // Any other acquisition problems may be due to thread deletion return B_BAD_THREAD_ID; + } - if (buffer_size > 0) { - data = cbuf_get_chain(buffer_size); - if (!data) + if (bufferSize > 0) { + data = cbuf_get_chain(bufferSize); + if (data == NULL) return B_NO_MEMORY; - rv = cbuf_user_memcpy_to_chain(data, 0, buffer, buffer_size); - if (rv < 0) { + status = cbuf_user_memcpy_to_chain(data, 0, buffer, bufferSize); + if (status < B_OK) { cbuf_free_chain(data); return B_NO_MEMORY; } @@ -1620,8 +1631,8 @@ GRAB_THREAD_LOCK(); // The target thread could have been deleted at this point - target = thread_get_thread_struct_locked(tid); - if (!target) { + target = thread_get_thread_struct_locked(id); + if (target == NULL) { RELEASE_THREAD_LOCK(); restore_interrupts(state); cbuf_free_chain(data); @@ -1631,15 +1642,14 @@ // Save message informations target->msg.sender = thread_get_current_thread()->id; target->msg.code = code; - target->msg.size = buffer_size; + target->msg.size = bufferSize; target->msg.buffer = data; - cached_sem = target->msg.read_sem; + cachedSem = target->msg.read_sem; RELEASE_THREAD_LOCK(); restore_interrupts(state); - release_sem(cached_sem); - + release_sem(cachedSem); return B_OK; } @@ -1652,7 +1662,8 @@ static int32 -receive_data_etc(thread_id *_sender, void *buffer, size_t bufferSize, int32 flags) +receive_data_etc(thread_id *_sender, void *buffer, size_t bufferSize, + int32 flags) { struct thread *thread = thread_get_current_thread(); status_t status; @@ -1670,7 +1681,8 @@ if (buffer != NULL && bufferSize != 0) { size = min(bufferSize, thread->msg.size); - status = cbuf_user_memcpy_from_chain(buffer, thread->msg.buffer, 0, size); + status = cbuf_user_memcpy_from_chain(buffer, thread->msg.buffer, + 0, size); if (status < B_OK) { cbuf_free_chain(thread->msg.buffer); release_sem(thread->msg.write_sem); @@ -1700,18 +1712,19 @@ { int32 count; - if (get_sem_count(thread_get_current_thread()->msg.read_sem, &count) != B_OK) + if (get_sem_count(thread_get_current_thread()->msg.read_sem, + &count) != B_OK) return false; return count == 0 ? false : true; } -/** Fills the thread_info structure with information from the specified - * thread. - * The thread lock must be held when called. - */ - +/*! + Fills the thread_info structure with information from the specified + thread. + The thread lock must be held when called. +*/ static void fill_thread_info(struct thread *thread, thread_info *info, size_t size) { @@ -1735,7 +1748,8 @@ info->user_time = thread->user_time; info->kernel_time = thread->kernel_time; info->stack_base = (void *)thread->user_stack_base; - info->stack_end = (void *)(thread->user_stack_base + thread->user_stack_size - 1); + info->stack_end = (void *)(thread->user_stack_base + + thread->user_stack_size - 1); } @@ -1769,7 +1783,8 @@ status_t -_get_next_thread_info(team_id team, int32 *_cookie, thread_info *info, size_t size) +_get_next_thread_info(team_id team, int32 *_cookie, thread_info *info, + size_t size) { status_t status = B_BAD_VALUE; struct thread *thread = NULL; @@ -1795,7 +1810,8 @@ goto err; while (slot < lastThreadID - && (!(thread = thread_get_thread_struct_locked(slot)) || thread->team->id != team)) + && (!(thread = thread_get_thread_struct_locked(slot)) + || thread->team->id != team)) slot++; if (thread != NULL && thread->team->id == team) { @@ -1944,9 +1960,7 @@ } -/** snooze() for internal kernel use only; doesn't interrupt on signals. - */ - +/*! snooze() for internal kernel use only; doesn't interrupt on signals. */ status_t snooze(bigtime_t timeout) { @@ -1954,9 +1968,10 @@ } -/** snooze_until() for internal kernel use only; doesn't interrupt on signals. - */ - +/*! + snooze_until() for internal kernel use only; doesn't interrupt on + signals. +*/ status_t snooze_until(bigtime_t timeout, int timebase) { @@ -2093,7 +2108,8 @@ thread_id -_user_spawn_thread(int32 (*entry)(thread_func, void *), const char *userName, int32 priority, void *data1, void *data2) +_user_spawn_thread(int32 (*entry)(thread_func, void *), const char *userName, + int32 priority, void *data1, void *data2) { char name[B_OS_NAME_LENGTH]; thread_id threadID; @@ -2138,7 +2154,8 @@ status = _get_thread_info(id, &info, sizeof(thread_info)); - if (status >= B_OK && user_memcpy(userInfo, &info, sizeof(thread_info)) < B_OK) + if (status >= B_OK + && user_memcpy(userInfo, &info, sizeof(thread_info)) < B_OK) return B_BAD_ADDRESS; return status; @@ -2146,7 +2163,8 @@ status_t -_user_get_next_thread_info(team_id team, int32 *userCookie, thread_info *userInfo) +_user_get_next_thread_info(team_id team, int32 *userCookie, + thread_info *userInfo) { status_t status; thread_info info; @@ -2211,12 +2229,14 @@ status_t -_user_send_data(thread_id thread, int32 code, const void *buffer, size_t bufferSize) +_user_send_data(thread_id thread, int32 code, const void *buffer, + size_t bufferSize) { if (!IS_USER_ADDRESS(buffer)) return B_BAD_ADDRESS; - return send_data_etc(thread, code, buffer, bufferSize, B_KILL_CAN_INTERRUPT); + return send_data_etc(thread, code, buffer, bufferSize, + B_KILL_CAN_INTERRUPT); // supports userland buffers } @@ -2279,7 +2299,8 @@ return EINVAL; if (!IS_USER_ADDRESS(userResourceLimit) - || user_memcpy(&resourceLimit, userResourceLimit, sizeof(struct rlimit)) < B_OK) + || user_memcpy(&resourceLimit, userResourceLimit, + sizeof(struct rlimit)) < B_OK) return B_BAD_ADDRESS; return setrlimit(resource, &resourceLimit); From axeld at mail.berlios.de Fri Jun 1 00:09:39 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 1 Jun 2007 00:09:39 +0200 Subject: [Haiku-commits] r21280 - in haiku/trunk/src/system/kernel: . debug Message-ID: <200705312209.l4VM9dLv021034@sheep.berlios.de> Author: axeld Date: 2007-06-01 00:09:39 +0200 (Fri, 01 Jun 2007) New Revision: 21280 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21280&view=rev Modified: haiku/trunk/src/system/kernel/debug/debug.c haiku/trunk/src/system/kernel/smp.c Log: Continuing from the kernel debugger did not work on SMP machines, as SMP_MSG_CPU_HALT was a one way ticket. It now works as expected. Modified: haiku/trunk/src/system/kernel/debug/debug.c =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.c 2007-05-31 22:05:57 UTC (rev 21279) +++ haiku/trunk/src/system/kernel/debug/debug.c 2007-05-31 22:09:39 UTC (rev 21280) @@ -867,20 +867,23 @@ void kernel_debugger(const char *message) { + static vint32 inDebugger; cpu_status state; bool dprintfState; + state = disable_interrupts(); + atomic_add(&inDebugger, 1); + arch_debug_save_registers(&dbg_register_file[smp_get_current_cpu()][0]); dprintfState = set_dprintf_enabled(true); - state = disable_interrupts(); - if (sDebuggerOnCPU != smp_get_current_cpu()) { - // halt all of the other cpus + // First entry, halt all of the other cpus // XXX need to flush current smp mailbox to make sure this goes // through. Otherwise it'll hang - smp_send_broadcast_ici(SMP_MSG_CPU_HALT, 0, 0, 0, NULL, SMP_MSG_FLAG_SYNC); + smp_send_broadcast_ici(SMP_MSG_CPU_HALT, 0, 0, 0, (void *)&inDebugger, + SMP_MSG_FLAG_SYNC); } if (sBlueScreenOutput) { @@ -896,6 +899,7 @@ set_dprintf_enabled(dprintfState); sBlueScreenEnabled = false; + atomic_add(&inDebugger, -1); restore_interrupts(state); // ToDo: in case we change dbg_register_file - don't we want to restore it? Modified: haiku/trunk/src/system/kernel/smp.c =================================================================== --- haiku/trunk/src/system/kernel/smp.c 2007-05-31 22:05:57 UTC (rev 21279) +++ haiku/trunk/src/system/kernel/smp.c 2007-05-31 22:09:39 UTC (rev 21280) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2002-2007, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -347,11 +347,11 @@ process_pending_ici(int32 currentCPU) { struct smp_msg *msg; - bool halt = false; - int source_mailbox = 0; + vint32 *haltValue = NULL; + int sourceMailbox = 0; int retval = B_HANDLED_INTERRUPT; - msg = check_for_message(currentCPU, &source_mailbox); + msg = check_for_message(currentCPU, &sourceMailbox); if (msg == NULL) return retval; @@ -374,8 +374,8 @@ retval = B_INVOKE_SCHEDULER; break; case SMP_MSG_CPU_HALT: - halt = true; - dprintf("cpu %ld halted!\n", currentCPU); + haltValue = (vint32 *)msg->data_ptr; + dprintf("CPU %ld halted!\n", currentCPU); break; case SMP_MSG_CALL_FUNCTION: { @@ -389,13 +389,16 @@ } // finish dealing with this message, possibly removing it from the list - finish_message_processing(currentCPU, msg, source_mailbox); + finish_message_processing(currentCPU, msg, sourceMailbox); // special case for the halt message - // we otherwise wouldn't have gotten the opportunity to clean up - if (halt) { - disable_interrupts(); - for(;;); + if (haltValue) { + cpu_status state = disable_interrupts(); + + while (*haltValue != 0) + ; + + restore_interrupts(state); } return retval; From axeld at mail.berlios.de Fri Jun 1 00:12:08 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 1 Jun 2007 00:12:08 +0200 Subject: [Haiku-commits] r21281 - haiku/trunk/src/add-ons/input_server/devices/keyboard Message-ID: <200705312212.l4VMC8kL021219@sheep.berlios.de> Author: axeld Date: 2007-06-01 00:12:07 +0200 (Fri, 01 Jun 2007) New Revision: 21281 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21281&view=rev Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/TMWindow.cpp Log: The team monitor now shows the large icon correctly, thanks to Jonas Sundstrom. Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/TMWindow.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/keyboard/TMWindow.cpp 2007-05-31 22:09:39 UTC (rev 21280) +++ haiku/trunk/src/add-ons/input_server/devices/keyboard/TMWindow.cpp 2007-05-31 22:12:07 UTC (rev 21281) @@ -381,7 +381,12 @@ // draw icon and application path BRect frame(rect); frame.Set(frame.left, frame.top, frame.left + 31, frame.top + 31); +#ifdef __HAIKU__ + SetDrawingMode(B_OP_ALPHA); + SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); +#else SetDrawingMode(B_OP_OVER); +#endif DrawBitmap(fItem->LargeIcon(), frame); SetDrawingMode(B_OP_COPY); From axeld at mail.berlios.de Fri Jun 1 00:39:18 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 1 Jun 2007 00:39:18 +0200 Subject: [Haiku-commits] r21282 - haiku/trunk/src/servers/app/drawing Message-ID: <200705312239.l4VMdImv006966@sheep.berlios.de> Author: axeld Date: 2007-06-01 00:39:16 +0200 (Fri, 01 Jun 2007) New Revision: 21282 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21282&view=rev Modified: haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp haiku/trunk/src/servers/app/drawing/HWInterface.cpp haiku/trunk/src/servers/app/drawing/HWInterface.h Log: Moved the (currently very simplistic) code to check if a display_mode is valid into it's own (static) method. In case setting the display mode fails, the returned mode is now checked for validity as well. Modified: haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp 2007-05-31 22:12:07 UTC (rev 21281) +++ haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp 2007-05-31 22:39:16 UTC (rev 21282) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -8,7 +8,7 @@ * Stephan A?mus */ -/** Accelerant based HWInterface implementation */ +/*! Accelerant based HWInterface implementation */ #include "AccelerantHWInterface.h" @@ -438,8 +438,7 @@ // some safety checks // TODO: more of those! - if (mode.virtual_width < 320 - || mode.virtual_height < 200) + if (!_IsValidMode(mode)) return B_BAD_VALUE; // just try to set the mode - we let the graphics driver @@ -466,6 +465,10 @@ if (fAccGetDisplayMode(&newMode) != B_OK) return B_ERROR; + // TODO: check if the mode returned is valid! + if (!_IsValidMode(newMode)) + return B_BAD_DATA; + // TODO: if the mode switch before fails as well, we must forbid // any uses of this class! status = B_OK; @@ -497,7 +500,8 @@ // update backbuffer if neccessary if (!fBackBuffer || fBackBuffer->Width() != fDisplayMode.virtual_width || fBackBuffer->Height() != fDisplayMode.virtual_height - || (fDisplayMode.space == B_RGB32 && fBackBuffer != NULL && !HWInterface::IsDoubleBuffered())) { + || (fDisplayMode.space == B_RGB32 && fBackBuffer != NULL + && !HWInterface::IsDoubleBuffered())) { // NOTE: backbuffer is always B_RGBA32, this simplifies the // drawing backend implementation tremendously for the time // being. The color space conversion is handled in CopyBackToFront() Modified: haiku/trunk/src/servers/app/drawing/HWInterface.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/HWInterface.cpp 2007-05-31 22:12:07 UTC (rev 21281) +++ haiku/trunk/src/servers/app/drawing/HWInterface.cpp 2007-05-31 22:39:16 UTC (rev 21282) @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006, Haiku. + * Copyright 2005-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -23,13 +23,19 @@ #include -HWInterfaceListener::HWInterfaceListener() {} -HWInterfaceListener::~HWInterfaceListener() {} +HWInterfaceListener::HWInterfaceListener() +{ +} +HWInterfaceListener::~HWInterfaceListener() +{ +} + + // #pragma mark - HWInterface -// constructor + HWInterface::HWInterface(bool doubleBuffered) : MultiLocker("hw interface lock"), fCursorAreaBackup(NULL), @@ -956,3 +962,15 @@ } } + +/*static*/ bool +HWInterface::_IsValidMode(const display_mode& mode) +{ + // TODO: more of those! + if (mode.virtual_width < 320 + || mode.virtual_height < 200) + return false; + + return true; +} + Modified: haiku/trunk/src/servers/app/drawing/HWInterface.h =================================================================== --- haiku/trunk/src/servers/app/drawing/HWInterface.h 2007-05-31 22:12:07 UTC (rev 21281) +++ haiku/trunk/src/servers/app/drawing/HWInterface.h 2007-05-31 22:39:16 UTC (rev 21282) @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006, Haiku. + * Copyright 2005-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -180,6 +180,8 @@ void _NotifyFrameBufferChanged(); + static bool _IsValidMode(const display_mode& mode); + // If we draw the cursor somewhere in the drawing buffer, // we need to backup its contents before drawing, so that // we can restore that area when the cursor needs to be From bonefish at mail.berlios.de Fri Jun 1 08:46:58 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 1 Jun 2007 08:46:58 +0200 Subject: [Haiku-commits] r21283 - haiku/trunk/src/system/runtime_loader Message-ID: <200706010646.l516kwCh015815@sheep.berlios.de> Author: bonefish Date: 2007-06-01 08:46:57 +0200 (Fri, 01 Jun 2007) New Revision: 21283 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21283&view=rev Added: haiku/trunk/src/system/runtime_loader/elf.cpp Removed: haiku/trunk/src/system/runtime_loader/elf.c Modified: haiku/trunk/src/system/runtime_loader/Jamfile Log: elf.c -> elf.cpp Modified: haiku/trunk/src/system/runtime_loader/Jamfile =================================================================== --- haiku/trunk/src/system/runtime_loader/Jamfile 2007-05-31 22:39:16 UTC (rev 21282) +++ haiku/trunk/src/system/runtime_loader/Jamfile 2007-06-01 06:46:57 UTC (rev 21283) @@ -58,7 +58,7 @@ Objects runtime_loader.c - elf.c + elf.cpp export.c heap.cpp utility.cpp Deleted: haiku/trunk/src/system/runtime_loader/elf.c Copied: haiku/trunk/src/system/runtime_loader/elf.cpp (from rev 21282, haiku/trunk/src/system/runtime_loader/elf.c) =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.c 2007-05-31 22:39:16 UTC (rev 21282) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2007-06-01 06:46:57 UTC (rev 21283) @@ -0,0 +1,1558 @@ +/* + * Copyright 2003-2007, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + * + * Copyright 2002, Manuel J. Petit. All rights reserved. + * Copyright 2001, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ + + +#include "runtime_loader_private.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +//#define TRACE_RLD +#ifdef TRACE_RLD +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + + +// ToDo: implement better locking strategy +// ToDo: implement lazy binding + +#define PAGE_MASK (B_PAGE_SIZE - 1) + +#define PAGE_OFFSET(x) ((x) & (PAGE_MASK)) +#define PAGE_BASE(x) ((x) & ~(PAGE_MASK)) +#define TO_PAGE_SIZE(x) ((x + (PAGE_MASK)) & ~(PAGE_MASK)) + +#define RLD_PROGRAM_BASE 0x00200000 + /* keep in sync with app ldscript */ + +enum { + RFLAG_RW = 0x0001, + RFLAG_ANON = 0x0002, + + RFLAG_TERMINATED = 0x0200, + RFLAG_INITIALIZED = 0x0400, + RFLAG_SYMBOLIC = 0x0800, + RFLAG_RELOCATED = 0x1000, + RFLAG_PROTECTED = 0x2000, + RFLAG_DEPENDENCIES_LOADED = 0x4000, + RFLAG_REMAPPED = 0x8000 +}; + + +#define IMAGE_TYPE_TO_MASK(type) (1 << ((type) - 1)) +#define ALL_IMAGE_TYPES (IMAGE_TYPE_TO_MASK(B_APP_IMAGE) \ + | IMAGE_TYPE_TO_MASK(B_LIBRARY_IMAGE) \ + | IMAGE_TYPE_TO_MASK(B_ADD_ON_IMAGE) \ + | IMAGE_TYPE_TO_MASK(B_SYSTEM_IMAGE)) +#define APP_OR_LIBRARY_TYPE (IMAGE_TYPE_TO_MASK(B_APP_IMAGE) \ + | IMAGE_TYPE_TO_MASK(B_LIBRARY_IMAGE)) + +typedef void (*init_term_function)(image_id); + +static image_queue_t sLoadedImages = {0, 0}; +static image_queue_t sLoadingImages = {0, 0}; +static image_queue_t sDisposableImages = {0, 0}; +static uint32 sLoadedImageCount = 0; +static image_t *sProgramImage; + +// a recursive lock +static sem_id rld_sem; +static thread_id rld_sem_owner; +static int32 rld_sem_count; + + +#ifdef TRACE_RLD +# define FATAL(x...) dprintf("runtime_loader: " x); + +void +dprintf(const char *format, ...) +{ + char buffer[1024]; + + va_list list; + va_start(list, format); + + vsnprintf(buffer, sizeof(buffer), format, list); + _kern_debug_output(buffer); + + va_end(list); +} +#else +# define FATAL(x...) printf("runtime_loader: " x); +#endif + + +static void +rld_unlock() +{ + if (rld_sem_count-- == 1) { + rld_sem_owner = -1; + release_sem(rld_sem); + } +} + + +static void +rld_lock() +{ + thread_id self = find_thread(NULL); + if (self != rld_sem_owner) { + acquire_sem(rld_sem); + rld_sem_owner = self; + } + rld_sem_count++; +} + + +static void +enqueue_image(image_queue_t *queue, image_t *image) +{ + image->next = 0; + + image->prev = queue->tail; + if (queue->tail) + queue->tail->next = image; + + queue->tail = image; + if (!queue->head) + queue->head = image; +} + + +static void +dequeue_image(image_queue_t *queue, image_t *image) +{ + if (image->next) + image->next->prev = image->prev; + else + queue->tail = image->prev; + + if (image->prev) + image->prev->next = image->next; + else + queue->head = image->next; + + image->prev = 0; + image->next = 0; +} + + +static uint32 +elf_hash(const uint8 *name) +{ + uint32 hash = 0; + uint32 temp; + + while (*name) { + hash = (hash << 4) + *name++; + if ((temp = hash & 0xf0000000)) { + hash ^= temp >> 24; + } + hash &= ~temp; + } + return hash; +} + + +static image_t * +find_image_in_queue(image_queue_t *queue, const char *name, bool isPath, + uint32 typeMask) +{ + image_t *image; + + for (image = queue->head; image; image = image->next) { + const char *imageName = isPath ? image->path : image->name; + int length = isPath ? sizeof(image->path) : sizeof(image->name); + + if (!strncmp(imageName, name, length) + && (typeMask & IMAGE_TYPE_TO_MASK(image->type)) != 0) { + return image; + } + } + + return NULL; +} + + +static image_t * +find_image(char const *name, uint32 typeMask) +{ + bool isPath = (strchr(name, '/') != NULL); + image_t *image; + + image = find_image_in_queue(&sLoadedImages, name, isPath, typeMask); + if (image == NULL) + image = find_image_in_queue(&sLoadingImages, name, isPath, typeMask); + + return image; +} + + +static image_t * +find_loaded_image_by_id(image_id id) +{ + image_t *image; + + for (image = sLoadedImages.head; image; image = image->next) { + if (image->id == id) + return image; + } + + // For the termination routine, we need to look into the list of + // disposable images as well + for (image = sDisposableImages.head; image; image = image->next) { + if (image->id == id) + return image; + } + + return NULL; +} + + +static status_t +parse_elf_header(struct Elf32_Ehdr *eheader, int32 *_pheaderSize, int32 *_sheaderSize) +{ + if (memcmp(eheader->e_ident, ELF_MAGIC, 4) != 0) + return B_NOT_AN_EXECUTABLE; + + if (eheader->e_ident[4] != ELFCLASS32) + return B_NOT_AN_EXECUTABLE; + + if (eheader->e_phoff == 0) + return B_NOT_AN_EXECUTABLE; + + if (eheader->e_phentsize < sizeof(struct Elf32_Phdr)) + return B_NOT_AN_EXECUTABLE; + + *_pheaderSize = eheader->e_phentsize * eheader->e_phnum; + *_sheaderSize = eheader->e_shentsize * eheader->e_shnum; + + return *_pheaderSize > 0 && *_sheaderSize > 0 ? B_OK : B_NOT_AN_EXECUTABLE; +} + + +static int32 +count_regions(char const *buff, int phnum, int phentsize) +{ + struct Elf32_Phdr *pheaders; + int32 count = 0; + int i; + + for (i = 0; i < phnum; i++) { + pheaders = (struct Elf32_Phdr *)(buff + i * phentsize); + + switch (pheaders->p_type) { + case PT_NULL: + /* NOP header */ + break; + case PT_LOAD: + count += 1; + if (pheaders->p_memsz != pheaders->p_filesz) { + addr_t A = TO_PAGE_SIZE(pheaders->p_vaddr + pheaders->p_memsz); + addr_t B = TO_PAGE_SIZE(pheaders->p_vaddr + pheaders->p_filesz); + + if (A != B) + count += 1; + } + break; + case PT_DYNAMIC: + /* will be handled at some other place */ + break; + case PT_INTERP: + /* should check here for appropiate interpreter */ + break; + case PT_NOTE: + /* unsupported */ + break; + case PT_SHLIB: + /* undefined semantics */ + break; + case PT_PHDR: + /* we don't use it */ + break; + default: + FATAL("unhandled pheader type 0x%lx\n", pheaders[i].p_type); + return B_BAD_DATA; + } + } + + return count; +} + + +/* + * create_image() & destroy_image() + * + * Create and destroy image_t structures. The destroyer makes sure that the + * memory buffers are full of garbage before freeing. + */ + +static image_t * +create_image(const char *name, const char *path, int num_regions) +{ + size_t allocSize = sizeof(image_t) + (num_regions - 1) * sizeof(elf_region_t); + const char *lastSlash; + + image_t *image = (image_t*)malloc(allocSize); + if (image == NULL) { + FATAL("no memory for image %s\n", path); + return NULL; + } + + memset(image, 0, allocSize); + + strlcpy(image->path, path, sizeof(image->path)); + + // Make the last component of the supplied name the image name. + // If present, DT_SONAME will replace this name. + if ((lastSlash = strrchr(name, '/'))) + strlcpy(image->name, lastSlash + 1, sizeof(image->name)); + else + strlcpy(image->name, name, sizeof(image->name)); + + image->ref_count = 1; + image->num_regions = num_regions; + + return image; +} + + +static void +delete_image_struct(image_t *image) +{ +#ifdef DEBUG + size_t size = sizeof(image_t) + (image->num_regions - 1) * sizeof(elf_region_t); + memset(image->needed, 0xa5, sizeof(image->needed[0]) * image->num_needed); +#endif + free(image->needed); + +#ifdef DEBUG + memset(image, 0xa5, size); +#endif + free(image); +} + + +static void +delete_image(image_t *image) +{ + _kern_unregister_image(image->id); + // registered in load_container() + + delete_image_struct(image); +} + + +static status_t +parse_program_headers(image_t *image, char *buff, int phnum, int phentsize) +{ + struct Elf32_Phdr *pheader; + int regcount; + int i; + + regcount = 0; + for (i = 0; i < phnum; i++) { + pheader = (struct Elf32_Phdr *)(buff + i * phentsize); + + switch (pheader->p_type) { + case PT_NULL: + /* NOP header */ + break; + case PT_LOAD: + if (pheader->p_memsz == pheader->p_filesz) { + /* + * everything in one area + */ + image->regions[regcount].start = pheader->p_vaddr; + image->regions[regcount].size = pheader->p_memsz; + image->regions[regcount].vmstart = PAGE_BASE(pheader->p_vaddr); + image->regions[regcount].vmsize = TO_PAGE_SIZE(pheader->p_memsz + + PAGE_OFFSET(pheader->p_vaddr)); + image->regions[regcount].fdstart = pheader->p_offset; + image->regions[regcount].fdsize = pheader->p_filesz; + image->regions[regcount].delta = 0; + image->regions[regcount].flags = 0; + if (pheader->p_flags & PF_WRITE) { + // this is a writable segment + image->regions[regcount].flags |= RFLAG_RW; + } + } else { + /* + * may require splitting + */ + addr_t A = TO_PAGE_SIZE(pheader->p_vaddr + pheader->p_memsz); + addr_t B = TO_PAGE_SIZE(pheader->p_vaddr + pheader->p_filesz); + + image->regions[regcount].start = pheader->p_vaddr; + image->regions[regcount].size = pheader->p_filesz; + image->regions[regcount].vmstart = PAGE_BASE(pheader->p_vaddr); + image->regions[regcount].vmsize = TO_PAGE_SIZE(pheader->p_filesz + + PAGE_OFFSET(pheader->p_vaddr)); + image->regions[regcount].fdstart = pheader->p_offset; + image->regions[regcount].fdsize = pheader->p_filesz; + image->regions[regcount].delta = 0; + image->regions[regcount].flags = 0; + if (pheader->p_flags & PF_WRITE) { + // this is a writable segment + image->regions[regcount].flags |= RFLAG_RW; + } + + if (A != B) { + /* + * yeah, it requires splitting + */ + regcount += 1; + image->regions[regcount].start = pheader->p_vaddr; + image->regions[regcount].size = pheader->p_memsz - pheader->p_filesz; + image->regions[regcount].vmstart = image->regions[regcount-1].vmstart + image->regions[regcount-1].vmsize; + image->regions[regcount].vmsize = TO_PAGE_SIZE(pheader->p_memsz + PAGE_OFFSET(pheader->p_vaddr)) + - image->regions[regcount-1].vmsize; + image->regions[regcount].fdstart = 0; + image->regions[regcount].fdsize = 0; + image->regions[regcount].delta = 0; + image->regions[regcount].flags = RFLAG_ANON; + if (pheader->p_flags & PF_WRITE) { + // this is a writable segment + image->regions[regcount].flags |= RFLAG_RW; + } + } + } + regcount += 1; + break; + case PT_DYNAMIC: + image->dynamic_ptr = pheader->p_vaddr; + break; + case PT_INTERP: + /* should check here for appropiate interpreter */ + break; + case PT_NOTE: + /* unsupported */ + break; + case PT_SHLIB: + /* undefined semantics */ + break; + case PT_PHDR: + /* we don't use it */ + break; + default: + FATAL("unhandled pheader type 0x%lx\n", pheader[i].p_type); + return B_BAD_DATA; + } + } + + return B_OK; +} + + +static bool +assert_dynamic_loadable(image_t *image) +{ + uint32 i; + + if (!image->dynamic_ptr) + return true; + + for (i = 0; i < image->num_regions; i++) { + if (image->dynamic_ptr >= image->regions[i].start + && image->dynamic_ptr < image->regions[i].start + image->regions[i].size) + return true; + } + + return false; +} + + +/** This function will change the protection of all read-only segments + * to really be read-only. + * The areas have to be read/write first, so that they can be relocated. + */ + +static void +remap_images(void) +{ + image_t *image; + uint32 i; + + for (image = sLoadedImages.head; image != NULL; image = image->next) { + for (i = 0; i < image->num_regions; i++) { + if ((image->regions[i].flags & RFLAG_RW) == 0 + && (image->regions[i].flags & RFLAG_REMAPPED) == 0) { + // we only need to do this once, so we remember those we've already mapped + if (_kern_set_area_protection(image->regions[i].id, + B_READ_AREA | B_EXECUTE_AREA) == B_OK) + image->regions[i].flags |= RFLAG_REMAPPED; + } + } + } +} + + +static status_t +map_image(int fd, char const *path, image_t *image, bool fixed) +{ + status_t status = B_OK; + const char *baseName; + uint32 i; + + (void)(fd); + + // cut the file name from the path as base name for the created areas + baseName = strrchr(path, '/'); + if (baseName != NULL) + baseName++; + else + baseName = path; + + for (i = 0; i < image->num_regions; i++) { + char regionName[B_OS_NAME_LENGTH]; + addr_t loadAddress; + uint32 addressSpecifier; + + // for BeOS compatibility: if we load an old BeOS executable, we + // have to relocate it, if possible - we recognize it because the + // vmstart is set to 0 (hopefully always) + if (fixed && image->regions[i].vmstart == 0) + fixed = false; + + snprintf(regionName, sizeof(regionName), "%s_seg%lu%s", + baseName, i, (image->regions[i].flags & RFLAG_RW) ? "rw" : "ro"); + + if (image->dynamic_ptr && !fixed) { + // relocatable image... we can afford to place wherever + if (i == 0) { + // but only the first segment gets a free ride + loadAddress = RLD_PROGRAM_BASE; + addressSpecifier = B_BASE_ADDRESS; + } else { + loadAddress = image->regions[i].vmstart + image->regions[i-1].delta; + addressSpecifier = B_EXACT_ADDRESS; + } + } else { + // not relocatable, put it where it asks or die trying + loadAddress = image->regions[i].vmstart; + addressSpecifier = B_EXACT_ADDRESS; + } + + if (image->regions[i].flags & RFLAG_ANON) { + image->regions[i].id = _kern_create_area(regionName, (void **)&loadAddress, + addressSpecifier, image->regions[i].vmsize, B_NO_LOCK, + B_READ_AREA | B_WRITE_AREA); + + if (image->regions[i].id < 0) { + status = image->regions[i].id; + goto error; + } + + image->regions[i].delta = loadAddress - image->regions[i].vmstart; + image->regions[i].vmstart = loadAddress; + } else { + image->regions[i].id = sys_vm_map_file(regionName, (void **)&loadAddress, + addressSpecifier, image->regions[i].vmsize, B_READ_AREA | B_WRITE_AREA, + REGION_PRIVATE_MAP, path, PAGE_BASE(image->regions[i].fdstart)); + + if (image->regions[i].id < 0) { + status = image->regions[i].id; + goto error; + } + + TRACE(("\"%s\" at %p, 0x%lx bytes (%s)\n", path, + (void *)loadAddress, image->regions[i].vmsize, + image->regions[i].flags & RFLAG_RW ? "rw" : "read-only")); + + image->regions[i].delta = loadAddress - image->regions[i].vmstart; + image->regions[i].vmstart = loadAddress; + + // handle trailer bits in data segment + if (image->regions[i].flags & RFLAG_RW) { + addr_t startClearing; + addr_t toClear; + + startClearing = image->regions[i].vmstart + + PAGE_OFFSET(image->regions[i].start) + + image->regions[i].size; + toClear = image->regions[i].vmsize + - PAGE_OFFSET(image->regions[i].start) + - image->regions[i].size; + + TRACE(("cleared 0x%lx and the following 0x%lx bytes\n", startClearing, toClear)); + memset((void *)startClearing, 0, toClear); + } + } + } + + if (image->dynamic_ptr) + image->dynamic_ptr += image->regions[0].delta; + + return B_OK; + +error: + return status; +} + + +static void +unmap_image(image_t *image) +{ + uint32 i; + + for (i = 0; i < image->num_regions; i++) { + _kern_delete_area(image->regions[i].id); + + image->regions[i].id = -1; + } +} + + +static bool +parse_dynamic_segment(image_t *image) +{ + struct Elf32_Dyn *d; + int i; + int sonameOffset = -1; + + image->symhash = 0; + image->syms = 0; + image->strtab = 0; + + d = (struct Elf32_Dyn *)image->dynamic_ptr; + if (!d) + return true; + + for (i = 0; d[i].d_tag != DT_NULL; i++) { + switch (d[i].d_tag) { + case DT_NEEDED: + image->num_needed += 1; + break; + case DT_HASH: + image->symhash = (uint32 *)(d[i].d_un.d_ptr + image->regions[0].delta); + break; + case DT_STRTAB: + image->strtab = (char *)(d[i].d_un.d_ptr + image->regions[0].delta); + break; + case DT_SYMTAB: + image->syms = (struct Elf32_Sym *)(d[i].d_un.d_ptr + image->regions[0].delta); + break; + case DT_REL: + image->rel = (struct Elf32_Rel *)(d[i].d_un.d_ptr + image->regions[0].delta); + break; + case DT_RELSZ: + image->rel_len = d[i].d_un.d_val; + break; + case DT_RELA: + image->rela = (struct Elf32_Rela *)(d[i].d_un.d_ptr + image->regions[0].delta); + break; + case DT_RELASZ: + image->rela_len = d[i].d_un.d_val; + break; + // TK: procedure linkage table + case DT_JMPREL: + image->pltrel = (struct Elf32_Rel *)(d[i].d_un.d_ptr + image->regions[0].delta); + break; + case DT_PLTRELSZ: + image->pltrel_len = d[i].d_un.d_val; + break; + case DT_INIT: + image->init_routine = (d[i].d_un.d_ptr + image->regions[0].delta); + break; + case DT_FINI: + image->term_routine = (d[i].d_un.d_ptr + image->regions[0].delta); + break; + case DT_SONAME: + sonameOffset = d[i].d_un.d_val; + break; + default: + continue; + } + } + + // lets make sure we found all the required sections + if (!image->symhash || !image->syms || !image->strtab) + return false; + + if (sonameOffset >= 0) + strlcpy(image->name, STRING(image, sonameOffset), sizeof(image->name)); + + return true; +} + + +static struct Elf32_Sym * +find_symbol(image_t *image, const char *name, int32 type) +{ + uint32 hash, i; + + // ToDo: "type" is currently ignored! + (void)type; + + if (image->dynamic_ptr == NULL) + return NULL; + + hash = elf_hash((uint8 *)name) % HASHTABSIZE(image); + + for (i = HASHBUCKETS(image)[hash]; i != STN_UNDEF; i = HASHCHAINS(image)[i]) { + struct Elf32_Sym *symbol = &image->syms[i]; + + if (symbol->st_shndx != SHN_UNDEF + && ((ELF32_ST_BIND(symbol->st_info)== STB_GLOBAL) + || (ELF32_ST_BIND(symbol->st_info) == STB_WEAK)) + && !strcmp(SYMNAME(image, symbol), name)) { + // check if the type matches + if ((type == B_SYMBOL_TYPE_TEXT && ELF32_ST_TYPE(symbol->st_info) != STT_FUNC) + || (type == B_SYMBOL_TYPE_DATA && ELF32_ST_TYPE(symbol->st_info) != STT_OBJECT)) + continue; + + return symbol; + } + } + + return NULL; +} + + +static struct Elf32_Sym * +find_symbol_in_loaded_images(image_t **_image, const char *name) +{ + image_t *image; + + for (image = sLoadedImages.head; image; image = image->next) { + struct Elf32_Sym *symbol; + + if (image->dynamic_ptr == NULL) + continue; + + symbol = find_symbol(image, name, B_SYMBOL_TYPE_ANY); + if (symbol) { + *_image = image; + return symbol; + } + } + + return NULL; +} + + +int +resolve_symbol(image_t *image, struct Elf32_Sym *sym, addr_t *sym_addr) +{ + struct Elf32_Sym *sym2; + char *symname; + image_t *shimg; + + switch (sym->st_shndx) { + case SHN_UNDEF: + // patch the symbol name + symname = SYMNAME(image, sym); + + // it's undefined, must be outside this image, try the other image + sym2 = find_symbol_in_loaded_images(&shimg, symname); + if (!sym2) { + printf("elf_resolve_symbol: could not resolve symbol '%s'\n", symname); + return B_MISSING_SYMBOL; + } + + // make sure they're the same type + if (ELF32_ST_TYPE(sym->st_info) != STT_NOTYPE + && ELF32_ST_TYPE(sym->st_info) != ELF32_ST_TYPE(sym2->st_info)) { + printf("elf_resolve_symbol: found symbol '%s' in shared image but wrong type\n", symname); + return B_MISSING_SYMBOL; + } + + if (ELF32_ST_BIND(sym2->st_info) != STB_GLOBAL + && ELF32_ST_BIND(sym2->st_info) != STB_WEAK) { + printf("elf_resolve_symbol: found symbol '%s' but not exported\n", symname); + return B_MISSING_SYMBOL; + } + + *sym_addr = sym2->st_value + shimg->regions[0].delta; + return B_NO_ERROR; + + case SHN_ABS: + *sym_addr = sym->st_value + image->regions[0].delta; + return B_NO_ERROR; + + case SHN_COMMON: + // ToDo: finish this + printf("elf_resolve_symbol: COMMON symbol, finish me!\n"); + return B_ERROR; //ERR_NOT_IMPLEMENTED_YET; + + default: + // standard symbol + *sym_addr = sym->st_value + image->regions[0].delta; + return B_NO_ERROR; + } +} + + +static void +register_image(image_t *image, int fd, const char *path) +{ + struct stat stat; + image_info info; + + // ToDo: set these correctly + info.id = 0; + info.type = image->type; + info.sequence = 0; + info.init_order = 0; + info.init_routine = (void (*)())image->init_routine; + info.term_routine = (void (*)())image->term_routine; + + if (_kern_read_stat(fd, NULL, false, &stat, sizeof(struct stat)) == B_OK) { + info.device = stat.st_dev; + info.node = stat.st_ino; + } else { + info.device = -1; + info.node = -1; + } + + strlcpy(info.name, path, sizeof(info.name)); + info.text = (void *)image->regions[0].vmstart; + info.text_size = image->regions[0].vmsize; + info.data = (void *)image->regions[1].vmstart; + info.data_size = image->regions[1].vmsize; + image->id = _kern_register_image(&info, sizeof(image_info)); +} + + +static status_t +relocate_image(image_t *image) +{ + status_t status = arch_relocate_image(image); + if (status < B_OK) { + FATAL("troubles relocating: 0x%lx\n", status); + return status; + } + + _kern_image_relocated(image->id); + return B_OK; +} + + +static status_t +load_container(char const *name, image_type type, const char *rpath, image_t **_image) +{ + int32 pheaderSize, sheaderSize; + char path[PATH_MAX]; + ssize_t length; + char ph_buff[4096]; + int32 numRegions; + image_t *found; + image_t *image; + status_t status; + int fd; + + struct Elf32_Ehdr eheader; + + // Have we already loaded that image? Don't check for add-ons -- we always + // reload them. + if (type != B_ADD_ON_IMAGE) { + found = find_image(name, APP_OR_LIBRARY_TYPE); + if (found) { + atomic_add(&found->ref_count, 1); + *_image = found; + return B_OK; + } + } + + strlcpy(path, name, sizeof(path)); + + // Try to load explicit image path first + fd = open_executable(path, type, rpath); + if (fd < 0) { + FATAL("cannot open file %s\n", path); + return fd; + } + + // If the path is not absolute, we prepend the CWD to make it one. + if (path[0] != '/') { + char relativePath[PATH_MAX]; + if (!strncmp(path, "./", 2)) + strcpy(relativePath, path + 2); + else + strcpy(relativePath, path); + + // get the CWD + status = _kern_getcwd(path, sizeof(path)); + if (status < B_OK) { + FATAL("_kern_getcwd() failed\n"); + goto err1; + } + + if (strlcat(path, "/", sizeof(path)) >= sizeof(path) + || strlcat(path, relativePath, sizeof(path)) >= sizeof(path)) { + status = B_NAME_TOO_LONG; + FATAL("Absolute path of image %s is too " + "long!\n", relativePath); + goto err1; + } + } + + // Test again if this image has been registered already - this time, + // we can check the full path, not just its name as noted. + // You could end up loading an image twice with symbolic links, else. + if (type != B_ADD_ON_IMAGE) { + found = find_image(path, APP_OR_LIBRARY_TYPE); + if (found) { + atomic_add(&found->ref_count, 1); + *_image = found; + return B_OK; + } + } + + length = _kern_read(fd, 0, &eheader, sizeof(eheader)); + if (length != sizeof(eheader)) { + status = B_NOT_AN_EXECUTABLE; + FATAL("troubles reading ELF header\n"); + goto err1; + } + + status = parse_elf_header(&eheader, &pheaderSize, &sheaderSize); + if (status < B_OK) { + FATAL("incorrect ELF header\n"); + goto err1; + } + + // ToDo: what to do about this restriction?? + if (pheaderSize > (int)sizeof(ph_buff)) { + FATAL("Cannot handle program headers bigger than %lu\n", sizeof(ph_buff)); + status = B_UNSUPPORTED; + goto err1; + } + + length = _kern_read(fd, eheader.e_phoff, ph_buff, pheaderSize); + if (length != pheaderSize) { + FATAL("Could not read program headers: %s\n", strerror(length)); + status = B_BAD_DATA; + goto err1; + } + + numRegions = count_regions(ph_buff, eheader.e_phnum, eheader.e_phentsize); + if (numRegions <= 0) { + FATAL("Troubles parsing Program headers, numRegions = %ld\n", numRegions); + status = B_BAD_DATA; + goto err1; + } + + image = create_image(name, path, numRegions); + if (image == NULL) { + FATAL("Failed to allocate image_t object\n"); + status = B_NO_MEMORY; + goto err1; + } + + status = parse_program_headers(image, ph_buff, eheader.e_phnum, eheader.e_phentsize); + if (status < B_OK) + goto err2; + + if (!assert_dynamic_loadable(image)) { + FATAL("Dynamic segment must be loadable (implementation restriction)\n"); + status = B_UNSUPPORTED; + goto err2; + } + + status = map_image(fd, path, image, type == B_APP_IMAGE); + if (status < B_OK) { + FATAL("Could not map image: %s\n", strerror(status)); + status = B_ERROR; + goto err2; + } + [... truncated: 580 lines follow ...] From stippi at mail.berlios.de Fri Jun 1 18:23:08 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 1 Jun 2007 18:23:08 +0200 Subject: [Haiku-commits] r21284 - haiku/trunk/src/data/beos_mime/application Message-ID: <200706011623.l51GN8Uo011061@sheep.berlios.de> Author: stippi Date: 2007-06-01 18:23:07 +0200 (Fri, 01 Jun 2007) New Revision: 21284 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21284&view=rev Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be-query haiku/trunk/src/data/beos_mime/application/x-vnd.be-querytemplate Log: * added mimetypes for query and query-template -> icons were done by zuMi, thanks! Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be-query =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be-query 2007-06-01 06:46:57 UTC (rev 21283) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be-query 2007-06-01 16:23:07 UTC (rev 21284) @@ -0,0 +1,34 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be-query"; + +resource(2, "META:S:DESC") #'MSDC' "Query"; + +resource(3, "META:L:DESC") #'MLDC' "Query to locate items on disks"; + +resource(5, "META:PREF_APP") #'MSIG' "application/x-vnd.Be-TRAK"; + +resource(6, "META:ICON") #'VICN' array { + $"6E6369660D0399663302000602B87FA13B71ABBBC2A0B8BA5D4B18A2499B1D00" + $"FFCC99FFBD8752020006023B93E4B993E43993E43B93E449A88A479B067C9966" + $"33C0B787590200060237B8FE387961BB324B3A679B4A8E15486E2B00C88C51FF" + $"FFCC9902001602380017B9FFF73A333038334F4A5EC64A0F650067FFFF020006" + $"02BB12A83A8F8CBA8F8CBB12A84B34464AF06300996633FF683A0E020006023A" + $"0ED73B6E12BB6E123A0ED74997CE4860C500FFE6CEFFFFCC99020006023A46DE" + $"3B49ECBB49EC3A46DE4A60614A4DE600AD8A67FF7E4E1E02000602380D6F3BDD" + $"B9BBDDB9380D6F4975C04A037100EECEAEFFCC99660301000004007502000603" + $"380017B9FFF73A333038334F4A5EC64A0F65004B4116BDBAB088FFFCF8E80301" + $"00000D0A042C403C473C4C2C440A062A402A4C42585A405A36422C0A042A4042" + $"4C5A36422C0A06C688BDF6C8A6BC05C0AFB8B3B86EBF95BA6CC09442340A04C6" + $"88BDF6C069C392BA6CC09442340A0442585A405A36424C0A062632264E425C44" + $"5A443C28300A042632423E443C28300A04425C445A443C423E0A04264E425C42" + $"3E26320A07425E545E565C4B5762405C3E423E0A09585450505C50544C604C58" + $"486448584246540A0546454636362F3643C058C33C140A0A020A0B201C200A09" + $"0101301C2001178410040A010102201C200A020103201C200A030104201C200A" + $"050105201C200A0C010C30281401178410040A0B010C2028140A0C010C302418" + $"01178410040A0B010C2024180A0C010C30201C01178410040A0B010C20201C0A" + $"0C010C301C2001178410040A0B010C201C200A090106301C2001178400040A06" + $"0107201C200A070108201C200A080109201C200A000100201E240A0C0100201C" + $"20" +}; Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be-querytemplate =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be-querytemplate 2007-06-01 06:46:57 UTC (rev 21283) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be-querytemplate 2007-06-01 16:23:07 UTC (rev 21284) @@ -0,0 +1,36 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be-querytemplate"; + +resource(2, "META:S:DESC") #'MSDC' "Query Template"; + +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Be-TRAK"; + +resource(5, "META:ICON") #'VICN' array { + $"6E63696611040075040075030100000382735002000603392ACA392AC8B92AC8" + $"392ACA4AA5E84A8FB600F7F3DC3FFFFFFFFFD7C38502000602B87FA13B71ABBB" + $"C2A0B8BA5D4B18A2499B1D00FFCC99FFBD8752020006023B93E4B993E43993E4" + $"3B93E449A88A479B067C996633C0B787590200060237B8FE387961BB324B3A67" + $"9B4A8E15486E2B00C88C51FFFFCC9902001602380017B9FFF73A333038334F4A" + $"5EC64A0F650067FFFF02000602BB12A83A8F8CBA8F8CBB12A84B34464AF06300" + $"996633FF683A0E020006023A0ED73B6E12BB6E123A0ED74997CE4860C500FFE6" + $"CEFFFFCC99020006023A46DE3B49ECBB49EC3A46DE4A60614A4DE600AD8A67FF" + $"7E4E1E02000602380D6F3BDDB9BBDDB9380D6F4975C04A037100EECEAEFFCC99" + $"660301000002000603380017B9FFF73A333038334F4A5EC64A0F65004B4116BD" + $"BAB088FFFCF8E803010000039965330F0A0C425E545E565C4B57C55354525460" + $"465C445CC22362405C3E423E0607EE3FC5C0BC69C1B7C00BC1B7C00B44424446" + $"4A414A415245C6214FC61F4FC6214F5A455A45CA1E455438CAE1BE2452370604" + $"BE4E3DC5C0BC694E39C5C0BC6945414541C15EC0A644460606FA0FC5C0BC69C1" + $"B7C00B4A4148405245C6214FC61F4FC6214F5A455A45CA1E455438CAE1BE2452" + $"370204C1B7C00B4741C1B7C00B4A4148405245C6214FC61F4FC6214F49425147" + $"49420A062A402A4C42585A405A36422C0A042A40424C5A36422C0A06C688BDF6" + $"C8A6BC05C0AFB8B3B86EBF95BA6CC09442340A04C688BDF6C069C392BA6CC094" + $"42340A0442585A405A36424C0A062632264E425C445A443C28300A042632423E" + $"443C28300A04425C445A443C423E0A04264E425C423E26320A042C403C473C4C" + $"2C44100A000100201C200A0D0105301C2001178410040A050106201C200A0601" + $"07201C200A070108201C200A090109201C200A020101301C2001178400040A03" + $"0102201C200A040103201C200A020104201C200A0D010A301C2001178400040A" + $"0A010B201C200A0B010C201C200A0C010D201C200A10010E201E240A0F010E20" + $"1C20" +}; From stippi at mail.berlios.de Fri Jun 1 18:26:04 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 1 Jun 2007 18:26:04 +0200 Subject: [Haiku-commits] r21285 - haiku/trunk/src/data/beos_mime/application Message-ID: <200706011626.l51GQ4Dj011352@sheep.berlios.de> Author: stippi Date: 2007-06-01 18:26:04 +0200 (Fri, 01 Jun 2007) New Revision: 21285 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21285&view=rev Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be-symlink Log: * added the symlink type, icon is also based on work by zuMi Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be-symlink =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be-symlink 2007-06-01 16:23:07 UTC (rev 21284) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be-symlink 2007-06-01 16:26:04 UTC (rev 21285) @@ -0,0 +1,45 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be-symlink"; + +resource(2, "META:S:DESC") #'MSDC' "Symbolic Link"; + +resource(3, "META:L:DESC") #'MLDC' "Link to another item in the file system"; + +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Be-TRAK"; + +resource(5, "META:ICON") #'VICN' array { + $"6E6369660D050004017405FF020006023C43C6B9E5E23A85A83CEE414268F44A" + $"445900C6D7F5FF6B94DD02000602B9D49D35981FB8770CBCA0894867F64AA0A5" + $"00E3EDFFFF9EC2FF0200060239D87A393353BB32CD3BD7D949243A49B0830000" + $"3CB0FF054CDC03EC6666020006023BC0000000000000003D20004B1000000000" + $"00FFC7C7FFFFACAC03FFC7C7020006023C0AE63B3927BC611E3D03FF4C25624A" + $"1A9600A3043CFFFF90AF020006023B2B47BB18653D0FA53D225148297046CA19" + $"00FFEC4BFFF0A506020006023B3049396B0ABA90833C646E4A101543299500FF" + $"FFFFFFFFF289020006023A1DA6393F04BBB5BC3C6B074AEA3648091100F99B05" + $"FFFCB23D340A03275D2D5829560A042C533153444838440A042357275A285627" + $"540A03275A275423570A03275A285627540A0836483641323E2C3C223722472C" + $"513A490A062B3E283E223722472C512C410A03B644BEA22C3C22370A032B3E2C" + $"412C3C0A03323E2C3C2C410A032B3E2C3C283D0A0636483641323E2C412C513A" + $"490A04603E5C3C4E4D534D0A0A4A2A462D443642383E3A3E424E4B5A3F5A2D4C" + $"280A0349404C38473C0A08523552375038503C4E3C4E4B5A3F5A2D0A04502E4A" + $"2E4C384E320A034E324C3852350A084940473C42383E3A3E424E4B4E3C4B3D0A" + $"0344364C38462C0A03503C50384C380A044238473C4C3844360A04503C4C384B" + $"3D4E3C0A074C284A2A4A2EC5ED2E4EBA4552355A2D0A03523852354C380A0349" + $"404B3D4C380A044A2A462D4C384A2E0A0441564058445847560A044F524A564C" + $"5654540A044B4E444C45504A500A043558315B375BBDBE580A075C5A575F595F" + $"5ECAF85E5A60C8E25B560A0D3E503C513A56325532593A56405644544B544D52" + $"49524550434B0A09575851585059545D575D5A5B5A585C5859560A0332553259" + $"3A560A03434B3E50414F0A053C523F56445445523F530A045258545B575B5758" + $"0A0345524A5245500A033F563C523A560A0344544A5445520A043C523F534552" + $"414F0A035059535D52580A0659565758575B595A5A585C580A04414F45524550" + $"434B0A034A544D5245520A08595A575BC785CA4F5258535D575D5A5B5A580A04" + $"523553344F324E320A03503850374C380A084B3CC386BF3C483B4238473C4940" + $"4B3D4E3C0A044A2E4C384B2F502E0A082237283E2B3E2C41323E2C3F2C3D293D" + $"0D0A010800011B1C1D1E1F0C000A000505020D20211001178400040A04040708" + $"090A000A03020603000A05020B04000A09030F0E10000A060412111314000A07" + $"0415161718000A0802191A000A0B0423242526000A0A062728292A2B22000A0C" + $"032C2D2E000A02052F3031333200" +}; + From stippi at mail.berlios.de Fri Jun 1 18:28:39 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 1 Jun 2007 18:28:39 +0200 Subject: [Haiku-commits] r21286 - haiku/trunk/src/kits/tracker Message-ID: <200706011628.l51GSd1B011475@sheep.berlios.de> Author: stippi Date: 2007-06-01 18:28:39 +0200 (Fri, 01 Jun 2007) New Revision: 21286 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21286&view=rev Modified: haiku/trunk/src/kits/tracker/TrackerIcons.rdef Log: * added query, query-template, printer, generic printer, floppy and bookmark icons. -> all done by zuMi sometimes with minor modifications by myself Modified: haiku/trunk/src/kits/tracker/TrackerIcons.rdef =================================================================== --- haiku/trunk/src/kits/tracker/TrackerIcons.rdef 2007-06-01 16:26:04 UTC (rev 21285) +++ haiku/trunk/src/kits/tracker/TrackerIcons.rdef 2007-06-01 16:28:39 UTC (rev 21286) @@ -36,6 +36,58 @@ #ifdef HAIKU_TARGET_PLATFORM_HAIKU +resource(2, "BEOS:L:application/x-vnd.Be-query") #'VICN' array { + $"6E6369660D0399663302000602B87FA13B71ABBBC2A0B8BA5D4B18A2499B1D00" + $"FFCC99FFBD8752020006023B93E4B993E43993E43B93E449A88A479B067C9966" + $"33C0B787590200060237B8FE387961BB324B3A679B4A8E15486E2B00C88C51FF" + $"FFCC9902001602380017B9FFF73A333038334F4A5EC64A0F650067FFFF020006" + $"02BB12A83A8F8CBA8F8CBB12A84B34464AF06300996633FF683A0E020006023A" + $"0ED73B6E12BB6E123A0ED74997CE4860C500FFE6CEFFFFCC99020006023A46DE" + $"3B49ECBB49EC3A46DE4A60614A4DE600AD8A67FF7E4E1E02000602380D6F3BDD" + $"B9BBDDB9380D6F4975C04A037100EECEAEFFCC99660301000004007502000603" + $"380017B9FFF73A333038334F4A5EC64A0F65004B4116BDBAB088FFFCF8E80301" + $"00000D0A042C403C473C4C2C440A062A402A4C42585A405A36422C0A042A4042" + $"4C5A36422C0A06C688BDF6C8A6BC05C0AFB8B3B86EBF95BA6CC09442340A04C6" + $"88BDF6C069C392BA6CC09442340A0442585A405A36424C0A062632264E425C44" + $"5A443C28300A042632423E443C28300A04425C445A443C423E0A04264E425C42" + $"3E26320A07425E545E565C4B5762405C3E423E0A09585450505C50544C604C58" + $"486448584246540A0546454636362F3643C058C33C140A0A020A0B201C200A09" + $"0101301C2001178410040A010102201C200A020103201C200A030104201C200A" + $"050105201C200A0C010C30281401178410040A0B010C2028140A0C010C302418" + $"01178410040A0B010C2024180A0C010C30201C01178410040A0B010C20201C0A" + $"0C010C301C2001178410040A0B010C201C200A090106301C2001178400040A06" + $"0107201C200A070108201C200A080109201C200A000100201E240A0C0100201C" + $"20" +}; + +resource(4, "BEOS:L:application/x-vnd.be-querytemplate") #'VICN' array { + $"6E63696611040075040075030100000382735002000603392ACA392AC8B92AC8" + $"392ACA4AA5E84A8FB600F7F3DC3FFFFFFFFFD7C38502000602B87FA13B71ABBB" + $"C2A0B8BA5D4B18A2499B1D00FFCC99FFBD8752020006023B93E4B993E43993E4" + $"3B93E449A88A479B067C996633C0B787590200060237B8FE387961BB324B3A67" + $"9B4A8E15486E2B00C88C51FFFFCC9902001602380017B9FFF73A333038334F4A" + $"5EC64A0F650067FFFF02000602BB12A83A8F8CBA8F8CBB12A84B34464AF06300" + $"996633FF683A0E020006023A0ED73B6E12BB6E123A0ED74997CE4860C500FFE6" + $"CEFFFFCC99020006023A46DE3B49ECBB49EC3A46DE4A60614A4DE600AD8A67FF" + $"7E4E1E02000602380D6F3BDDB9BBDDB9380D6F4975C04A037100EECEAEFFCC99" + $"660301000002000603380017B9FFF73A333038334F4A5EC64A0F65004B4116BD" + $"BAB088FFFCF8E803010000039965330F0A0C425E545E565C4B57C55354525460" + $"465C445CC22362405C3E423E0607EE3FC5C0BC69C1B7C00BC1B7C00B44424446" + $"4A414A415245C6214FC61F4FC6214F5A455A45CA1E455438CAE1BE2452370604" + $"BE4E3DC5C0BC694E39C5C0BC6945414541C15EC0A644460606FA0FC5C0BC69C1" + $"B7C00B4A4148405245C6214FC61F4FC6214F5A455A45CA1E455438CAE1BE2452" + $"370204C1B7C00B4741C1B7C00B4A4148405245C6214FC61F4FC6214F49425147" + $"49420A062A402A4C42585A405A36422C0A042A40424C5A36422C0A06C688BDF6" + $"C8A6BC05C0AFB8B3B86EBF95BA6CC09442340A04C688BDF6C069C392BA6CC094" + $"42340A0442585A405A36424C0A062632264E425C445A443C28300A042632423E" + $"443C28300A04425C445A443C423E0A04264E425C423E26320A042C403C473C4C" + $"2C44100A000100201C200A0D0105301C2001178410040A050106201C200A0601" + $"07201C200A070108201C200A090109201C200A020101301C2001178400040A03" + $"0102201C200A040103201C200A020104201C200A0D010A301C2001178400040A" + $"0A010B201C200A0B010C201C200A0C010D201C200A10010E201E240A0F010E20" + $"1C20" +}; + resource(R_BeosFolderIcon) #'VICN' array { $"6E636966080500020006023841813C9B3BBEAB393A4F584B254D4A7AEB00FFE2" $"ACFFF49806020016022C60673CAAABBEBB082E6EFB4BBA064A22B000FFFF8E02" @@ -467,6 +519,89 @@ $"032C2D2E000A02052F3031333200" }; +resource(R_PrinterIcon) #'VICN' array { + $"6E6369660B050002001602B76E71BBF8593D1210B8A7674742A04ABEFB00AEFF" + $"E1053802001603373333B9333339333337333348E54F4B555400FFBFE5FF9B02" + $"00160336C6F3B9284239E397376BB94A71BE484A25005346B5FFFF02001602B5" + $"00003A6000BA6000B500004A2E244AB9D001C0FF9A020116023AA41339C70ABC" + $"27003D026E4ACAB74AC8AB0183FFAD020106023600000000000000003700004A" + $"10004AB0000035FF06FB1E9303020106023600000000000000003700004A1000" + $"4AB00000FFE3E3FFDD05050101000073020116023E1E41BC9E393B21B93C88A6" + $"4824E3485D850090FF3C0B0606BE023A5F485C46584C5E5656525A5656604C58" + $"483A0608EFB6302E302E25372248223A2248465A4A59485B4A59584B41573E58" + $"3F563D543C0608AAFF503A4E3C3231342F302E302E25372248223A2248465A46" + $"5A464C543C4A46543C0606FF06573E583F563D543C543C4A46465A464C465A4A" + $"59485B4A59584B410604DB4A594A4F4A59584B41563F563F4E470A0426484256" + $"4252264406057A0322513A5E42543C58425452B77BC262B77BC262254A080228" + $"5038580A06542A3C22353135324C3B4C3A0202404A3E4C4248434D454B414F02" + $"0332332B3332334B3E4B3E453E3547444E26400F0A090100000A000301060810" + $"01178400040A010102000A0001051001178200040A020105000A030106000A04" + $"0108000A050103000A060104000A08010920251C0A0701092022210A00010730" + $"241C01178100040A00010730221E01178100040A0001071815FF01178100040A" + $"0A010A00" +}; + +// NOTE: same as printer +resource(R_GenericPrinterIcon) #'VICN' array { + $"6E6369660B050002001602B76E71BBF8593D1210B8A7674742A04ABEFB00AEFF" + $"E1053802001603373333B9333339333337333348E54F4B555400FFBFE5FF9B02" + $"00160336C6F3B9284239E397376BB94A71BE484A25005346B5FFFF02001602B5" + $"00003A6000BA6000B500004A2E244AB9D001C0FF9A020116023AA41339C70ABC" + $"27003D026E4ACAB74AC8AB0183FFAD020106023600000000000000003700004A" + $"10004AB0000035FF06FB1E9303020106023600000000000000003700004A1000" + $"4AB00000FFE3E3FFDD05050101000073020116023E1E41BC9E393B21B93C88A6" + $"4824E3485D850090FF3C0B0606BE023A5F485C46584C5E5656525A5656604C58" + $"483A0608EFB6302E302E25372248223A2248465A4A59485B4A59584B41573E58" + $"3F563D543C0608AAFF503A4E3C3231342F302E302E25372248223A2248465A46" + $"5A464C543C4A46543C0606FF06573E583F563D543C543C4A46465A464C465A4A" + $"59485B4A59584B410604DB4A594A4F4A59584B41563F563F4E470A0426484256" + $"4252264406057A0322513A5E42543C58425452B77BC262B77BC262254A080228" + $"5038580A06542A3C22353135324C3B4C3A0202404A3E4C4248434D454B414F02" + $"0332332B3332334B3E4B3E453E3547444E26400F0A090100000A000301060810" + $"01178400040A010102000A0001051001178200040A020105000A030106000A04" + $"0108000A050103000A060104000A08010920251C0A0701092022210A00010730" + $"241C01178100040A00010730221E01178100040A0001071815FF01178100040A" + $"0A010A00" +}; + + +resource(R_FloppyIcon) #'VICN' array { + $"6E6369660B03010000010100006A02001602386AAD38EB7ABB77733ADE88488E" + $"DC4A75ED008AFF4B05300200160239489738494ABADB693C0D394B5BD14A1EEC" + $"003AFF7802001602B716A4BA87FE3CB207B949ED4847D84A1E620175FEC40200" + $"1602B716A4BA87FE3CB207B949ED4847D84A1E62015CFE9B020016023917223B" + $"09FEBD22413B2FCE49B5F04A341100E6FF930200160333210A3829DFBAB4C535" + $"E9EC49C4C54A797A00E16DFFFDD0020016023667BE39DDBCBE50043AE09F4B65" + $"01492A3F00FFFFF103386DBE0C0A05425C42405C406042465C0A06425A5A425A" + $"3E3A312245B3CBC3BB0A04425A224A224542540A04425A5A425A3E42540A0842" + $"545A3EC7BABDFC4648313FBF38BA863A3122450A043DC91DBC25C7E8BC22C5A5" + $"BE8FC6CA0A04BC25C7E8B634C4EF28C2DCBC22C5A50A04BEBBC323C117C4353D" + $"52BC1FC5C30A042F42BEBBC323BC1FC5C328480A044648C7BABDFCBF38BA8631" + $"3F0802353E46C1E30A04B946C3D5344630C17DB7AEC3090C0A010100000A0001" + $"011001178400040A020102000A040103000A050104000A030105000A06010700" + $"0A070106000A080108000A090109000A0A010A1815FF01178100040A00010B00" +}; + +resource(R_BookmarkIcon) #'ICON' array { + $"6E63696608010100006B02001602BA6666BB33323B3332BA6666480CCD4BD333" + $"00D8FFEC0200160439D755BC0F313C0F3139D7554AE7974ABAE901FA1C8C7934" + $"FFC202001603378CEDB9CE9739CE97378CED4AADF149868800B684FAFFD20200" + $"16033772A3B9729F39729F3772A349C4734AAF6E01CCD9FAFFC8020016023B64" + $"5ABDAC373C450A3A18A04957524B6E2E007DFFBB03010000020006033AE5823A" + $"E582BAE5823AE5824A7B444AA80500FF06067FFF7575FF7E03030E0A06224B22" + $"503E5E5A425A3D3E340605E7035A3D57405A3D423E5E3E583E5843534CC3EF47" + $"4B4E460A043E5E2250224B3E580605FE02224B3E583E5843534CC3EF474B4E46" + $"5A3D57405A3D3E340604EB323C323C32323B2E57354C4A4C3C4C4A02043E533E" + $"5342514C4A444A4C4A303E303E2A3E2246264422460A0434C91D3E5D44C8B73E" + $"5C0A0439C91D3E5BC059C8B73EC9E90A03224F26C653224E0A03224D2950224C" + $"0A035A42C7EBC2575ABFF30A035A40C8B7435A3F0609FEF303303D303A303A34" + $"BE2C4B45C269C0E04F47504C4F49514F5553C717C6E35553525257525750564D" + $"504E524C4EC418C379C4D9C404C418C379060BA2680B3E60434E545258545854" + $"54504E6042604A60425C403E0A0A00010D000A06030005041001178400040A05" + $"0101000A010102000A020103000A030104000A040105000A0606060708090A0B" + $"000A06010C1001178422040A07010C00" +}; + #endif // HAIKU_TARGET_PLATFORM_HAIKU resource(2, "BEOS:L:application/x-vnd.Be-query") #'ICON' array { From stippi at mail.berlios.de Fri Jun 1 18:32:34 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 1 Jun 2007 18:32:34 +0200 Subject: [Haiku-commits] r21287 - haiku/trunk/src/preferences/dun Message-ID: <200706011632.l51GWYfc017294@sheep.berlios.de> Author: stippi Date: 2007-06-01 18:32:30 +0200 (Fri, 01 Jun 2007) New Revision: 21287 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21287&view=rev Modified: haiku/trunk/src/preferences/dun/DUN.rdef Log: * added modem icon done by zuMi Modified: haiku/trunk/src/preferences/dun/DUN.rdef =================================================================== --- haiku/trunk/src/preferences/dun/DUN.rdef 2007-06-01 16:28:39 UTC (rev 21286) +++ haiku/trunk/src/preferences/dun/DUN.rdef 2007-06-01 16:32:30 UTC (rev 21287) @@ -1,6 +1,25 @@ resource(1, "BEOS:FILE_TYPES") message; +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + +resource vector_icon { + $"6E63696609020016023877103BCE2CBBCE2C3877104964A94A5EC90065FF2302" + $"00160236204B3AEC69BBEF7B36DCB64A12D04A1BEF0093FF5A02001602BAD095" + $"B72CA4382BBEBBD9934AB28E4B72FE00BCFF8702001602355FF83C1D50BBFAF1" + $"352D264A79DE49B7EE00ECFFC502000602AE995A360D91B832FCB0C8B8478048" + $"4A5C0A0006FF06FF049404030100000304940402000202B81D0038F008BA6F70" + $"B980FD4BF4DA4876A90000010000FF000100FF040174080A062242224C425C56" + $"48563E38320A04224C425C425022420A04425C5648563E42500605AE02224238" + $"422C3C44484250563E383206033A22424250384244482C3C0A062D422A452A48" + $"2C492C462F4308025C32503C0A05425E495E5E48584542450D0A080107000A07" + $"0106300B1C01178422040A07010630141F01178422040A070106301D22011784" + $"22040A0501001001178400040A000101000A020102000A030103000A01010400" + $"0A040105201E210A0401052025B4A40A040105202AB5970A040105202F29" +}; + +#else // HAIKU_TARGET_PLATFORM_HAIKU + resource(101, "BEOS:L:STD_ICON") #'ICON' array { $"FFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" @@ -57,6 +76,8 @@ $"FFFF00000E0F0F0F0FFFFFFFFFFFFFFF" }; +#endif // HAIKU_TARGET_PLATFORM_HAIKU + resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.OBOS.Dial-UpNetworking"; resource(1, "BEOS:APP_VERSION") #'APPV' array From stippi at mail.berlios.de Fri Jun 1 18:37:05 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 1 Jun 2007 18:37:05 +0200 Subject: [Haiku-commits] r21288 - in haiku/trunk/src/preferences: devices joysticks print Message-ID: <200706011637.l51Gb5cm026742@sheep.berlios.de> Author: stippi Date: 2007-06-01 18:37:03 +0200 (Fri, 01 Jun 2007) New Revision: 21288 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21288&view=rev Modified: haiku/trunk/src/preferences/devices/Devices.rdef haiku/trunk/src/preferences/joysticks/Joysticks.rdef haiku/trunk/src/preferences/print/Printers.rdef Log: * added icons for Devices, Joystick and Printers -> done by zuMi with very minor modifications by myself Modified: haiku/trunk/src/preferences/devices/Devices.rdef =================================================================== --- haiku/trunk/src/preferences/devices/Devices.rdef 2007-06-01 16:32:30 UTC (rev 21287) +++ haiku/trunk/src/preferences/devices/Devices.rdef 2007-06-01 16:37:03 UTC (rev 21288) @@ -1,4 +1,48 @@ +resource app_signature "application/x-vnd.OBOS.Devices"; + +resource app_version +{ + major = 1, + middle = 0, + minor = 0, + + /* 0 = development 1 = alpha 2 = beta + 3 = gamma 4 = golden master 5 = final */ + variety = 2, + + internal = 0, + + short_info = "Devices", + long_info = "Devices ?2002-2007 Haiku" +}; + +resource app_flags B_SINGLE_LAUNCH; + +resource file_types message; + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + +resource vector_icon { + $"6E6369660705010200060239F8173B7914BB791439F8174A3FA149A2B701A3D4" + $"44FF70A804020016053BB7B3BCF33339625B3821E44A58094AD9AF000C5E79A5" + $"C6C9A2FFE80200160236D6EA388279B97B4437F0674A89C84B17E100D3FFA902" + $"001602340AA2385710B9E87A3568D5499E454989E30071FF01020006023887A2" + $"3BCB73BBCB733887A24A60F4493C2E01FFF2ACFFFFD805010100006B0C0A0824" + $"4048525842C6E5BF675041463CC306BD9636320609DADB024258465A584456C1" + $"81C8C144565A405A405A3F5C3C3A5A3A5A3B5A3A425006066E0B42585A405A40" + $"5A3F5D3B395A3A5A3B5A3A42500609DA6E024250465254445544534457465845" + $"5645574555485250424E0607DA26425046525444554453445746585A42580A04" + $"4D4C504950454D480A04373A3F3E3A43323F08053734294037473A45494D0805" + $"3A35333B3E423D434B4B08043D373241364340390807443B413E434240464348" + $"484250460A0D465C4C5C485A6042603D5E3D5B3F57424C3E4D3C363124444655" + $"0B0A06010B000A0001001001178410040A010100000A05040708090A10011782" + $"00040A040106000A040106023F1C710000000000003F1C714771C74731C70A00" + $"01011001178410040A020102000A000103000A030104000A00010500" +}; + +#else // HAIKU_TARGET_PLATFORM_HAIKU + resource large_icon { $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" @@ -55,14 +99,4 @@ $"FFFF00000E0F0F0F0FFFFFFF000F0FFF" }; -resource file_types message; - -resource app_signature "application/x-vnd.OBOS.Devices"; - -resource app_version -{ - short_info = "OBOS-Devices", - long_info = "OpenBeOS version of Devices" -}; - -resource app_flags B_SINGLE_LAUNCH; +#endif // HAIKU_TARGET_PLATFORM_HAIKU Modified: haiku/trunk/src/preferences/joysticks/Joysticks.rdef =================================================================== --- haiku/trunk/src/preferences/joysticks/Joysticks.rdef 2007-06-01 16:32:30 UTC (rev 21287) +++ haiku/trunk/src/preferences/joysticks/Joysticks.rdef 2007-06-01 16:37:03 UTC (rev 21288) @@ -21,30 +21,31 @@ #ifdef HAIKU_TARGET_PLATFORM_HAIKU resource vector_icon { - $"6E6369661102001602AE1F623AC0B4BC7FF4AFDAE84B61574B01BF0099FE8002" - $"0016023A72333A634ABACB4D3ADCBF49B5514AA84A00CCFDB402001602389476" - $"3AB560BCB5603A94764AE4104A26C500E5FFD5020116023C0000000000000000" - $"3C000048FC0049AC000099FF33056602011602BC6AE033DF93B1CA89BA5DBE4A" - $"838A4A71F20099FF3305330200160236000000000000000036000049C00049F0" - $"000099FF33020106033B4F850000000000003B4F85495FFB467FF700FFFFFF7F" - $"FF3300FFCC0000020006023800000000000000003800004B00004A900000FF33" - $"33FFCC00000566020106023793E43593E4B593E43793E44AF1B04A351100FFAC" - $"ACFFF56A6A03010000010100007B056105A50537100A044456445C584858440A" - $"044456445C244C24480A042448445658443A3602044A454ABFC24AC3B83E4EC1" - $"974EBC504E324532C3B832BFC23E3CBC503CC1973C020447C12547BFD347C276" - $"3EC389C0EFC389BCF8C38935C12535C27635BFD33EBEC1BCF8BEC1C0EFBEC102" - $"04424542C11542C2663E48BFD548BE12483A453AC2663AC1153E42BE1242BFD5" - $"4206051F033E48BEA948BF3E4840C2C5BF83C2DF40C2C5333C3CC2C53CC2C5BE" - $"64C2DF0204472D47B63347BA283E36C0EE36BCF936352D35BA2835B6333E24BC" - $"F924C0EE240204544554C11554C2665048C70148C53E484C454CC2664CC11550" - $"42C53E42C701420204534453C0E753C1C85046C6C846C577464D444DC1C84DC0" - $"E75042C57742C6C8420804445E4A5E60485A450A043E494449474542450A0444" - $"49444D484947450A04444D4E4D524949490A054E4D4E4D4E52524E524906031F" - $"3C363C363C3840393E39403936140A0D010A000A0D01072039460A0C04000102" - $"071001178422040A000100000A010101000A020102000A030103000A04010310" - $"01178000040A050104000A060105000A070106000A10010F000A080107000A09" - $"0108000A0A01081001178000040A0B0109000A10010B000A0C010C000A0F010D" - $"000A0E010E00" + $"6E6369660D010100007B0301000002001602B6D0E43AA952BC6AB8B88EA74B51" + $"7F4B2BA80099FE6C020016023A72333A634ABACB4D3ADCBF48F5514AA84A00CC" + $"FFA5020016023894763AB560BCB5603A94764A641049CD8A00E5FFCB059B0201" + $"16023B8098B9DD5539DD553B809848E42F46770900E4FF2102030603378AE535" + $"B709B5B709378AE54A430349497B00010000766C6C6CFE010101020016023A80" + $"82ACB0492C262B39FFF649BEEE46822801BEFF0B020116033800000000000000" + $"003BC00049400049300000FFC886FF41020106033B4F850000000000003B4F85" + $"495FFB467FF700FFFFFF7FFF3300FFCC00000200060338000000000000000038" + $"00004B20004A400000FF595999B30404FFFF0606020106033B80000000000000" + $"003B800049400046800000FFD5D570FBAAAAFFEE06060A0A06224A224E425E56" + $"4A564638390A044258425E564A56460A044258425E224E224A0605FA02224A42" + $"58C3B9C674C3B9C674404EC6CBC1644246C6CBC164383906033BC3B9C674404E" + $"C3B9C6745646C6CBC164C6CBC1644246020447C0BF47BF6D47C2103EC323C0EF" + $"C323BCF8C32335C0BF35C21035BF6D3EBE5BBCF8BE5BC0EFBE5B06051F033C49" + $"BDDD49BE72493EC32BBEB7C3453EC32B373A3AC32B3AC32BBD98C34502043E24" + $"BCB824C12F24482E48B65848BACF3E38C12F38BCB838342E34BACF34B6580204" + $"544454435445514654464E464E444E454E4351414E4154410A05426046605C4A" + $"58484248120A000109000A000107024066660000000000003ECCCC4700004A93" + $"330A0101001001178400040A020101000A030102000A040103000A050104000A" + $"010107124066660000000000003F9999C60000494CCC01178400040A06010702" + $"4066660000000000003F9999C60000494CCC0A080107123F9999000000000000" + $"3E6EEF400000498F7701178400040A070107023F99990000000000003E999940" + $"0000496CCC0A010107023D33330000000000003C66664800004A2CCC0A090106" + $"000A010107301E2201178400040A0A0107201E220A010108301E220117840004" + $"0A0B0108201E220A0C0107023C66660000000000003B33334A60004A1333" }; #else // HAIKU_TARGET_PLATFORM_HAIKU Modified: haiku/trunk/src/preferences/print/Printers.rdef =================================================================== --- haiku/trunk/src/preferences/print/Printers.rdef 2007-06-01 16:32:30 UTC (rev 21287) +++ haiku/trunk/src/preferences/print/Printers.rdef 2007-06-01 16:37:03 UTC (rev 21288) @@ -18,6 +18,32 @@ long_info = "Printers ?2001-2006 Haiku" }; +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + +resource vector_icon { + $"6E6369660B050002001602B76E71BBF8593D1210B8A7674742A04ABEFB00AEFF" + $"E1053802001603373333B9333339333337333348E54F4B555400FFBFE5FF9B02" + $"00160336C6F3B9284239E397376BB94A71BE484A25005346B5FFFF02001602B5" + $"00003A6000BA6000B500004A2E244AB9D001C0FF9A020116023AA41339C70ABC" + $"27003D026E4ACAB74AC8AB0183FFAD020106023600000000000000003700004A" + $"10004AB0000035FF06FB1E9303020106023600000000000000003700004A1000" + $"4AB00000FFE3E3FFDD05050101000073020116023E1E41BC9E393B21B93C88A6" + $"4824E3485D850090FF3C0B0606BE023A5F485C46584C5E5656525A5656604C58" + $"483A0608EFB6302E302E25372248223A2248465A4A59485B4A59584B41573E58" + $"3F563D543C0608AAFF503A4E3C3231342F302E302E25372248223A2248465A46" + $"5A464C543C4A46543C0606FF06573E583F563D543C543C4A46465A464C465A4A" + $"59485B4A59584B410604DB4A594A4F4A59584B41563F563F4E470A0426484256" + $"4252264406057A0322513A5E42543C58425452B77BC262B77BC262254A080228" + $"5038580A06542A3C22353135324C3B4C3A0202404A3E4C4248434D454B414F02" + $"0332332B3332334B3E4B3E453E3547444E26400F0A090100000A000301060810" + $"01178400040A010102000A0001051001178200040A020105000A030106000A04" + $"0108000A050103000A060104000A08010920251C0A0701092022210A00010730" + $"241C01178100040A00010730221E01178100040A0001071815FF01178100040A" + $"0A010A00" +}; + +#else // HAIKU_TARGET_PLATFORM_HAIKU + resource(101, "BEOS:L:STD_ICON") #'ICON' array { $"FFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF0404FFFFFFFFFFFFFFFFFFFFFFFFFF" $"FFFFFFFFFFFFFFFFFFFFFFFF003F3F00043F3F0404FFFFFFFFFFFFFFFFFFFFFF" @@ -72,6 +98,8 @@ $"FFFF00000E0F0F0F0FFFFFFFFFFFFFFF" }; +#endif // HAIKU_TARGET_PLATFORM_HAIKU + resource(1, "BEOS:FILE_TYPES") message; resource(0, "init_icon") #'bits' array { From stippi at mail.berlios.de Fri Jun 1 19:32:56 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 1 Jun 2007 19:32:56 +0200 Subject: [Haiku-commits] r21289 - haiku/trunk/src/kits/tracker Message-ID: <200706011732.l51HWuis028465@sheep.berlios.de> Author: stippi Date: 2007-06-01 19:32:55 +0200 (Fri, 01 Jun 2007) New Revision: 21289 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21289&view=rev Modified: haiku/trunk/src/kits/tracker/TrackerIcons.rdef Log: * messed up the build... ICON->VICN Modified: haiku/trunk/src/kits/tracker/TrackerIcons.rdef =================================================================== --- haiku/trunk/src/kits/tracker/TrackerIcons.rdef 2007-06-01 16:37:03 UTC (rev 21288) +++ haiku/trunk/src/kits/tracker/TrackerIcons.rdef 2007-06-01 17:32:55 UTC (rev 21289) @@ -582,7 +582,7 @@ $"0A070106000A080108000A090109000A0A010A1815FF01178100040A00010B00" }; -resource(R_BookmarkIcon) #'ICON' array { +resource(R_BookmarkIcon) #'VICN' array { $"6E63696608010100006B02001602BA6666BB33323B3332BA6666480CCD4BD333" $"00D8FFEC0200160439D755BC0F313C0F3139D7554AE7974ABAE901FA1C8C7934" $"FFC202001603378CEDB9CE9739CE97378CED4AADF149868800B684FAFFD20200" From bonefish at mail.berlios.de Fri Jun 1 20:09:33 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 1 Jun 2007 20:09:33 +0200 Subject: [Haiku-commits] r21290 - in haiku/trunk/src/system/runtime_loader: . arch/ppc arch/x86 Message-ID: <200706011809.l51I9Xc7030882@sheep.berlios.de> Author: bonefish Date: 2007-06-01 20:09:32 +0200 (Fri, 01 Jun 2007) New Revision: 21290 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21290&view=rev Modified: haiku/trunk/src/system/runtime_loader/Jamfile haiku/trunk/src/system/runtime_loader/arch/ppc/arch_relocate.c haiku/trunk/src/system/runtime_loader/arch/x86/arch_relocate.c haiku/trunk/src/system/runtime_loader/elf.cpp haiku/trunk/src/system/runtime_loader/runtime_loader_private.h Log: * Got rid of sLoadingImages. It was always empty. * The previous symbol resolution code was incorrect. It would search all loaded images in the order they had been loaded. Thus an add-on would possibly see a symbol of an earlier loaded add-on. Now we search recursively starting with the respective root image (executable or add-on). * Added BeOS style symbol resolution and made it the default. A symbol undefined in an image is only searched in its direct dependencies. Fixes bug #889 (BeOS apps crashing under Haiku when opening a file panel). Modified: haiku/trunk/src/system/runtime_loader/Jamfile =================================================================== --- haiku/trunk/src/system/runtime_loader/Jamfile 2007-06-01 17:32:55 UTC (rev 21289) +++ haiku/trunk/src/system/runtime_loader/Jamfile 2007-06-01 18:09:32 UTC (rev 21290) @@ -8,6 +8,9 @@ SubDirCcFlags -fno-builtin ; SubDirC++Flags -fno-builtin -fno-exceptions ; +# default to BeOS style symbol resolution +DEFINES += BEOS_STYLE_SYMBOLS_RESOLUTION ; + # needed for "runtime_loader" only StaticLibrary libruntime_loader.a : kernel_vsprintf.c Modified: haiku/trunk/src/system/runtime_loader/arch/ppc/arch_relocate.c =================================================================== --- haiku/trunk/src/system/runtime_loader/arch/ppc/arch_relocate.c 2007-06-01 17:32:55 UTC (rev 21289) +++ haiku/trunk/src/system/runtime_loader/arch/ppc/arch_relocate.c 2007-06-01 18:09:32 UTC (rev 21290) @@ -21,7 +21,8 @@ static int -relocate_rel(image_t *image, struct Elf32_Rel *rel, int rel_len) +relocate_rel(image_t *rootImage, image_t *image, struct Elf32_Rel *rel, + int rel_len) { // ToDo: implement me! @@ -30,19 +31,20 @@ status_t -arch_relocate_image(image_t *image) +arch_relocate_image(image_t *rootImage, image_t *image) { status_t status = B_NO_ERROR; // deal with the rels first if (image->rel) { - status = relocate_rel(image, image->rel, image->rel_len); + status = relocate_rel(rootImage, image, image->rel, image->rel_len); if (status < B_OK) return status; } if (image->pltrel) { - status = relocate_rel(image, image->pltrel, image->pltrel_len); + status = relocate_rel(rootImage, image, image->pltrel, + image->pltrel_len); if (status < B_OK) return status; } Modified: haiku/trunk/src/system/runtime_loader/arch/x86/arch_relocate.c =================================================================== --- haiku/trunk/src/system/runtime_loader/arch/x86/arch_relocate.c 2007-06-01 17:32:55 UTC (rev 21289) +++ haiku/trunk/src/system/runtime_loader/arch/x86/arch_relocate.c 2007-06-01 18:09:32 UTC (rev 21290) @@ -26,7 +26,8 @@ static int -relocate_rel(image_t *image, struct Elf32_Rel *rel, int rel_len) +relocate_rel(image_t *rootImage, image_t *image, struct Elf32_Rel *rel, + int rel_len) { int i; addr_t S; @@ -50,7 +51,7 @@ status_t status; sym = SYMBOL(image, ELF32_R_SYM(rel[i].r_info)); - status = resolve_symbol(image, sym, &S); + status = resolve_symbol(rootImage, image, sym, &S); if (status < B_OK) { TRACE(("resolve symbol \"%s\" returned: %ld\n", SYMNAME(image, sym), status)); @@ -114,19 +115,20 @@ status_t -arch_relocate_image(image_t *image) +arch_relocate_image(image_t *rootImage, image_t *image) { status_t status; // deal with the rels first if (image->rel) { - status = relocate_rel(image, image->rel, image->rel_len); + status = relocate_rel(rootImage, image, image->rel, image->rel_len); if (status < B_OK) return status; } if (image->pltrel) { - status = relocate_rel(image, image->pltrel, image->pltrel_len); + status = relocate_rel(rootImage, image, image->pltrel, + image->pltrel_len); if (status < B_OK) return status; } Modified: haiku/trunk/src/system/runtime_loader/elf.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.cpp 2007-06-01 17:32:55 UTC (rev 21289) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2007-06-01 18:09:32 UTC (rev 21290) @@ -55,7 +55,10 @@ RFLAG_RELOCATED = 0x1000, RFLAG_PROTECTED = 0x2000, RFLAG_DEPENDENCIES_LOADED = 0x4000, - RFLAG_REMAPPED = 0x8000 + RFLAG_REMAPPED = 0x8000, + + RFLAG_VISITED = 0x10000 + // temporarily set in the symbol resolution code }; @@ -70,11 +73,16 @@ typedef void (*init_term_function)(image_id); static image_queue_t sLoadedImages = {0, 0}; -static image_queue_t sLoadingImages = {0, 0}; static image_queue_t sDisposableImages = {0, 0}; static uint32 sLoadedImageCount = 0; static image_t *sProgramImage; +#ifdef BEOS_STYLE_SYMBOLS_RESOLUTION +static bool sResolveSymbolsBeOSStyle = true; +#else +static bool sResolveSymbolsBeOSStyle = false; +#endif + // a recursive lock static sem_id rld_sem; static thread_id rld_sem_owner; @@ -198,13 +206,7 @@ find_image(char const *name, uint32 typeMask) { bool isPath = (strchr(name, '/') != NULL); - image_t *image; - - image = find_image_in_queue(&sLoadedImages, name, isPath, typeMask); - if (image == NULL) - image = find_image_in_queue(&sLoadingImages, name, isPath, typeMask); - - return image; + return find_image_in_queue(&sLoadedImages, name, isPath, typeMask); } @@ -729,30 +731,98 @@ } -static struct Elf32_Sym * -find_symbol_in_loaded_images(image_t **_image, const char *name) +static struct Elf32_Sym* +find_symbol_recursively_impl(image_t* image, const char* name, + image_t** foundInImage) { - image_t *image; + image->flags |= RFLAG_VISITED; - for (image = sLoadedImages.head; image; image = image->next) { - struct Elf32_Sym *symbol; + struct Elf32_Sym *symbol; - if (image->dynamic_ptr == NULL) - continue; - + // look up the symbol in this image + if (image->dynamic_ptr) { symbol = find_symbol(image, name, B_SYMBOL_TYPE_ANY); if (symbol) { - *_image = image; + *foundInImage = image; return symbol; } } + // recursively search dependencies + for (uint32 i = 0; i < image->num_needed; i++) { + if (!(image->needed[i]->flags & RFLAG_VISITED)) { + symbol = find_symbol_recursively_impl(image->needed[i], name, + foundInImage); + if (symbol) + return symbol; + } + } + return NULL; } +static void +clear_image_flag_recursively(image_t* image, uint32 flag) +{ + image->flags &= ~flag; + + for (uint32 i = 0; i < image->num_needed; i++) { + if (image->needed[i]->flags & flag) + clear_image_flag_recursively(image->needed[i], flag); + } +} + + +static struct Elf32_Sym* +find_symbol_recursively(image_t* image, const char* name, + image_t** foundInImage) +{ + struct Elf32_Sym* symbol = find_symbol_recursively_impl(image, name, + foundInImage); + clear_image_flag_recursively(image, RFLAG_VISITED); + return symbol; +} + + +static struct Elf32_Sym* +find_symbol_in_loaded_images(const char* name, image_t** foundInImage) +{ + return find_symbol_recursively(sLoadedImages.head, name, foundInImage); +} + + +static struct Elf32_Sym* +find_undefined_symbol(image_t* rootImage, image_t* image, const char* name, + image_t** foundInImage) +{ + // If not simulating BeOS style symbol resolution, undefined symbols are + // search recursively starting from the root image. (Note, breadth first + // might be better than the depth first use here.) + if (!sResolveSymbolsBeOSStyle) + return find_symbol_recursively(rootImage, name, foundInImage); + + // BeOS style symbol resolution: It is sufficient to check the direct + // dependencies. The linker would have complained, if the symbol wasn't + // there. + for (uint32 i = 0; i < image->num_needed; i++) { + if (image->needed[i]->dynamic_ptr) { + struct Elf32_Sym *symbol = find_symbol(image->needed[i], name, + B_SYMBOL_TYPE_ANY); + if (symbol) { + *foundInImage = image->needed[i]; + return symbol; + } + } + } + + return NULL; +} + + int -resolve_symbol(image_t *image, struct Elf32_Sym *sym, addr_t *sym_addr) +resolve_symbol(image_t *rootImage, image_t *image, struct Elf32_Sym *sym, + addr_t *sym_addr) { struct Elf32_Sym *sym2; char *symname; @@ -763,8 +833,8 @@ // patch the symbol name symname = SYMNAME(image, sym); - // it's undefined, must be outside this image, try the other image - sym2 = find_symbol_in_loaded_images(&shimg, symname); + // it's undefined, must be outside this image, try the other images + sym2 = find_undefined_symbol(rootImage, image, symname, &shimg); if (!sym2) { printf("elf_resolve_symbol: could not resolve symbol '%s'\n", symname); return B_MISSING_SYMBOL; @@ -835,11 +905,11 @@ static status_t -relocate_image(image_t *image) +relocate_image(image_t *rootImage, image_t *image) { - status_t status = arch_relocate_image(image); + status_t status = arch_relocate_image(rootImage, image); if (status < B_OK) { - FATAL("troubles relocating: 0x%lx\n", status); + FATAL("troubles relocating: 0x%lx (image: %s)\n", status, image->name); return status; } @@ -1124,7 +1194,7 @@ return count; for (i = 0; i < count; i++) { - status_t status = relocate_image(list[i]); + status_t status = relocate_image(image, list[i]); if (status < B_OK) return status; } @@ -1219,7 +1289,8 @@ // We patch any exported __gRuntimeLoader symbols to point to our private API { - struct Elf32_Sym *symbol = find_symbol_in_loaded_images(&image, "__gRuntimeLoader"); + struct Elf32_Sym *symbol = find_symbol_in_loaded_images( + "__gRuntimeLoader", &image); if (symbol != NULL) { void **_export = (void **)(symbol->st_value + image->regions[0].delta); *_export = &gRuntimeLoader; @@ -1233,7 +1304,8 @@ // Since the images are initialized now, we no longer should use our // getenv(), but use the one from libroot.so { - struct Elf32_Sym *symbol = find_symbol_in_loaded_images(&image, "getenv"); + struct Elf32_Sym *symbol = find_symbol_in_loaded_images("getenv", + &image); if (symbol != NULL) gGetEnv = (char* (*)(const char*)) (symbol->st_value + image->regions[0].delta); Modified: haiku/trunk/src/system/runtime_loader/runtime_loader_private.h =================================================================== --- haiku/trunk/src/system/runtime_loader/runtime_loader_private.h 2007-06-01 17:32:55 UTC (rev 21289) +++ haiku/trunk/src/system/runtime_loader/runtime_loader_private.h 2007-06-01 18:09:32 UTC (rev 21290) @@ -24,18 +24,21 @@ int runtime_loader(void *arg); int open_executable(char *name, image_type type, const char *rpath); -status_t test_executable(const char *path, uid_t user, gid_t group, char *starter); +status_t test_executable(const char *path, uid_t user, gid_t group, + char *starter); void terminate_program(void); image_id load_program(char const *path, void **entry); status_t unload_library(image_id imageID, bool addOn); image_id load_library(char const *path, uint32 flags, bool addOn); -status_t get_nth_symbol(image_id imageID, int32 num, char *nameBuffer, int32 *_nameLength, - int32 *_type, void **_location); +status_t get_nth_symbol(image_id imageID, int32 num, char *nameBuffer, + int32 *_nameLength, int32 *_type, void **_location); status_t get_symbol(image_id imageID, char const *symbolName, int32 symbolType, void **_location); -status_t get_next_image_dependency(image_id id, uint32 *cookie, const char **_name); -int resolve_symbol(image_t *image, struct Elf32_Sym *sym, addr_t *sym_addr); +status_t get_next_image_dependency(image_id id, uint32 *cookie, + const char **_name); +int resolve_symbol(image_t *rootImage, image_t *image, struct Elf32_Sym *sym, + addr_t *sym_addr); status_t elf_verify_header(void *header, int32 length); @@ -45,7 +48,7 @@ status_t heap_init(void); // arch dependent prototypes -status_t arch_relocate_image(image_t *image); +status_t arch_relocate_image(image_t *rootImage, image_t *image); #ifdef __cplusplus } From stippi at mail.berlios.de Fri Jun 1 23:32:50 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 1 Jun 2007 23:32:50 +0200 Subject: [Haiku-commits] r21291 - haiku/trunk/src/data/beos_mime/application Message-ID: <200706012132.l51LWoPS014184@sheep.berlios.de> Author: stippi Date: 2007-06-01 23:32:50 +0200 (Fri, 01 Jun 2007) New Revision: 21291 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21291&view=rev Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be-bookmark haiku/trunk/src/data/beos_mime/application/x-vnd.be-volume Log: * added bookmark and volume mimetimes, don't know about bookmark, but I think it should be reused by whatever browser we end up with Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be-bookmark =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be-bookmark 2007-06-01 18:09:32 UTC (rev 21290) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be-bookmark 2007-06-01 21:32:50 UTC (rev 21291) @@ -0,0 +1,55 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be-bookmark"; + +resource(2, "META:S:DESC") #'MSDC' "Bookmark"; + +resource(3, "META:L:DESC") #'MLDC' "Bookmark for a web page"; + +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Be-NPOS"; + +resource(5, "META:ICON") #'VICN' array { + $"6E63696608010100006B02001602BA6666BB33323B3332BA6666480CCD4BD333" + $"00D8FFEC0200160439D755BC0F313C0F3139D7554AE7974ABAE901FA1C8C7934" + $"FFC202001603378CEDB9CE9739CE97378CED4AADF149868800B684FAFFD20200" + $"16033772A3B9729F39729F3772A349C4734AAF6E01CCD9FAFFC8020016023B64" + $"5ABDAC373C450A3A18A04957524B6E2E007DFFBB03010000020006033AE5823A" + $"E582BAE5823AE5824A7B444AA80500FF06067FFF7575FF7E03030E0A06224B22" + $"503E5E5A425A3D3E340605E7035A3D57405A3D423E5E3E583E5843534CC3EF47" + $"4B4E460A043E5E2250224B3E580605FE02224B3E583E5843534CC3EF474B4E46" + $"5A3D57405A3D3E340604EB323C323C32323B2E57354C4A4C3C4C4A02043E533E" + $"5342514C4A444A4C4A303E303E2A3E2246264422460A0434C91D3E5D44C8B73E" + $"5C0A0439C91D3E5BC059C8B73EC9E90A03224F26C653224E0A03224D2950224C" + $"0A035A42C7EBC2575ABFF30A035A40C8B7435A3F0609FEF303303D303A303A34" + $"BE2C4B45C269C0E04F47504C4F49514F5553C717C6E35553525257525750564D" + $"504E524C4EC418C379C4D9C404C418C379060BA2680B3E60434E545258545854" + $"54504E6042604A60425C403E0A0A00010D000A06030005041001178400040A05" + $"0101000A010102000A020103000A030104000A040105000A0606060708090A0B" + $"000A06010C1001178422040A07010C00" +}; + +resource(6, "META:ATTR_INFO") message(233) { + "attr:name" = "META:url", + "attr:name" = "META:keyw", + "attr:name" = "META:title", + "attr:public_name" = "URL", + "attr:public_name" = "Keywords", + "attr:public_name" = "Title", + "attr:type" = 'CSTR', + "attr:type" = 'CSTR', + "attr:type" = 'CSTR', + "attr:viewable" = true, + "attr:viewable" = true, + "attr:viewable" = true, + "attr:editable" = true, + "attr:editable" = true, + "attr:editable" = true, + "attr:width" = 170, + "attr:width" = 130, + "attr:width" = 130, + "attr:alignment" = 0, + "attr:alignment" = 0, + "attr:alignment" = 0, + "type" = "application/x-vnd.Be-bookmark" +}; Added: haiku/trunk/src/data/beos_mime/application/x-vnd.be-volume =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-vnd.be-volume 2007-06-01 18:09:32 UTC (rev 21290) +++ haiku/trunk/src/data/beos_mime/application/x-vnd.be-volume 2007-06-01 21:32:50 UTC (rev 21291) @@ -0,0 +1,27 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-vnd.Be-volume"; + +resource(2, "META:S:DESC") #'MSDC' "Volume"; + +resource(3, "META:L:DESC") #'MLDC' "Container for file systems"; + +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Be-TRAK"; + +resource(5, "META:ICON") #'VICN' array { + $"6E636966080500040054020006023B019B3AA235BC243E3C71D248D17C498491" + $"00E7BB8FFFC99867020006023BA71138D0C8BBF4B83E90E64AED7C485BD7008A" + $"561DFFB57A3A02000602BB6FCBB8D4C839AA71BC3992492FF148D96A00FFC790" + $"FFFFF4EA0366330003FFDFC003AD7238110A0626543A464C455C4B4C603E600A" + $"063822262E264F3C5A4E484E2A0A04262E264F3C5A3C370A043C373C5A4E484E" + $"2A0A043822262E3C374E2A0A042832284E3A573A390A042A4D2B4638492A430A" + $"042A4D365238492B460A042A4D3854384936520A042E4CBB2BC5D3BB2BC5072E" + $"4A0A042C49344D344B2C470A042A352A402B38383B0A0436442A403846383B0A" + $"042B382A403644383B0A042EBE672EBF33BB2DC03FBB2DBF730A042CBD292CBD" + $"F5343F343D08022A4E2A540E0A010100000A0001101001178420040A00011030" + $"302901178420040A00011030401B01178420040A0001011001178400040A0201" + $"02000A030103000A040104000A050105000A06020B06000A0202070D000A0702" + $"0C08000A0302090E0815FF0A00020A0F0815FF" +}; + From stippi at mail.berlios.de Sat Jun 2 13:05:57 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 2 Jun 2007 13:05:57 +0200 Subject: [Haiku-commits] r21292 - haiku/trunk/src/data/beos_mime Message-ID: <200706021105.l52B5vUn010445@sheep.berlios.de> Author: stippi Date: 2007-06-02 13:05:57 +0200 (Sat, 02 Jun 2007) New Revision: 21292 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21292&view=rev Modified: haiku/trunk/src/data/beos_mime/video.super Log: * new video icon, based very much on icon submitted by zuMi Modified: haiku/trunk/src/data/beos_mime/video.super =================================================================== --- haiku/trunk/src/data/beos_mime/video.super 2007-06-01 21:32:50 UTC (rev 21291) +++ haiku/trunk/src/data/beos_mime/video.super 2007-06-02 11:05:57 UTC (rev 21292) @@ -3,4 +3,40 @@ resource(1, "META:TYPE") "video"; -resource(2, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; +resource(2, "META:L:DESC") #'MLDC' "generic video"; + +resource(3, "META:S:DESC") #'MSDC' "generic video"; + +resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-MediaPlayer"; + +resource(5, "META:EXTENS") message(234) { + "type" = "video" +}; + +resource(6, "META:ATTR_INFO") message(233) { + "attr:name" = "Video:Length", + "attr:public_name" = "Playing time", + "attr:type" = 'CSTR', + "attr:viewable" = true, + "attr:editable" = false, + "attr:width" = 60, + "attr:alignment" = 1, + "type" = "video" +}; + +resource(7, "META:ICON") #'VICN' array { + $"6E6369660C0101000071030100000200160239C5F13B86F2BB86F239C5F1499A" + $"C14A45730068FF3902001602B85859B7883F39A018BA682E4AA6084B52570050" + $"FF2202001602390BC63BB2DEBBB2DE390BC64A859F4931CF00AEFF7C02001602" + $"3AF2583AB47CBAB47C3AF2584A284449764A008EFF5A020006033BEF0C333F0F" + $"B34BED3BFEA44A075648AA36003C3B3B44737373FF3A3A3A0301000002001602" + $"3AC1E83AE5CDBAE5CD3AC1E84A947C48F61200FFFFE805090582057C0A0A0546" + $"5A4B5A6044584046400A06223E352E5A3C5A44465822460A04464E46585A445A" + $"3C0A0446582246223E464E0A04B4B0BE33352E5A3CC316C4790A04223EB4B0BE" + $"33C316C479464E0206474449454543303A323B2E3930352E3732333733353239" + $"344F3C4D3B513D5042533F4D450A04C0CBC04C353CBE34BBB74ABDB50805243C" + $"494CC3EFC3EFC3EFC521475802043736BCD236BB8136343834BC1F34BD00373A" + $"BB813ABCD23A3A383ABD003ABC1F0C0A000100000A0101011001178400040A02" + $"0103000A030102000A040104000A050105000A0701061001178200040A060106" + $"000A0A0109000A0B01092031B5F00A080107000A0901081815FF0117810004" +}; From marcusoverhagen at mail.berlios.de Sat Jun 2 18:49:49 2007 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 2 Jun 2007 18:49:49 +0200 Subject: [Haiku-commits] r21294 - haiku/trunk/src/add-ons/media/media-add-ons/dvb Message-ID: <200706021649.l52Gnn84003243@sheep.berlios.de> Author: marcusoverhagen Date: 2007-06-02 18:49:37 +0200 (Sat, 02 Jun 2007) New Revision: 21294 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21294&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/dvb/MediaStreamDecoder.cpp Log: put InitCheck back Modified: haiku/trunk/src/add-ons/media/media-add-ons/dvb/MediaStreamDecoder.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/dvb/MediaStreamDecoder.cpp 2007-06-02 11:17:38 UTC (rev 21293) +++ haiku/trunk/src/add-ons/media/media-add-ons/dvb/MediaStreamDecoder.cpp 2007-06-02 16:49:37 UTC (rev 21294) @@ -11,10 +11,9 @@ status_t MediaStreamDecoder::SetInputFormat(const media_format &in_format) { -// XXX broken in Haiku... -// status_t err = BMediaDecoder::InitCheck(); -// if (err) -// return err; + status_t err = BMediaDecoder::InitCheck(); + if (err) + return err; return BMediaDecoder::SetTo(&in_format); } @@ -23,10 +22,9 @@ status_t MediaStreamDecoder::SetOutputFormat(media_format *output_format) { -// XXX broken in Haiku... -// status_t err = BMediaDecoder::InitCheck(); -// if (err) -// return err; + status_t err = BMediaDecoder::InitCheck(); + if (err) + return err; return BMediaDecoder::SetOutputFormat(output_format); } From stippi at mail.berlios.de Sat Jun 2 20:35:30 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 2 Jun 2007 20:35:30 +0200 Subject: [Haiku-commits] r21295 - in haiku/trunk/src/apps/icon-o-matic: . document document/savers import_export/message Message-ID: <200706021835.l52IZUjW024166@sheep.berlios.de> Author: stippi Date: 2007-06-02 20:35:29 +0200 (Sat, 02 Jun 2007) New Revision: 21295 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21295&view=rev Added: haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp haiku/trunk/src/apps/icon-o-matic/document/Defines.h Modified: haiku/trunk/src/apps/icon-o-matic/IconEditorApp.cpp haiku/trunk/src/apps/icon-o-matic/IconEditorApp.h haiku/trunk/src/apps/icon-o-matic/Jamfile haiku/trunk/src/apps/icon-o-matic/document/savers/NativeSaver.cpp haiku/trunk/src/apps/icon-o-matic/document/savers/NativeSaver.h haiku/trunk/src/apps/icon-o-matic/document/savers/SimpleFileSaver.cpp haiku/trunk/src/apps/icon-o-matic/document/savers/SimpleFileSaver.h haiku/trunk/src/apps/icon-o-matic/import_export/message/MessageExporter.cpp haiku/trunk/src/apps/icon-o-matic/import_export/message/MessageImporter.cpp Log: * Icon-O-Matic prepends a magic number when writing native files, this way we can associate these native files with Icon-O-Matic (they also get their own mime type) Modified: haiku/trunk/src/apps/icon-o-matic/IconEditorApp.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/IconEditorApp.cpp 2007-06-02 16:49:37 UTC (rev 21294) +++ haiku/trunk/src/apps/icon-o-matic/IconEditorApp.cpp 2007-06-02 18:35:29 UTC (rev 21295) @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include "support_settings.h" @@ -26,6 +28,7 @@ #include "BitmapExporter.h" #include "BitmapSetSaver.h" #include "CommandStack.h" +#include "Defines.h" #include "Document.h" #include "FlatIconExporter.h" #include "FlatIconFormat.h" @@ -46,9 +49,11 @@ using std::nothrow; +static const char* kAppSig = "application/x-vnd.haiku-icon_o_matic"; + // constructor IconEditorApp::IconEditorApp() - : BApplication("application/x-vnd.haiku-icon_o_matic"), + : BApplication(kAppSig), fMainWindow(NULL), fDocument(new Document("test")), @@ -227,6 +232,8 @@ _RestoreSettings(); fMainWindow->Show(); + + _InstallDocumentMimeType(); } // RefsReceived @@ -571,3 +578,80 @@ fMainWindow->RestoreSettings(&settings); } +// _InstallDocumentMimeType +void +IconEditorApp::_InstallDocumentMimeType() +{ + // install mime type of documents + BMimeType mime(kNativeIconMimeType); + status_t ret = mime.InitCheck(); + if (ret < B_OK) { + fprintf(stderr, "Could not init native document mime type (%s): %s.\n", + kNativeIconMimeType, strerror(ret)); + return; + } + + if (mime.IsInstalled() && !(modifiers() & B_SHIFT_KEY)) { + // mime is already installed, and the user is not + // pressing the shift key to force a re-install + return; + } + + ret = mime.Install(); + if (ret < B_OK) { + fprintf(stderr, "Could not install native document mime type (%s): %s.\n", + kNativeIconMimeType, strerror(ret)); + return; + } + // set preferred app + ret = mime.SetPreferredApp(kAppSig); + if (ret < B_OK) + fprintf(stderr, "Could not set native document preferred app: %s\n", + strerror(ret)); + + // set descriptions + ret = mime.SetShortDescription("Haiku Icon"); + if (ret < B_OK) + fprintf(stderr, "Could not set short description of mime type: %s\n", + strerror(ret)); + ret = mime.SetLongDescription("Native Haiku vector icon"); + if (ret < B_OK) + fprintf(stderr, "Could not set long description of mime type: %s\n", + strerror(ret)); + + // set extensions + BMessage message('extn'); + message.AddString("extensions", "icon"); + ret = mime.SetFileExtensions(&message); + if (ret < B_OK) + fprintf(stderr, "Could not set extensions of mime type: %s\n", + strerror(ret)); + + // set sniffer rule + const char* snifferRule = "0.9 ('GSMI')"; + ret = mime.SetSnifferRule(snifferRule); + if (ret < B_OK) { + BString parseError; + BMimeType::CheckSnifferRule(snifferRule, &parseError); + fprintf(stderr, "Could not set sniffer rule of mime type: %s\n", + parseError.String()); + } + +// NOTE: Icon-O-Matic writes the icon being saved as icon of the file anyways +// therefor, the following code is not needed, it is also not tested and I am +// spotting an error with SetIcon() +// // set document icon +// BResources* resources = AppResources(); +// // does not need to be freed (belongs to BApplication base) +// if (resources) { +// size_t size; +// const void* iconData = resources->LoadResource('VICN', "IOM:DOC_ICON", &size); +// if (iconData && size > 0) { +// memcpy(largeIcon.Bits(), iconData, size); +// if (mime.SetIcon(&largeIcon, B_LARGE_ICON) < B_OK) +// fprintf(stderr, "Could not set large icon of mime type.\n"); +// } else +// fprintf(stderr, "Could not find icon in app resources (data: %p, size: %ld).\n", iconData, size); +// } else +// fprintf(stderr, "Could not find app resources.\n"); +} Modified: haiku/trunk/src/apps/icon-o-matic/IconEditorApp.h =================================================================== --- haiku/trunk/src/apps/icon-o-matic/IconEditorApp.h 2007-06-02 16:49:37 UTC (rev 21294) +++ haiku/trunk/src/apps/icon-o-matic/IconEditorApp.h 2007-06-02 18:35:29 UTC (rev 21295) @@ -78,6 +78,7 @@ void _StoreSettings(); void _RestoreSettings(); + void _InstallDocumentMimeType(); MainWindow* fMainWindow; Document* fDocument; Modified: haiku/trunk/src/apps/icon-o-matic/Jamfile =================================================================== --- haiku/trunk/src/apps/icon-o-matic/Jamfile 2007-06-02 16:49:37 UTC (rev 21294) +++ haiku/trunk/src/apps/icon-o-matic/Jamfile 2007-06-02 18:35:29 UTC (rev 21295) @@ -106,6 +106,7 @@ ######## Icon-O-Matic ######## # document + Defines.cpp Document.cpp IconObject.cpp SetPropertiesCommand.cpp Added: haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp 2007-06-02 16:49:37 UTC (rev 21294) +++ haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp 2007-06-02 18:35:29 UTC (rev 21295) @@ -0,0 +1,13 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ +#include "Defines.h" + +const uint32 kNativeIconMagicNumber = 'GSMI'; +const char* kNativeIconMimeType = "application/x-vnd.Haiku-icon"; + + Added: haiku/trunk/src/apps/icon-o-matic/document/Defines.h =================================================================== --- haiku/trunk/src/apps/icon-o-matic/document/Defines.h 2007-06-02 16:49:37 UTC (rev 21294) +++ haiku/trunk/src/apps/icon-o-matic/document/Defines.h 2007-06-02 18:35:29 UTC (rev 21295) @@ -0,0 +1,14 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ +#ifndef DEFINES_H +#define DEFINES_H + +extern const uint32 kNativeIconMagicNumber; +extern const char* kNativeIconMimeType; + +#endif // DEFINES_H Modified: haiku/trunk/src/apps/icon-o-matic/document/savers/NativeSaver.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/document/savers/NativeSaver.cpp 2007-06-02 16:49:37 UTC (rev 21294) +++ haiku/trunk/src/apps/icon-o-matic/document/savers/NativeSaver.cpp 2007-06-02 18:35:29 UTC (rev 21295) @@ -5,7 +5,6 @@ * Authors: * Stephan A?mus */ - #include "NativeSaver.h" #include "FlatIconFormat.h" Modified: haiku/trunk/src/apps/icon-o-matic/document/savers/NativeSaver.h =================================================================== --- haiku/trunk/src/apps/icon-o-matic/document/savers/NativeSaver.h 2007-06-02 16:49:37 UTC (rev 21294) +++ haiku/trunk/src/apps/icon-o-matic/document/savers/NativeSaver.h 2007-06-02 18:35:29 UTC (rev 21295) @@ -5,7 +5,6 @@ * Authors: * Stephan A?mus */ - #ifndef NATIVE_SAVER_H #define NATIVE_SAVER_H Modified: haiku/trunk/src/apps/icon-o-matic/document/savers/SimpleFileSaver.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/document/savers/SimpleFileSaver.cpp 2007-06-02 16:49:37 UTC (rev 21294) +++ haiku/trunk/src/apps/icon-o-matic/document/savers/SimpleFileSaver.cpp 2007-06-02 18:35:29 UTC (rev 21295) @@ -1,11 +1,10 @@ /* - * Copyright 2006, Haiku. All rights reserved. + * Copyright 2006-2007, Haiku. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Stephan A?mus */ - #include "SimpleFileSaver.h" #include "Exporter.h" Modified: haiku/trunk/src/apps/icon-o-matic/document/savers/SimpleFileSaver.h =================================================================== --- haiku/trunk/src/apps/icon-o-matic/document/savers/SimpleFileSaver.h 2007-06-02 16:49:37 UTC (rev 21294) +++ haiku/trunk/src/apps/icon-o-matic/document/savers/SimpleFileSaver.h 2007-06-02 18:35:29 UTC (rev 21295) @@ -1,11 +1,10 @@ /* - * Copyright 2006, Haiku. All rights reserved. + * Copyright 2006-2007, Haiku. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Stephan A?mus */ - #ifndef SIMPLE_FILE_SAVER_H #define SIMPLE_FILE_SAVER_H Modified: haiku/trunk/src/apps/icon-o-matic/import_export/message/MessageExporter.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/import_export/message/MessageExporter.cpp 2007-06-02 16:49:37 UTC (rev 21294) +++ haiku/trunk/src/apps/icon-o-matic/import_export/message/MessageExporter.cpp 2007-06-02 18:35:29 UTC (rev 21295) @@ -8,10 +8,12 @@ #include "MessageExporter.h" +#include #include #include #include +#include "Defines.h" #include "Icon.h" #include "PathContainer.h" #include "Shape.h" @@ -98,6 +100,20 @@ ret = archive.AddMessage("shapes", &allShapes); } + // prepend the magic number to the file which + // later tells us that this file is one of us + if (ret == B_OK) { + ssize_t size = sizeof(uint32); + uint32 magic = B_HOST_TO_LENDIAN_INT32(kNativeIconMagicNumber); + ssize_t written = stream->Write(&magic, size); + if (written != size) { + if (written < 0) + ret = (status_t)written; + else + ret = B_IO_ERROR; + } + } + if (ret == B_OK) ret = archive.Flatten(stream); @@ -108,8 +124,7 @@ const char* MessageExporter::MIMEType() { - // TODO: come up with a MIME type - return NULL; + return kNativeIconMimeType; } // #pragma mark - Modified: haiku/trunk/src/apps/icon-o-matic/import_export/message/MessageImporter.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/import_export/message/MessageImporter.cpp 2007-06-02 16:49:37 UTC (rev 21294) +++ haiku/trunk/src/apps/icon-o-matic/import_export/message/MessageImporter.cpp 2007-06-02 18:35:29 UTC (rev 21295) @@ -1,20 +1,21 @@ /* - * Copyright 2006, Haiku. All rights reserved. + * Copyright 2006-2007, Haiku. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Stephan A?mus */ - #include "MessageImporter.h" #include #include #include +#include #include #include +#include "Defines.h" #include "Icon.h" #include "PathContainer.h" #include "Shape.h" @@ -46,6 +47,28 @@ return ret; } + uint32 magic = 0; + ssize_t size = sizeof(magic); + off_t position = stream->Position(); + ssize_t read = stream->Read(&magic, size); + if (read != size) { + if (read < 0) + ret = (status_t)read; + else + ret = B_IO_ERROR; + return ret; + } + + if (B_LENDIAN_TO_HOST_INT32(magic) != kNativeIconMagicNumber) { + // this might be an old native icon file, where + // we didn't prepend the magic number yet, seek back + if (stream->Seek(position, SEEK_SET) != position) { + printf("MessageImporter::Import() - " + "failed to seek back to beginning of stream\n"); + return B_IO_ERROR; + } + } + BMessage archive; ret = archive.Unflatten(stream); if (ret < B_OK) { From marcusoverhagen at mail.berlios.de Sat Jun 2 22:00:48 2007 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 2 Jun 2007 22:00:48 +0200 Subject: [Haiku-commits] r21296 - in haiku/trunk: headers/os/media headers/private/media src/kits/media Message-ID: <200706022000.l52K0mWL029580@sheep.berlios.de> Author: marcusoverhagen Date: 2007-06-02 22:00:48 +0200 (Sat, 02 Jun 2007) New Revision: 21296 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21296&view=rev Modified: haiku/trunk/headers/os/media/MediaDecoder.h haiku/trunk/headers/private/media/DecoderPlugin.h haiku/trunk/headers/private/media/PluginManager.h haiku/trunk/src/kits/media/DecoderPlugin.cpp haiku/trunk/src/kits/media/MediaDecoder.cpp haiku/trunk/src/kits/media/MediaExtractor.cpp haiku/trunk/src/kits/media/MediaTrack.cpp haiku/trunk/src/kits/media/PluginManager.cpp Log: Moved creating and destroying of Reader and Decoder plugins into the PluginManager class. Removed deferred initialization from BMediaDecoder. Modified: haiku/trunk/headers/os/media/MediaDecoder.h =================================================================== --- haiku/trunk/headers/os/media/MediaDecoder.h 2007-06-02 18:35:29 UTC (rev 21295) +++ haiku/trunk/headers/os/media/MediaDecoder.h 2007-06-02 20:00:48 UTC (rev 21296) @@ -48,19 +48,11 @@ status_t AttachToDecoder(); BPrivate::media::Decoder *fDecoder; - int32 fDecoderID; - BPrivate::media::DecoderPlugin *fDecoderPlugin; - int32 fDecoderPluginID; status_t fInitStatus; - bool fNeedsInit; - media_format * fInitFormat; - char * fInitInfo; - size_t fInitInfoSize; - /* fbc data and virtuals */ - uint32 _reserved_BMediaDecoder_[26]; + uint32 _reserved_BMediaDecoder_[33]; virtual status_t _Reserved_BMediaDecoder_0(int32 arg, ...); virtual status_t _Reserved_BMediaDecoder_1(int32 arg, ...); @@ -93,8 +85,8 @@ protected: virtual status_t GetNextChunk(const void **chunkData, size_t *chunkLen, media_header *mh); - const void *buffer; - int32 buffer_size; + const void *fBuffer; + int32 fBufferSize; }; #endif Modified: haiku/trunk/headers/private/media/DecoderPlugin.h =================================================================== --- haiku/trunk/headers/private/media/DecoderPlugin.h 2007-06-02 18:35:29 UTC (rev 21295) +++ haiku/trunk/headers/private/media/DecoderPlugin.h 2007-06-02 20:00:48 UTC (rev 21296) @@ -39,7 +39,7 @@ status_t GetNextChunk(const void **chunkBuffer, size_t *chunkSize, media_header *mediaHeader); - void Setup(ChunkProvider *provider); + void SetChunkProvider(ChunkProvider *provider); private: ChunkProvider * fChunkProvider; }; Modified: haiku/trunk/headers/private/media/PluginManager.h =================================================================== --- haiku/trunk/headers/private/media/PluginManager.h 2007-06-02 18:35:29 UTC (rev 21295) +++ haiku/trunk/headers/private/media/PluginManager.h 2007-06-02 20:00:48 UTC (rev 21296) @@ -6,13 +6,7 @@ #include #include -status_t _CreateReader(Reader **reader, int32 *streamCount, media_file_format *mff, BDataIO *source); -status_t _CreateDecoder(Decoder **decoder, const media_format &format); -void _DestroyReader(Reader *reader); -void _DestroyDecoder(Decoder *decoder); - - class PluginManager { public: @@ -21,6 +15,15 @@ MediaPlugin * GetPlugin(const entry_ref &ref); void PutPlugin(MediaPlugin *plugin); + + + status_t CreateReader(Reader **reader, int32 *streamCount, media_file_format *mff, BDataIO *source); + void DestroyReader(Reader *reader); + + status_t CreateDecoder(Decoder **decoder, const media_format &format); + status_t CreateDecoder(Decoder **decoder, const media_codec_info &mci); + status_t GetDecoderInfo(Decoder *decoder, media_codec_info *out_info) const; + void DestroyDecoder(Decoder *decoder); private: bool LoadPlugin(const entry_ref &ref, MediaPlugin **plugin, image_id *image); @@ -37,4 +40,6 @@ BLocker *fLocker; }; +extern PluginManager _plugin_manager; + #endif Modified: haiku/trunk/src/kits/media/DecoderPlugin.cpp =================================================================== --- haiku/trunk/src/kits/media/DecoderPlugin.cpp 2007-06-02 18:35:29 UTC (rev 21295) +++ haiku/trunk/src/kits/media/DecoderPlugin.cpp 2007-06-02 20:00:48 UTC (rev 21296) @@ -12,8 +12,8 @@ Decoder::Decoder() + : fChunkProvider(NULL) { - fChunkProvider = 0; } @@ -32,7 +32,7 @@ void -Decoder::Setup(ChunkProvider *provider) +Decoder::SetChunkProvider(ChunkProvider *provider) { delete fChunkProvider; fChunkProvider = provider; @@ -45,4 +45,3 @@ DecoderPlugin::DecoderPlugin() { } - Modified: haiku/trunk/src/kits/media/MediaDecoder.cpp =================================================================== --- haiku/trunk/src/kits/media/MediaDecoder.cpp 2007-06-02 18:35:29 UTC (rev 21295) +++ haiku/trunk/src/kits/media/MediaDecoder.cpp 2007-06-02 20:00:48 UTC (rev 21296) @@ -5,26 +5,17 @@ ***********************************************************************/ #include #include +#include #include "PluginManager.h" -#include "DataExchange.h" #include "debug.h" -extern PluginManager _plugin_manager; - /************************************************************* * public BMediaDecoder *************************************************************/ BMediaDecoder::BMediaDecoder() : fDecoder(NULL), - fDecoderID(0), - fDecoderPlugin(NULL), - fDecoderPluginID(0), - fInitStatus(B_NO_INIT), - fNeedsInit(false), - fInitFormat(NULL), - fInitInfo(NULL), - fInitInfoSize(0) + fInitStatus(B_OK) { } @@ -33,33 +24,15 @@ const void *info, size_t info_size) : fDecoder(NULL), - fDecoderID(0), - fDecoderPlugin(NULL), - fDecoderPluginID(0), - fInitStatus(B_NO_INIT), - fNeedsInit(true), - fInitFormat(new media_format(*in_format)), - fInitInfo(NULL), - fInitInfoSize(0) + fInitStatus(B_OK) { - if (info_size) { - fInitInfoSize = info_size; - fInitInfo = new char[info_size]; - memcpy(fInitInfo, info, info_size); - } + SetTo(in_format, info, info_size); } BMediaDecoder::BMediaDecoder(const media_codec_info *mci) : fDecoder(NULL), - fDecoderID(0), - fDecoderPlugin(NULL), - fDecoderPluginID(0), - fInitStatus(B_NO_INIT), - fNeedsInit(false), - fInitFormat(NULL), - fInitInfo(NULL), - fInitInfoSize(0) + fInitStatus(B_OK) { SetTo(mci); } @@ -68,108 +41,70 @@ /* virtual */ BMediaDecoder::~BMediaDecoder() { - delete fDecoder; - delete fInitFormat; - delete fInitInfo; + _plugin_manager.DestroyDecoder(fDecoder); } status_t BMediaDecoder::InitCheck() const { - if (fNeedsInit) { - // casting away const: yes this solution does suck - // it is necessary while decoders need to call GetNextChunk in Setup - const_cast(this)->SetTo(fInitFormat, fInitInfo, fInitInfoSize); - } return fInitStatus; } -static DecoderPlugin * -GetDecoderPlugin(const media_format * format) -{ - server_get_decoder_for_format_request request; - server_get_decoder_for_format_reply reply; - request.format = *format; - status_t result = QueryServer(SERVER_GET_DECODER_FOR_FORMAT, &request, sizeof(request), &reply, sizeof(reply)); - if (result != B_OK) { - printf("BMediaDecoder::SetTo: can't get decoder for format\n"); - return NULL; - } - MediaPlugin * media_plugin = _plugin_manager.GetPlugin(reply.ref); - if (!media_plugin) { - printf("BMediaDecoder::SetTo: GetPlugin failed\n"); - return NULL; - } - DecoderPlugin * plugin = dynamic_cast(media_plugin); - if (!plugin) { - printf("BMediaDecoder::SetTo: dynamic_cast failed\n"); - return NULL; - } - return plugin; -} - -// ask the server for a good decoder for the arguments -// GETS THE CODEC for in_format->type + in_format->u.x.encoding status_t BMediaDecoder::SetTo(const media_format *in_format, const void *info, size_t info_size) { - fNeedsInit = false; + _plugin_manager.DestroyDecoder(fDecoder); + fDecoder = NULL; + + status_t err = _plugin_manager.CreateDecoder(&fDecoder, *in_format); + if (err < B_OK) + goto fail; + + err = AttachToDecoder(); + if (err < B_OK) + goto fail; + + err = SetInputFormat(in_format, info, info_size); + if (err < B_OK) + goto fail; + + fInitStatus = B_OK; + return B_OK; + +fail: + _plugin_manager.DestroyDecoder(fDecoder); + fDecoder = NULL; fInitStatus = B_NO_INIT; - delete fDecoder; - DecoderPlugin * plugin = GetDecoderPlugin(in_format); - if (plugin == NULL) { - return fInitStatus = B_ERROR; - } - Decoder * decoder = plugin->NewDecoder(0); - if (decoder == NULL) { - return fInitStatus = B_ERROR; - } - fDecoder = decoder; -// fDecoderID = mci->sub_id; - if ((fInitStatus = AttachToDecoder()) != B_OK) { - return fInitStatus; - } - fInitStatus = SetInputFormat(in_format,info,info_size); - return fInitStatus; + return err; } -// ask the server for the id'th plugin -static DecoderPlugin * -GetDecoderPlugin(int32 id) -{ - if (id == 0) { - return NULL; - } - UNIMPLEMENTED(); - return NULL; -} -// ask the server for a good decoder for the arguments -// GETS THE CODEC for mci->id, mci->sub_id -// fails if the mci->id = 0 status_t BMediaDecoder::SetTo(const media_codec_info *mci) { + _plugin_manager.DestroyDecoder(fDecoder); + fDecoder = NULL; + + status_t err = _plugin_manager.CreateDecoder(&fDecoder, *mci); + if (err < B_OK) + goto fail; + + err = AttachToDecoder(); + if (err < B_OK) + goto fail; + + fInitStatus = B_OK; + return B_OK; + +fail: + _plugin_manager.DestroyDecoder(fDecoder); + fDecoder = NULL; fInitStatus = B_NO_INIT; - delete fDecoder; - DecoderPlugin * plugin = GetDecoderPlugin(mci->id); - if (plugin == NULL) { - return fInitStatus = B_ERROR; - } - Decoder * decoder = plugin->NewDecoder(0); - if (decoder == NULL) { - return fInitStatus = B_ERROR; - } - fDecoder = decoder; - fDecoderID = mci->sub_id; - if ((fInitStatus = AttachToDecoder()) != B_OK) { - return fInitStatus; - } - return fInitStatus; + return err; } @@ -186,12 +121,11 @@ const void *in_info, size_t in_size) { - if (InitCheck() != B_OK) { - return fInitStatus; - } - printf("DISCARDING FORMAT %s\n",__PRETTY_FUNCTION__); + if (!fDecoder) + return B_NO_INIT; + media_format format = *in_format; - return fDecoder->Setup(&format,in_info,in_size); + return fDecoder->Setup(&format, in_info, in_size); } @@ -204,9 +138,9 @@ status_t BMediaDecoder::SetOutputFormat(media_format *output_format) { - if (InitCheck() != B_OK) { - return fInitStatus; - } + if (!fDecoder) + return B_NO_INIT; + return fDecoder->NegotiateOutputFormat(output_format); } @@ -230,23 +164,20 @@ media_header *out_mh, media_decode_info *info) { - if (InitCheck() != B_OK) { - return fInitStatus; - } - return fDecoder->Decode(out_buffer,out_frameCount,out_mh,info); + if (!fDecoder) + return B_NO_INIT; + + return fDecoder->Decode(out_buffer, out_frameCount, out_mh, info); } status_t BMediaDecoder::GetDecoderInfo(media_codec_info *out_info) const { - if (InitCheck() != B_OK) { - return fInitStatus; - } - fDecoder->GetCodecInfo(out_info); - out_info->id = fDecoderPluginID; - out_info->sub_id = fDecoderID; - return B_OK; + if (!fDecoder) + return B_NO_INIT; + + return _plugin_manager.GetDecoderInfo(fDecoder, out_info); } @@ -279,11 +210,12 @@ media_header *mediaHeader) { return fDecoder->GetNextChunk(chunkBuffer, chunkSize, mediaHeader); } - } * provider = new MediaDecoderChunkProvider(this); - if (provider == NULL) { + } * provider = new(std::nothrow) MediaDecoderChunkProvider(this); + + if (!provider) return B_NO_MEMORY; - } - fDecoder->Setup(provider); + + fDecoder->SetChunkProvider(provider); return B_OK; } @@ -310,25 +242,25 @@ *************************************************************/ BMediaBufferDecoder::BMediaBufferDecoder() - : BMediaDecoder() + : BMediaDecoder() + , fBufferSize(0) { - buffer_size = 0; } BMediaBufferDecoder::BMediaBufferDecoder(const media_format *in_format, const void *info, size_t info_size) - : BMediaDecoder(in_format,info,info_size) + : BMediaDecoder(in_format, info, info_size) + , fBufferSize(0) { - buffer_size = 0; } BMediaBufferDecoder::BMediaBufferDecoder(const media_codec_info *mci) - : BMediaDecoder(mci) + : BMediaDecoder(mci) + , fBufferSize(0) { - buffer_size = 0; } @@ -340,9 +272,9 @@ media_header *out_mh, media_decode_info *info) { - buffer = input_buffer; - buffer_size = input_size; - return Decode(out_buffer,out_frameCount,out_mh,info); + fBuffer = input_buffer; + fBufferSize = input_size; + return Decode(out_buffer, out_frameCount, out_mh,info); } @@ -352,14 +284,15 @@ /* virtual */ status_t -BMediaBufferDecoder::GetNextChunk(const void **chunkData, size_t *chunkLen, +BMediaBufferDecoder::GetNextChunk(const void **chunkData, + size_t *chunkLen, media_header *mh) { - if (!buffer_size) { + if (!fBufferSize) return B_LAST_BUFFER_ERROR; - } - *chunkData = buffer; - *chunkLen = buffer_size; - buffer_size = 0; + + *chunkData = fBuffer; + *chunkLen = fBufferSize; + fBufferSize = 0; return B_OK; } Modified: haiku/trunk/src/kits/media/MediaExtractor.cpp =================================================================== --- haiku/trunk/src/kits/media/MediaExtractor.cpp 2007-06-02 18:35:29 UTC (rev 21295) +++ haiku/trunk/src/kits/media/MediaExtractor.cpp 2007-06-02 20:00:48 UTC (rev 21296) @@ -1,3 +1,7 @@ +/* +** Copyright 2004-2007, Marcus Overhagen. All rights reserved. +** Distributed under the terms of the MIT License. +*/ #include "MediaExtractor.h" #include "PluginManager.h" #include "ChunkCache.h" @@ -7,6 +11,7 @@ #include #include +#include // should be 0, to disable the chunk cache set it to 1 #define DISABLE_CHUNK_CACHE 0 @@ -20,10 +25,10 @@ fExtractorWaitSem = -1; fTerminateExtractor = false; - fErr = _CreateReader(&fReader, &fStreamCount, &fMff, source); + fErr = _plugin_manager.CreateReader(&fReader, &fStreamCount, &fMff, source); if (fErr) { fStreamCount = 0; - fReader = 0; + fReader = NULL; return; } @@ -93,8 +98,7 @@ delete fStreamInfo[i].chunkCache; } - if (fReader) - _DestroyReader(fReader); + _plugin_manager.DestroyReader(fReader); delete [] fStreamInfo; // fSource is owned by the BMediaFile @@ -227,10 +231,11 @@ status_t -MediaExtractor::CreateDecoder(int32 stream, Decoder **decoder, media_codec_info *mci) +MediaExtractor::CreateDecoder(int32 stream, Decoder **out_decoder, media_codec_info *mci) { CALLED(); status_t res; + Decoder *decoder; res = fStreamInfo[stream].status; if (res != B_OK) { @@ -238,23 +243,36 @@ return res; } - res = _CreateDecoder(decoder, fStreamInfo[stream].encodedFormat); + res = _plugin_manager.CreateDecoder(&decoder, fStreamInfo[stream].encodedFormat); if (res != B_OK) { - printf("MediaExtractor::CreateDecoder failed for stream %ld\n", stream); + printf("MediaExtractor::CreateDecoder _plugin_manager.CreateDecoder failed for stream %ld\n", stream); return res; } - (*decoder)->Setup(new MediaExtractorChunkProvider(this, stream)); + ChunkProvider *chunkProvider = new(std::nothrow) MediaExtractorChunkProvider(this, stream); + if (!chunkProvider) { + _plugin_manager.DestroyDecoder(decoder); + printf("MediaExtractor::CreateDecoder can't create chunk provider for stream %ld\n", stream); + return B_NO_MEMORY; + } + + decoder->SetChunkProvider(chunkProvider); - res = (*decoder)->Setup(&fStreamInfo[stream].encodedFormat, fStreamInfo[stream].infoBuffer , fStreamInfo[stream].infoBufferSize); + res = decoder->Setup(&fStreamInfo[stream].encodedFormat, fStreamInfo[stream].infoBuffer, fStreamInfo[stream].infoBufferSize); if (res != B_OK) { - printf("MediaExtractor::CreateDecoder Setup failed for stream %ld: %ld (%s)\n", - stream, res, strerror(res)); + _plugin_manager.DestroyDecoder(decoder); + printf("MediaExtractor::CreateDecoder Setup failed for stream %ld: %ld (%s)\n", stream, res, strerror(res)); return res; } - (*decoder)->GetCodecInfo(mci); + res = _plugin_manager.GetDecoderInfo(decoder, mci); + if (res != B_OK) { + _plugin_manager.DestroyDecoder(decoder); + printf("MediaExtractor::CreateDecoder GetCodecInfo failed for stream %ld: %ld (%s)\n", stream, res, strerror(res)); + return res; + } + *out_decoder = decoder; return B_OK; } Modified: haiku/trunk/src/kits/media/MediaTrack.cpp =================================================================== --- haiku/trunk/src/kits/media/MediaTrack.cpp 2007-06-02 18:35:29 UTC (rev 21295) +++ haiku/trunk/src/kits/media/MediaTrack.cpp 2007-06-02 20:00:48 UTC (rev 21296) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2004, Marcus Overhagen + * Copyright (c) 2002-2007, Marcus Overhagen * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -27,9 +27,9 @@ #include #include #include +#include #include "MediaExtractor.h" #include "PluginManager.h" -#include "ReaderPlugin.h" #include "debug.h" #define CONVERT_TO_INT32 0 // XXX test! this triggers a few bugs! @@ -71,10 +71,8 @@ BMediaTrack::~BMediaTrack() { CALLED(); - if (fRawDecoder) - _DestroyDecoder(fRawDecoder); - if (fDecoder) - _DestroyDecoder(fDecoder); + _plugin_manager.DestroyDecoder(fRawDecoder); + _plugin_manager.DestroyDecoder(fDecoder); } /************************************************************* @@ -140,10 +138,8 @@ if (!fExtractor || !fDecoder) return B_NO_INIT; - if (fRawDecoder) { - _DestroyDecoder(fRawDecoder); - fRawDecoder = 0; - } + _plugin_manager.DestroyDecoder(fRawDecoder); + fRawDecoder = 0; char s[200]; @@ -641,7 +637,8 @@ { CALLED(); fWorkaroundFlags = 0; - fRawDecoder = 0; + fDecoder = NULL; + fRawDecoder = NULL; fExtractor = extractor; fStream = stream; fErr = B_OK; @@ -712,24 +709,32 @@ { char s[200]; status_t res; + + _plugin_manager.DestroyDecoder(fRawDecoder); + fRawDecoder = NULL; string_for_format(from, s, sizeof(s)); printf("BMediaTrack::SetupFormatTranslation: from: %s\n", s); - res = _CreateDecoder(&fRawDecoder, from); + res = _plugin_manager.CreateDecoder(&fRawDecoder, from); if (res != B_OK) { - printf("BMediaTrack::SetupFormatTranslation: _CreateDecoder failed\n"); + printf("BMediaTrack::SetupFormatTranslation: CreateDecoder failed\n"); return false; } // XXX video? int buffer_size = from.u.raw_audio.buffer_size; int frame_size = (from.u.raw_audio.format & 15) * from.u.raw_audio.channel_count; + media_format notconstFrom = from; - fRawDecoder->Setup(new RawDecoderChunkProvider(fDecoder, buffer_size, frame_size)); + ChunkProvider *chunkProvider = new(std::nothrow) RawDecoderChunkProvider(fDecoder, buffer_size, frame_size); + if (!chunkProvider) { + printf("BMediaTrack::SetupFormatTranslation: can't create chunk provider\n"); + goto error; + } + fRawDecoder->SetChunkProvider(chunkProvider); - media_format from_temp = from; - res = fRawDecoder->Setup(&from_temp, 0, 0); + res = fRawDecoder->Setup(¬constFrom, 0, 0); if (res != B_OK) { printf("BMediaTrack::SetupFormatTranslation: Setup failed\n"); goto error; @@ -750,8 +755,8 @@ return true; error: - _DestroyDecoder(fRawDecoder); - fRawDecoder = 0; + _plugin_manager.DestroyDecoder(fRawDecoder); + fRawDecoder = NULL; return false; } Modified: haiku/trunk/src/kits/media/PluginManager.cpp =================================================================== --- haiku/trunk/src/kits/media/PluginManager.cpp 2007-06-02 18:35:29 UTC (rev 21295) +++ haiku/trunk/src/kits/media/PluginManager.cpp 2007-06-02 20:00:48 UTC (rev 21296) @@ -1,5 +1,5 @@ /* -** Copyright 2004, Marcus Overhagen. All rights reserved. +** Copyright 2004-2007, Marcus Overhagen. All rights reserved. ** Distributed under the terms of the OpenBeOS License. */ @@ -12,46 +12,49 @@ #include "DataExchange.h" #include "debug.h" + PluginManager _plugin_manager; status_t -_CreateReader(Reader **reader, int32 *streamCount, media_file_format *mff, BDataIO *source) +PluginManager::CreateReader(Reader **reader, int32 *streamCount, media_file_format *mff, BDataIO *source) { - TRACE("_CreateReader enter\n"); + TRACE("PluginManager::CreateReader enter\n"); BPositionIO *seekable_source = dynamic_cast(source); if (seekable_source == 0) { - printf("_CreateReader: non-seekable sources not supported yet\n"); + printf("PluginManager::CreateReader: non-seekable sources not supported yet\n"); return B_ERROR; } - // get list of available readers from, the server + // get list of available readers from the server server_get_readers_request request; server_get_readers_reply reply; if (B_OK != QueryServer(SERVER_GET_READERS, &request, sizeof(request), &reply, sizeof(reply))) { - printf("_CreateReader: can't get list of readers\n"); + printf("PluginManager::CreateReader: can't get list of readers\n"); return B_ERROR; } // try each reader by calling it's Sniff function... for (int32 i = 0; i < reply.count; i++) { entry_ref ref = reply.ref[i]; - MediaPlugin *plugin = _plugin_manager.GetPlugin(ref); + MediaPlugin *plugin = GetPlugin(ref); if (!plugin) { - printf("_CreateReader: GetPlugin failed\n"); + printf("PluginManager::CreateReader: GetPlugin failed\n"); return B_ERROR; } ReaderPlugin *readerPlugin = dynamic_cast(plugin); if (!readerPlugin) { - printf("_CreateReader: dynamic_cast failed\n"); + printf("PluginManager::CreateReader: dynamic_cast failed\n"); + PutPlugin(plugin); return B_ERROR; } *reader = readerPlugin->NewReader(); if (! *reader) { - printf("_CreateReader: NewReader failed\n"); + printf("PluginManager::CreateReader: NewReader failed\n"); + PutPlugin(plugin); return B_ERROR; } @@ -59,69 +62,94 @@ (*reader)->Setup(seekable_source); if (B_OK == (*reader)->Sniff(streamCount)) { - TRACE("_CreateReader: Sniff success (%ld stream(s))\n", *streamCount); + TRACE("PluginManager::CreateReader: Sniff success (%ld stream(s))\n", *streamCount); (*reader)->GetFileFormatInfo(mff); return B_OK; } // _DestroyReader(*reader); delete *reader; - _plugin_manager.PutPlugin(plugin); + PutPlugin(plugin); } - TRACE("_CreateReader leave\n"); + TRACE("PluginManager::CreateReader leave\n"); return B_MEDIA_NO_HANDLER; } +void +PluginManager::DestroyReader(Reader *reader) +{ + // ToDo: must call put plugin + delete reader; +} + + status_t -_CreateDecoder(Decoder **_decoder, const media_format &format) +PluginManager::CreateDecoder(Decoder **_decoder, const media_format &format) { - TRACE("_CreateDecoder enter\n"); + TRACE("PluginManager::CreateDecoder enter\n"); // get decoder for this format from the server server_get_decoder_for_format_request request; server_get_decoder_for_format_reply reply; request.format = format; if (B_OK != QueryServer(SERVER_GET_DECODER_FOR_FORMAT, &request, sizeof(request), &reply, sizeof(reply))) { - printf("_CreateDecoder: can't get decoder for format\n"); + printf("PluginManager::CreateDecoder: can't get decoder for format\n"); return B_ERROR; } - MediaPlugin *plugin = _plugin_manager.GetPlugin(reply.ref); + MediaPlugin *plugin = GetPlugin(reply.ref); if (!plugin) { - printf("_CreateDecoder: GetPlugin failed\n"); + printf("PluginManager::CreateDecoder: GetPlugin failed\n"); return B_ERROR; } DecoderPlugin *decoderPlugin = dynamic_cast(plugin); if (!decoderPlugin) { - printf("_CreateDecoder: dynamic_cast failed\n"); + printf("PluginManager::CreateDecoder: dynamic_cast failed\n"); + _plugin_manager.PutPlugin(plugin); return B_ERROR; } *_decoder = decoderPlugin->NewDecoder(0); if (*_decoder == NULL) { - printf("_CreateDecoder: NewDecoder() failed\n"); + printf("PluginManager::CreateDecoder: NewDecoder() failed\n"); + _plugin_manager.PutPlugin(plugin); return B_ERROR; } - TRACE("_CreateDecoder leave\n"); + TRACE("PluginManager::CreateDecoder leave\n"); return B_OK; } -void -_DestroyReader(Reader *reader) +status_t +PluginManager::CreateDecoder(Decoder **decoder, const media_codec_info &mci) { - // ToDo: must call put plugin - delete reader; + // TODO + debugger("not implemented"); + return B_ERROR; } +status_t +PluginManager::GetDecoderInfo(Decoder *decoder, media_codec_info *out_info) const +{ + if (!decoder) + return B_BAD_VALUE; + + decoder->GetCodecInfo(out_info); + // TODO: + // out_info->id = + // out_info->sub_id = + return B_OK; +} + + void -_DestroyDecoder(Decoder *decoder) +PluginManager::DestroyDecoder(Decoder *decoder) { // ToDo: must call put plugin delete decoder; @@ -240,8 +268,8 @@ MediaPlugin *pl; pl = (*instantiate_plugin_func)(); - if (pl == 0) { - printf("PluginManager: Error, LoadPlugin instantiate_plugin in %s returned 0\n", p.Path()); + if (pl == NULL) { + printf("PluginManager: Error, LoadPlugin instantiate_plugin in %s returned NULL\n", p.Path()); unload_add_on(id); return false; } From marcusoverhagen at mail.berlios.de Sat Jun 2 23:01:38 2007 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sat, 2 Jun 2007 23:01:38 +0200 Subject: [Haiku-commits] r21297 - haiku/trunk/src/apps/icon-o-matic/document Message-ID: <200706022101.l52L1cMi002903@sheep.berlios.de> Author: marcusoverhagen Date: 2007-06-02 23:01:38 +0200 (Sat, 02 Jun 2007) New Revision: 21297 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21297&view=rev Modified: haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp Log: build fix Modified: haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp 2007-06-02 20:00:48 UTC (rev 21296) +++ haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp 2007-06-02 21:01:38 UTC (rev 21297) @@ -5,6 +5,7 @@ * Authors: * Stephan A?mus */ +#include #include "Defines.h" const uint32 kNativeIconMagicNumber = 'GSMI'; From superstippi at gmx.de Sat Jun 2 23:04:06 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 02 Jun 2007 23:04:06 +0200 Subject: [Haiku-commits] r21297 - haiku/trunk/src/apps/icon-o-matic/document In-Reply-To: <200706022101.l52L1cMi002903@sheep.berlios.de> References: <200706022101.l52L1cMi002903@sheep.berlios.de> Message-ID: <20070602230406.2291.1@stippis.WG> marcusoverhagen at BerliOS wrote (2007-06-02, 23:01:38 [+0200]): > Author: marcusoverhagen > Date: 2007-06-02 23:01:38 +0200 (Sat, 02 Jun 2007) > New Revision: 21297 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21297&view=rev > > Modified: > haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp > Log: > build fix Ah, thanks. And sorry... :-) I'll probably move the include into the header, because that's where the types are first used. Best regards, -Stephan From stippi at mail.berlios.de Sun Jun 3 00:53:10 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 3 Jun 2007 00:53:10 +0200 Subject: [Haiku-commits] r21298 - haiku/trunk/src/apps/mediaplayer Message-ID: <200706022253.l52MrAxt012607@sheep.berlios.de> Author: stippi Date: 2007-06-03 00:53:09 +0200 (Sun, 03 Jun 2007) New Revision: 21298 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21298&view=rev Modified: haiku/trunk/src/apps/mediaplayer/ControllerView.cpp Log: * as an observer, the view needs to handle all observer notification messages, or else these messages end up in the window MessageReceived() (since the MainWindow was observing the same notifier, it received some notifications twice, which was part of the reason that unrecognized files produced multiple error messages as reported by Marcus) Modified: haiku/trunk/src/apps/mediaplayer/ControllerView.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/ControllerView.cpp 2007-06-02 21:01:38 UTC (rev 21297) +++ haiku/trunk/src/apps/mediaplayer/ControllerView.cpp 2007-06-02 22:53:09 UTC (rev 21298) @@ -67,6 +67,8 @@ switch (msg->what) { case MSG_PLAYLIST_REF_ADDED: case MSG_PLAYLIST_REF_REMOVED: + case MSG_PLAYLIST_REFS_SORTED: + case MSG_PLAYLIST_CURRENT_REF_CHANGED: CheckSkippable(); break; From marcusoverhagen at mail.berlios.de Sun Jun 3 01:16:55 2007 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 3 Jun 2007 01:16:55 +0200 Subject: [Haiku-commits] r21299 - in haiku/trunk: headers/private/media src/kits/media Message-ID: <200706022316.l52NGt5l011976@sheep.berlios.de> Author: marcusoverhagen Date: 2007-06-03 01:16:54 +0200 (Sun, 03 Jun 2007) New Revision: 21299 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21299&view=rev Modified: haiku/trunk/headers/private/media/PluginManager.h haiku/trunk/src/kits/media/PluginManager.cpp Log: cleanup Modified: haiku/trunk/headers/private/media/PluginManager.h =================================================================== --- haiku/trunk/headers/private/media/PluginManager.h 2007-06-02 22:53:09 UTC (rev 21298) +++ haiku/trunk/headers/private/media/PluginManager.h 2007-06-02 23:16:54 UTC (rev 21299) @@ -7,6 +7,8 @@ #include +namespace BPrivate { namespace media { + class PluginManager { public: @@ -26,7 +28,7 @@ void DestroyDecoder(Decoder *decoder); private: - bool LoadPlugin(const entry_ref &ref, MediaPlugin **plugin, image_id *image); + status_t LoadPlugin(const entry_ref &ref, MediaPlugin **plugin, image_id *image); struct plugin_info { @@ -40,6 +42,10 @@ BLocker *fLocker; }; +} } // namespace BPrivate::media + +using namespace BPrivate::media; + extern PluginManager _plugin_manager; #endif Modified: haiku/trunk/src/kits/media/PluginManager.cpp =================================================================== --- haiku/trunk/src/kits/media/PluginManager.cpp 2007-06-02 22:53:09 UTC (rev 21298) +++ haiku/trunk/src/kits/media/PluginManager.cpp 2007-06-02 23:16:54 UTC (rev 21299) @@ -108,14 +108,14 @@ DecoderPlugin *decoderPlugin = dynamic_cast(plugin); if (!decoderPlugin) { printf("PluginManager::CreateDecoder: dynamic_cast failed\n"); - _plugin_manager.PutPlugin(plugin); + PutPlugin(plugin); return B_ERROR; } *_decoder = decoderPlugin->NewDecoder(0); if (*_decoder == NULL) { printf("PluginManager::CreateDecoder: NewDecoder() failed\n"); - _plugin_manager.PutPlugin(plugin); + PutPlugin(plugin); return B_ERROR; } @@ -200,10 +200,10 @@ } } - if (!LoadPlugin(ref, &info.plugin, &info.image)) { + if (LoadPlugin(ref, &info.plugin, &info.image) < B_OK) { printf("PluginManager: Error, loading PlugIn %s failed\n", ref.name); fLocker->Unlock(); - return 0; + return NULL; } strcpy(info.name, ref.name); @@ -245,7 +245,7 @@ } -bool +status_t PluginManager::LoadPlugin(const entry_ref &ref, MediaPlugin **plugin, image_id *image) { BPath p(&ref); @@ -255,14 +255,14 @@ image_id id; id = load_add_on(p.Path()); if (id < 0) - return false; + return B_ERROR; MediaPlugin *(*instantiate_plugin_func)(); if (get_image_symbol(id, "instantiate_plugin", B_SYMBOL_TYPE_TEXT, (void**)&instantiate_plugin_func) < B_OK) { printf("PluginManager: Error, LoadPlugin can't find instantiate_plugin in %s\n", p.Path()); unload_add_on(id); - return false; + return B_ERROR; } MediaPlugin *pl; @@ -271,10 +271,10 @@ if (pl == NULL) { printf("PluginManager: Error, LoadPlugin instantiate_plugin in %s returned NULL\n", p.Path()); unload_add_on(id); - return false; + return B_ERROR; } *plugin = pl; *image = id; - return true; + return B_OK; } From stippi at mail.berlios.de Sun Jun 3 01:22:31 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 3 Jun 2007 01:22:31 +0200 Subject: [Haiku-commits] r21300 - haiku/trunk/src/apps/mediaplayer Message-ID: <200706022322.l52NMVLp026512@sheep.berlios.de> Author: stippi Date: 2007-06-03 01:22:30 +0200 (Sun, 03 Jun 2007) New Revision: 21300 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21300&view=rev Modified: haiku/trunk/src/apps/mediaplayer/InfoWin.cpp haiku/trunk/src/apps/mediaplayer/InfoWin.h haiku/trunk/src/apps/mediaplayer/MainApp.cpp haiku/trunk/src/apps/mediaplayer/MainApp.h haiku/trunk/src/apps/mediaplayer/MainWin.cpp haiku/trunk/src/apps/mediaplayer/MainWin.h haiku/trunk/src/apps/mediaplayer/Playlist.cpp haiku/trunk/src/apps/mediaplayer/Playlist.h Log: * cleanup in MainWin, better grouping of functions in .h and moved functions in .cpp accordingly, prepended private methods with _ * disabled InfoWin, because it accessed members of MainWin directly, will be reimplemented with notification mechanism * fixed the bug with the multiple error alerts for an unsupported file, the window should use the current file index from the notification itself Modified: haiku/trunk/src/apps/mediaplayer/InfoWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/InfoWin.cpp 2007-06-02 23:16:54 UTC (rev 21299) +++ haiku/trunk/src/apps/mediaplayer/InfoWin.cpp 2007-06-02 23:22:30 UTC (rev 21300) @@ -70,19 +70,13 @@ } -InfoWin::InfoWin(MainWin *mainWin) - : BWindow(BRect(100,100,100+MIN_WIDTH-1,350), NAME, B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE /* | B_WILL_ACCEPT_FIRST_CLICK */), - fMainWin(mainWin), - fController() +InfoWin::InfoWin(BPoint leftTop, Controller* controller) + : BWindow(BRect(leftTop.x, leftTop.y, leftTop.x + MIN_WIDTH - 1, + leftTop.y + 250), NAME, B_TITLED_WINDOW, + B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE), + fController(controller) { - BRect rect; - if (fMainWin->Lock()) { - rect = fMainWin->Frame(); - MoveTo(rect.right, rect.top); - fMainWin->Unlock(); - } - - rect = Bounds(); + BRect rect = Bounds(); // accomodate for big fonts float div; @@ -161,167 +155,164 @@ void InfoWin::Update(uint32 which) { - status_t err; - //char buf[256]; - printf("InfoWin::Update(0x%08lx)\n", which); - rgb_color vFgCol = ui_color(B_DOCUMENT_TEXT_COLOR); - - fLabelsView->SelectAll(); - fContentsView->SelectAll(); - fLabelsView->Clear(); - fContentsView->Clear(); - fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kBlue); - fLabelsView->Insert("File Info\n"); - fContentsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &vFgCol); - fContentsView->Insert("\n"); - - fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kRed); - //fContentsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &vFgCol); - - // lock the Main Window as we must access some fields there... - if (fMainWin->LockWithTimeout(500000) < B_OK) - return; // XXX: resend msg to ourselves ? - - Controller *c = fMainWin->fController; - BMediaFile *mf = c->fMediaFile; - - if (which & INFO_VIDEO && c->VideoTrackCount() > 0) { - fLabelsView->Insert("Video\n\n"); - BString s; - media_format fmt; - media_raw_video_format vfmt; - float fps; - err = c->fVideoTrack->EncodedFormat(&fmt); - //string_for_format(fmt, buf, sizeof(buf)); - //printf("%s\n", buf); - if (err < 0) { - s << "(" << strerror(err) << ")"; - } else if (fmt.type == B_MEDIA_ENCODED_VIDEO) { - vfmt = fmt.u.encoded_video.output; - media_codec_info mci; - err = c->fVideoTrack->GetCodecInfo(&mci); - if (err < 0) - s << "(" << strerror(err) << ")"; - else - s << mci.pretty_name; //<< "(" << mci.short_name << ")"; - } else if (fmt.type == B_MEDIA_RAW_VIDEO) { - vfmt = fmt.u.raw_video; - s << "raw video"; - } else - s << "unknown format"; - s << "\n"; - s << fmt.Width() << " x " << fmt.Height(); - // encoded has output as 1st field... - fps = vfmt.field_rate; - s << ", " << fps << " fps"; - s << "\n"; - fContentsView->Insert(s.String()); - } - if (which & INFO_AUDIO && c->AudioTrackCount() > 0) { - fLabelsView->Insert("Sound\n\n"); - BString s; - media_format fmt; - media_raw_audio_format afmt; - err = c->fAudioTrack->EncodedFormat(&fmt); - //string_for_format(fmt, buf, sizeof(buf)); - //printf("%s\n", buf); - if (err < 0) { - s << "(" << strerror(err) << ")"; - } else if (fmt.type == B_MEDIA_ENCODED_AUDIO) { - afmt = fmt.u.encoded_audio.output; - media_codec_info mci; - err = c->fAudioTrack->GetCodecInfo(&mci); - if (err < 0) - s << "(" << strerror(err) << ")"; - else - s << mci.pretty_name; //<< "(" << mci.short_name << ")"; - } else if (fmt.type == B_MEDIA_RAW_AUDIO) { - afmt = fmt.u.raw_audio; - s << "raw audio"; - } else - s << "unknown format"; - s << "\n"; - uint32 bitps = 8 * (afmt.format & media_raw_audio_format::B_AUDIO_SIZE_MASK); - uint32 chans = afmt.channel_count; - float sr = afmt.frame_rate; - - if (bitps) - s << bitps << " Bit "; - if (chans == 1) - s << "Mono"; - else if (chans == 2) - s << "Stereo"; - else - s << chans << "Channels"; - s << ", "; - if (sr) - s << sr/1000; - else - s << "?"; - s<< " kHz"; - s << "\n"; - fContentsView->Insert(s.String()); - } - if (which & INFO_STATS && fMainWin->fHasFile) { - // TODO: check for live streams (no duration) - fLabelsView->Insert("Duration\n"); - BString s; - bigtime_t d = c->Duration(); - bigtime_t v; - - //s << d << "?s; "; - - d /= 1000; - - v = d / (3600 * 1000); - d = d % (3600 * 1000); - if (v) - s << v << ":"; - v = d / (60 * 1000); - d = d % (60 * 1000); - s << v << ":"; - v = d / 1000; - d = d % 1000; - s << v; - if (d) - s << "." << d / 10; - s << "\n"; - fContentsView->Insert(s.String()); - // TODO: demux/video/audio/... perfs (Kb/s) - } - if (which & INFO_TRANSPORT) { - } - if ((which & INFO_FILE) && fMainWin->fHasFile) { - media_file_format ff; - if (mf && (mf->GetFileFormatInfo(&ff) == B_OK)) { - fLabelsView->Insert("Container\n"); - BString s; - s << ff.pretty_name; - s << "\n"; - fContentsView->Insert(s.String()); - } - fLabelsView->Insert("Location\n"); - // TODO: make Controller save the entry_ref (url actually). - fContentsView->Insert("file://\n"); - fFilenameView->SetText(c->fName.String()); - } - if (which & INFO_COPYRIGHT && mf && mf->Copyright()) { - - fLabelsView->Insert("Copyright\n\n"); - BString s; - s << mf->Copyright(); - s << "\n\n"; - fContentsView->Insert(s.String()); - } - - // we can unlock the main window now and let it work - fMainWin->Unlock(); - - // now resize the window to the list view size... - ResizeToPreferred(); - - if (IsHidden()) - Show(); +// status_t err; +// //char buf[256]; +// printf("InfoWin::Update(0x%08lx)\n", which); +// rgb_color vFgCol = ui_color(B_DOCUMENT_TEXT_COLOR); +// +// fLabelsView->SelectAll(); +// fContentsView->SelectAll(); +// fLabelsView->Clear(); +// fContentsView->Clear(); +// fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kBlue); +// fLabelsView->Insert("File Info\n"); +// fContentsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &vFgCol); +// fContentsView->Insert("\n"); +// +// fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kRed); +// //fContentsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &vFgCol); +// +// // lock the Main Window as we must access some fields there... +// if (fMainWin->LockWithTimeout(500000) < B_OK) +// return; // XXX: resend msg to ourselves ? +// +// Controller *c = fMainWin->fController; +// BMediaFile *mf = c->fMediaFile; +// +// if (which & INFO_VIDEO && c->VideoTrackCount() > 0) { +// fLabelsView->Insert("Video\n\n"); +// BString s; +// media_format fmt; +// media_raw_video_format vfmt; +// float fps; +// err = c->fVideoTrack->EncodedFormat(&fmt); +// //string_for_format(fmt, buf, sizeof(buf)); +// //printf("%s\n", buf); +// if (err < 0) { +// s << "(" << strerror(err) << ")"; +// } else if (fmt.type == B_MEDIA_ENCODED_VIDEO) { +// vfmt = fmt.u.encoded_video.output; +// media_codec_info mci; +// err = c->fVideoTrack->GetCodecInfo(&mci); +// if (err < 0) +// s << "(" << strerror(err) << ")"; +// else +// s << mci.pretty_name; //<< "(" << mci.short_name << ")"; +// } else if (fmt.type == B_MEDIA_RAW_VIDEO) { +// vfmt = fmt.u.raw_video; +// s << "raw video"; +// } else +// s << "unknown format"; +// s << "\n"; +// s << fmt.Width() << " x " << fmt.Height(); +// // encoded has output as 1st field... +// fps = vfmt.field_rate; +// s << ", " << fps << " fps"; +// s << "\n"; +// fContentsView->Insert(s.String()); +// } +// if (which & INFO_AUDIO && c->AudioTrackCount() > 0) { +// fLabelsView->Insert("Sound\n\n"); +// BString s; +// media_format fmt; +// media_raw_audio_format afmt; +// err = c->fAudioTrack->EncodedFormat(&fmt); +// //string_for_format(fmt, buf, sizeof(buf)); +// //printf("%s\n", buf); +// if (err < 0) { +// s << "(" << strerror(err) << ")"; +// } else if (fmt.type == B_MEDIA_ENCODED_AUDIO) { +// afmt = fmt.u.encoded_audio.output; +// media_codec_info mci; +// err = c->fAudioTrack->GetCodecInfo(&mci); +// if (err < 0) +// s << "(" << strerror(err) << ")"; +// else +// s << mci.pretty_name; //<< "(" << mci.short_name << ")"; +// } else if (fmt.type == B_MEDIA_RAW_AUDIO) { +// afmt = fmt.u.raw_audio; +// s << "raw audio"; +// } else +// s << "unknown format"; +// s << "\n"; +// uint32 bitps = 8 * (afmt.format & media_raw_audio_format::B_AUDIO_SIZE_MASK); +// uint32 chans = afmt.channel_count; +// float sr = afmt.frame_rate; +// +// if (bitps) +// s << bitps << " Bit "; +// if (chans == 1) +// s << "Mono"; +// else if (chans == 2) +// s << "Stereo"; +// else +// s << chans << "Channels"; +// s << ", "; +// if (sr) +// s << sr/1000; +// else +// s << "?"; +// s<< " kHz"; +// s << "\n"; +// fContentsView->Insert(s.String()); +// } +// if (which & INFO_STATS && fMainWin->fHasFile) { +// // TODO: check for live streams (no duration) +// fLabelsView->Insert("Duration\n"); +// BString s; +// bigtime_t d = c->Duration(); +// bigtime_t v; +// +// //s << d << "?s; "; +// +// d /= 1000; +// +// v = d / (3600 * 1000); +// d = d % (3600 * 1000); +// if (v) +// s << v << ":"; +// v = d / (60 * 1000); +// d = d % (60 * 1000); +// s << v << ":"; +// v = d / 1000; +// d = d % 1000; +// s << v; +// if (d) +// s << "." << d / 10; +// s << "\n"; +// fContentsView->Insert(s.String()); +// // TODO: demux/video/audio/... perfs (Kb/s) +// } +// if (which & INFO_TRANSPORT) { +// } +// if ((which & INFO_FILE) && fMainWin->fHasFile) { +// media_file_format ff; +// if (mf && (mf->GetFileFormatInfo(&ff) == B_OK)) { +// fLabelsView->Insert("Container\n"); +// BString s; +// s << ff.pretty_name; +// s << "\n"; +// fContentsView->Insert(s.String()); +// } +// fLabelsView->Insert("Location\n"); +// // TODO: make Controller save the entry_ref (url actually). +// fContentsView->Insert("file://\n"); +// fFilenameView->SetText(c->fName.String()); +// } +// if (which & INFO_COPYRIGHT && mf && mf->Copyright()) { +// +// fLabelsView->Insert("Copyright\n\n"); +// BString s; +// s << mf->Copyright(); +// s << "\n\n"; +// fContentsView->Insert(s.String()); +// } +// +// // we can unlock the main window now and let it work +// fMainWin->Unlock(); +// +// // now resize the window to the list view size... +// ResizeToPreferred(); } @@ -334,25 +325,6 @@ void -InfoWin::Show() -{ - // notify the main window first - fMainWin->fInfoWinShowing = true; - BWindow::Show(); - //SetPulseRate(1000000); -} - - -void -InfoWin::Hide() -{ - SetPulseRate(0); - BWindow::Hide(); - fMainWin->fInfoWinShowing = false; -} - - -void InfoWin::Pulse() { if (IsHidden()) Modified: haiku/trunk/src/apps/mediaplayer/InfoWin.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/InfoWin.h 2007-06-02 23:16:54 UTC (rev 21299) +++ haiku/trunk/src/apps/mediaplayer/InfoWin.h 2007-06-02 23:22:30 UTC (rev 21300) @@ -24,46 +24,45 @@ #include #include + class MainWin; class Controller; class InfoView; #define M_UPDATE_INFO 'upda' -#define INFO_STATS 0x00000001 -#define INFO_TRANSPORT 0x00000002 -#define INFO_FILE 0x00000004 -#define INFO_AUDIO 0x00000008 -#define INFO_VIDEO 0x00000010 -#define INFO_COPYRIGHT 0x00000020 +#define INFO_STATS 0x00000001 +#define INFO_TRANSPORT 0x00000002 +#define INFO_FILE 0x00000004 +#define INFO_AUDIO 0x00000008 +#define INFO_VIDEO 0x00000010 +#define INFO_COPYRIGHT 0x00000020 -#define INFO_ALL 0xffffffff +#define INFO_ALL 0xffffffff -class InfoWin : public BWindow -{ +class InfoWin : public BWindow { public: - InfoWin(MainWin *mainWin); - ~InfoWin(); + InfoWin(BPoint leftTop, + Controller* controller); + virtual ~InfoWin(); + + virtual void FrameResized(float newWidth, float newHeight); + virtual void MessageReceived(BMessage* message); + virtual bool QuitRequested(); + virtual void Pulse(); - void FrameResized(float new_width, float new_height); - void MessageReceived(BMessage *msg); - bool QuitRequested(); - virtual void Show(); - virtual void Hide(); - virtual void Pulse(); + void ResizeToPreferred(); + void Update(uint32 which=INFO_ALL); // threadsafe - void ResizeToPreferred(); - void Update(uint32 which=INFO_ALL); // threadsafe +private: + Controller* fController; + + InfoView* fInfoView; + BStringView* fFilenameView; + BTextView* fLabelsView; + BTextView* fContentsView; - MainWin * fMainWin; - Controller * fController; - - InfoView * fInfoView; - BStringView * fFilenameView; - BTextView * fLabelsView; - BTextView * fContentsView; - }; -#endif +#endif // __FILE_INFO_WIN_H Modified: haiku/trunk/src/apps/mediaplayer/MainApp.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainApp.cpp 2007-06-02 23:16:54 UTC (rev 21299) +++ haiku/trunk/src/apps/mediaplayer/MainApp.cpp 2007-06-02 23:22:30 UTC (rev 21300) @@ -122,6 +122,13 @@ } +void +MainApp::AboutRequested() +{ + fFirstWindow->PostMessage(B_ABOUT_REQUESTED); +} + + int main() { Modified: haiku/trunk/src/apps/mediaplayer/MainApp.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainApp.h 2007-06-02 23:16:54 UTC (rev 21299) +++ haiku/trunk/src/apps/mediaplayer/MainApp.h 2007-06-02 23:22:30 UTC (rev 21300) @@ -40,6 +40,7 @@ void RefsReceived(BMessage *msg); void ArgvReceived(int32 argc, char **argv); void MessageReceived(BMessage *msg); + void AboutRequested(); private: BWindow * fFirstWindow; Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2007-06-02 23:16:54 UTC (rev 21299) +++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2007-06-02 23:22:30 UTC (rev 21300) @@ -47,14 +47,12 @@ // XXX TODO: why is lround not defined? #define lround(a) ((int)(0.99999 + (a))) -enum -{ +enum { M_DUMMY = 0x100, M_FILE_OPEN = 0x1000, M_FILE_NEWPLAYER, M_FILE_INFO, M_FILE_PLAYLIST, - M_FILE_ABOUT, M_FILE_CLOSE, M_FILE_QUIT, M_VIEW_50, @@ -97,7 +95,6 @@ , fFilePanel(NULL) , fInfoWin(NULL) , fPlaylistWindow(NULL) - , fInfoWinShowing(false) , fHasFile(false) , fHasVideo(false) , fHasAudio(false) @@ -132,7 +129,7 @@ // menu fMenuBar = new BMenuBar(fBackground->Bounds(), "menu"); - CreateMenu(); + _CreateMenu(); fBackground->AddChild(fMenuBar); fMenuBar->ResizeToPreferred(); fMenuBarWidth = (int)fMenuBar->Frame().Width() + 1; @@ -165,7 +162,7 @@ // printf("fControlsHeight %d\n", fControlsHeight); // printf("fControlsWidth %d\n", fControlsWidth); - SetupWindow(); + _SetupWindow(); Show(); } @@ -198,7 +195,439 @@ } +// #pragma mark - + + void +MainWin::FrameResized(float new_width, float new_height) +{ + if (new_width != Bounds().Width() || new_height != Bounds().Height()) { + debugger("size wrong\n"); + } + + bool no_menu = fNoMenu || fIsFullscreen; + bool no_controls = fNoControls || fIsFullscreen; + + printf("FrameResized enter: new_width %.0f, new_height %.0f\n", new_width, new_height); + + int max_video_width = int(new_width) + 1; + int max_video_height = int(new_height) + 1 - (no_menu ? 0 : fMenuBarHeight) - (no_controls ? 0 : fControlsHeight); + + ASSERT(max_video_height >= 0); + + int y = 0; + + if (no_menu) { + if (!fMenuBar->IsHidden()) + fMenuBar->Hide(); + } else { +// fMenuBar->MoveTo(0, y); + fMenuBar->ResizeTo(new_width, fMenuBarHeight - 1); + if (fMenuBar->IsHidden()) + fMenuBar->Show(); + y += fMenuBarHeight; + } + + if (max_video_height == 0) { + if (!fVideoView->IsHidden()) + fVideoView->Hide(); + } else { +// fVideoView->MoveTo(0, y); +// fVideoView->ResizeTo(max_video_width - 1, max_video_height - 1); + _ResizeVideoView(0, y, max_video_width, max_video_height); + if (fVideoView->IsHidden()) + fVideoView->Show(); + y += max_video_height; + } + + if (no_controls) { + if (!fControls->IsHidden()) + fControls->Hide(); + } else { + fControls->MoveTo(0, y); + fControls->ResizeTo(new_width, fControlsHeight - 1); + if (fControls->IsHidden()) + fControls->Show(); +// y += fControlsHeight; + } + + printf("FrameResized leave\n"); +} + + +void +MainWin::Zoom(BPoint rec_position, float rec_width, float rec_height) +{ + PostMessage(M_TOGGLE_FULLSCREEN); +} + + +void +MainWin::DispatchMessage(BMessage *msg, BHandler *handler) +{ + if ((msg->what == B_MOUSE_DOWN) + && (handler == fBackground || handler == fVideoView + || handler == fControls)) + _MouseDown(msg, dynamic_cast(handler)); + + if ((msg->what == B_MOUSE_MOVED) + && (handler == fBackground || handler == fVideoView + || handler == fControls)) + _MouseMoved(msg, dynamic_cast(handler)); + + if ((msg->what == B_MOUSE_UP) + && (handler == fBackground || handler == fVideoView)) + _MouseUp(msg); + + if ((msg->what == B_KEY_DOWN) + && (handler == fBackground || handler == fVideoView)) { + + // special case for PrintScreen key + if (msg->FindInt32("key") == B_PRINT_KEY) { + fVideoView->OverlayScreenshotPrepare(); + BWindow::DispatchMessage(msg, handler); + fVideoView->OverlayScreenshotCleanup(); + return; + } + + // every other key gets dispatched to our _KeyDown first + if (_KeyDown(msg) == B_OK) { + // it got handled, don't pass it on + return; + } + } + + BWindow::DispatchMessage(msg, handler); +} + + +void +MainWin::MessageReceived(BMessage *msg) +{ + switch (msg->what) { + case B_REFS_RECEIVED: + printf("MainWin::MessageReceived: B_REFS_RECEIVED\n"); + _RefsReceived(msg); + break; + case B_SIMPLE_DATA: + printf("MainWin::MessageReceived: B_SIMPLE_DATA\n"); + if (msg->HasRef("refs")) + _RefsReceived(msg); + break; + + // PlaylistObserver messages + case MSG_PLAYLIST_REF_ADDED: { +printf("MSG_PLAYLIST_REF_ADDED\n"); + entry_ref ref; + int32 index; + if (msg->FindRef("refs", &ref) == B_OK + && msg->FindInt32("index", &index) == B_OK) { + _AddPlaylistItem(ref, index); + } + break; + } + case MSG_PLAYLIST_REF_REMOVED: { +printf("MSG_PLAYLIST_REF_REMOVED\n"); + int32 index; + if (msg->FindInt32("index", &index) == B_OK) { + _RemovePlaylistItem(index); + } + break; + } + case MSG_PLAYLIST_CURRENT_REF_CHANGED: { +printf("MSG_PLAYLIST_CURRENT_REF_CHANGED\n"); + int32 index; + if (msg->FindInt32("index", &index) < B_OK + || index != fPlaylist->CurrentRefIndex()) + break; +printf(" index: %ld\n", index); + entry_ref ref; + if (fPlaylist->GetRefAt(index, &ref) == B_OK) { + printf("open ref: %s\n", ref.name); + OpenFile(ref); + _MarkPlaylistItem(index); + } + break; + } + + // ControllerObserver messages + case MSG_CONTROLLER_FILE_FINISHED: +printf("MSG_CONTROLLER_FILE_FINISHED\n"); + fPlaylist->SetCurrentRefIndex(fPlaylist->CurrentRefIndex() + 1); + break; + case MSG_CONTROLLER_FILE_CHANGED: + // TODO: move all other GUI changes as a reaction to this notification +// _UpdatePlaylistMenu(); + break; + case MSG_CONTROLLER_VIDEO_TRACK_CHANGED: { + int32 index; + if (msg->FindInt32("index", &index) == B_OK) { + BMenuItem* item = fVideoTrackMenu->ItemAt(index); + if (item) + item->SetMarked(true); + } + break; + } + case MSG_CONTROLLER_AUDIO_TRACK_CHANGED: { + int32 index; + if (msg->FindInt32("index", &index) == B_OK) { + BMenuItem* item = fAudioTrackMenu->ItemAt(index); + if (item) + item->SetMarked(true); + } + break; + } + case MSG_CONTROLLER_PLAYBACK_STATE_CHANGED: { + uint32 state; + if (msg->FindInt32("state", (int32*)&state) == B_OK) + fControls->SetPlaybackState(state); + break; + } + case MSG_CONTROLLER_POSITION_CHANGED: { + float position; + if (msg->FindFloat("position", &position) == B_OK) + fControls->SetPosition(position); + break; + } + + // menu item messages + case M_FILE_NEWPLAYER: + gMainApp->NewWindow(); + break; + case M_FILE_OPEN: + if (!fFilePanel) { + fFilePanel = new BFilePanel(); + fFilePanel->SetTarget(BMessenger(0, this)); + fFilePanel->SetPanelDirectory("/boot/home/"); + } + fFilePanel->Show(); + break; + case M_FILE_INFO: + ShowFileInfo(); + break; + case M_FILE_PLAYLIST: + ShowPlaylistWindow(); + break; + case B_ABOUT_REQUESTED: + BAlert *alert; + alert = new BAlert("about", NAME"\n\n Written by Marcus Overhagen " + "and Stephan A?mus", "Thanks"); + if (fAlwaysOnTop) { + _ToggleAlwaysOnTop(); + alert->Go(); + _ToggleAlwaysOnTop(); + } else { + alert->Go(); + } + break; + case M_FILE_CLOSE: + PostMessage(B_QUIT_REQUESTED); + break; + case M_FILE_QUIT: + be_app->PostMessage(B_QUIT_REQUESTED); + break; + + case M_TOGGLE_FULLSCREEN: + _ToggleFullscreen(); +// fSettingsMenu->ItemAt(1)->SetMarked(fIsFullscreen); + break; + + case M_TOGGLE_NO_MENU: + _ToggleNoMenu(); +// fSettingsMenu->ItemAt(3)->SetMarked(fNoMenu); + break; + + case M_TOGGLE_NO_CONTROLS: + _ToggleNoControls(); +// fSettingsMenu->ItemAt(3)->SetMarked(fNoControls); + break; + + case M_TOGGLE_NO_BORDER: + _ToggleNoBorder(); +// fSettingsMenu->ItemAt(4)->SetMarked(fNoBorder); + break; + + case M_TOGGLE_ALWAYS_ON_TOP: + _ToggleAlwaysOnTop(); +// fSettingsMenu->ItemAt(5)->SetMarked(fAlwaysOnTop); + break; + + case M_TOGGLE_KEEP_ASPECT_RATIO: + _ToggleKeepAspectRatio(); +// fSettingsMenu->ItemAt(6)->SetMarked(fKeepAspectRatio); + break; + + case M_TOGGLE_NO_BORDER_NO_MENU_NO_CONTROLS: + _ToggleNoBorderNoMenu(); + break; + + case M_VIEW_50: + if (!fHasVideo) + break; + if (fIsFullscreen) + _ToggleFullscreen(); + _ResizeWindow(50); + break; + + case M_VIEW_100: + if (!fHasVideo) + break; + if (fIsFullscreen) + _ToggleFullscreen(); + _ResizeWindow(100); + break; + + case M_VIEW_200: + if (!fHasVideo) + break; + if (fIsFullscreen) + _ToggleFullscreen(); + _ResizeWindow(200); + break; + + case M_VIEW_300: + if (!fHasVideo) + break; + if (fIsFullscreen) + _ToggleFullscreen(); + _ResizeWindow(300); + break; + + case M_VIEW_400: + if (!fHasVideo) + break; + if (fIsFullscreen) + _ToggleFullscreen(); + _ResizeWindow(400); + break; + +/* + + case B_ACQUIRE_OVERLAY_LOCK: + printf("B_ACQUIRE_OVERLAY_LOCK\n"); + fVideoView->OverlayLockAcquire(); + break; + + case B_RELEASE_OVERLAY_LOCK: + printf("B_RELEASE_OVERLAY_LOCK\n"); + fVideoView->OverlayLockRelease(); + break; + + case B_MOUSE_WHEEL_CHANGED: + { + printf("B_MOUSE_WHEEL_CHANGED\n"); + float dx = msg->FindFloat("be:wheel_delta_x"); + float dy = msg->FindFloat("be:wheel_delta_y"); + bool inv = modifiers() & B_COMMAND_KEY; + if (dx > 0.1) PostMessage(inv ? M_VOLUME_DOWN : M_CHANNEL_PREV); + if (dx < -0.1) PostMessage(inv ? M_VOLUME_UP : M_CHANNEL_NEXT); + if (dy > 0.1) PostMessage(inv ? M_CHANNEL_PREV : M_VOLUME_DOWN); + if (dy < -0.1) PostMessage(inv ? M_CHANNEL_NEXT : M_VOLUME_UP); + break; + } + + case M_CHANNEL_NEXT: + { + printf("M_CHANNEL_NEXT\n"); + int chan = fController->CurrentChannel(); + if (chan != -1) { + chan++; + if (chan < fController->ChannelCount()) + SelectChannel(chan); + } + break; + } + + case M_CHANNEL_PREV: + { + printf("M_CHANNEL_PREV\n"); + int chan = fController->CurrentChannel(); + if (chan != -1) { + chan--; + if (chan >= 0) + SelectChannel(chan); + } + break; + } + + case M_VOLUME_UP: + printf("M_VOLUME_UP\n"); + fController->VolumeUp(); + break; + + case M_VOLUME_DOWN: + printf("M_VOLUME_DOWN\n"); + fController->VolumeDown(); + break; +*/ + + case M_ASPECT_100000_1: + VideoFormatChange(fSourceWidth, fSourceHeight, 1.0, 1.0); + break; + + case M_ASPECT_106666_1: + VideoFormatChange(fSourceWidth, fSourceHeight, 1.06666, 1.0); + break; + + case M_ASPECT_109091_1: + VideoFormatChange(fSourceWidth, fSourceHeight, 1.09091, 1.0); + break; + + case M_ASPECT_141176_1: + VideoFormatChange(fSourceWidth, fSourceHeight, 1.41176, 1.0); + break; + + case M_ASPECT_720_576: + VideoFormatChange(720, 576, 1.06666, 1.0); + break; + + case M_ASPECT_704_576: + VideoFormatChange(704, 576, 1.09091, 1.0); + break; + + case M_ASPECT_544_576: + VideoFormatChange(544, 576, 1.41176, 1.0); + break; +/* + case M_PREFERENCES: + break; + + default: + if (msg->what >= M_SELECT_CHANNEL && msg->what <= M_SELECT_CHANNEL_END) { + SelectChannel(msg->what - M_SELECT_CHANNEL); + break; + } + if (msg->what >= M_SELECT_INTERFACE && msg->what <= M_SELECT_INTERFACE_END) { + SelectInterface(msg->what - M_SELECT_INTERFACE - 1); + break; + } +*/ + case M_SET_PLAYLIST_POSITION: { + int32 index; + if (msg->FindInt32("index", &index) == B_OK) + fPlaylist->SetCurrentRefIndex(index); + break; + } + + default: + // let BWindow handle the rest + BWindow::MessageReceived(msg); + } +} + + +bool +MainWin::QuitRequested() +{ + be_app->PostMessage(M_PLAYER_QUIT); + return true; +} + + +// #pragma mark - + + +void MainWin::OpenFile(const entry_ref &ref) { printf("MainWin::OpenFile\n"); @@ -227,16 +656,119 @@ fHasAudio = fController->AudioTrackCount() != 0; SetTitle(ref.name); } - SetupWindow(); + _SetupWindow(); } void -MainWin::SetupWindow() +MainWin::ShowFileInfo() { - printf("MainWin::SetupWindow\n"); + if (!fInfoWin) + fInfoWin = new InfoWin(Frame().LeftTop(), fController); + if (fInfoWin->Lock()) { + if (fInfoWin->IsHidden()) + fInfoWin->Show(); + else [... truncated: 1521 lines follow ...] From mmu_man at mail.berlios.de Sun Jun 3 02:45:58 2007 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 3 Jun 2007 02:45:58 +0200 Subject: [Haiku-commits] r21301 - haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/nbd Message-ID: <200706030045.l530jwIf000568@sheep.berlios.de> Author: mmu_man Date: 2007-06-03 02:45:56 +0200 (Sun, 03 Jun 2007) New Revision: 21301 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21301&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/nbd/nbd.c Log: Fix some warnings. Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/nbd/nbd.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/nbd/nbd.c 2007-06-02 23:22:30 UTC (rev 21300) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/virtual/nbd/nbd.c 2007-06-03 00:45:56 UTC (rev 21301) @@ -15,6 +15,9 @@ #include #include #include +#include +#include +#include #include #include @@ -112,6 +115,18 @@ struct nbd_device *nbd_find_device(const char* name); +int32 nbd_postoffice(void *arg); +status_t nbd_connect(struct nbd_device *dev); +status_t nbd_teardown(struct nbd_device *dev); +status_t nbd_post_request(struct nbd_device *dev, struct nbd_request_entry *req); + +status_t nbd_open(const char *name, uint32 flags, cookie_t **cookie); +status_t nbd_close(cookie_t *cookie); +status_t nbd_free(cookie_t *cookie); +status_t nbd_control(cookie_t *cookie, uint32 op, void *data, size_t len); +status_t nbd_read(cookie_t *cookie, off_t position, void *data, size_t *numbytes); +status_t nbd_write(cookie_t *cookie, off_t position, const void *data, size_t *numbytes); + KSOCKET_MODULE_DECL; /* HACK: @@ -123,7 +138,9 @@ bool gDelayUnload = false; #define BONE_TEARDOWN_DELAY 60000000 +#if 0 #pragma mark ==== support ==== +#endif // move that to ksocket inlined static int kinet_aton(const char *in, struct in_addr *addr) @@ -131,7 +148,7 @@ int i; unsigned long a; uint32 inaddr = 0L; - const char *p = in; + char *p = (char *)in; for (i = 0; i < 4; i++) { a = strtoul(p, &p, 10); if (!p) @@ -145,7 +162,9 @@ return 0; } +#if 0 #pragma mark ==== request manager ==== +#endif status_t nbd_alloc_request(struct nbd_device *dev, struct nbd_request_entry **req, uint32 type, off_t from, size_t len, const char *data) { @@ -194,7 +213,7 @@ r->req.from = B_HOST_TO_BENDIAN_INT64(r->from); r->req.len = B_HOST_TO_BENDIAN_INT32(len); - r->buffer = w ? data : (((char *)r) + sizeof(struct nbd_request_entry)); + r->buffer = (void *)(w ? data : (((char *)r) + sizeof(struct nbd_request_entry))); *req = r; return B_OK; @@ -246,14 +265,15 @@ +#if 0 #pragma mark ==== nbd handler ==== +#endif int32 nbd_postoffice(void *arg) { struct nbd_device *dev = (struct nbd_device *)arg; struct nbd_request_entry *req = NULL; struct nbd_reply reply; - int sock = dev->sock; status_t err; const char *reason; PRINT((DP ">%s()\n", __FUNCTION__)); @@ -352,7 +372,7 @@ //err = ENOSYS; if (err == -1 && errno < 0) err = errno; - /* HACK: avoid the kernel unlading us with locked pages from TCP */ + /* HACK: avoid the kernel unloading us with locked pages from TCP */ if (err) gDelayUnload = true; if (err) @@ -426,7 +446,9 @@ } +#if 0 #pragma mark ==== device hooks ==== +#endif static struct nbd_device nbd_devices[MAX_NBDS]; @@ -437,7 +459,7 @@ int kfd; #endif struct nbd_device *dev = NULL; - PRINT((DP ">%s(%s, %x, )\n", __FUNCTION__, name, flags)); + PRINT((DP ">%s(%s, %lx, )\n", __FUNCTION__, name, flags)); (void)name; (void)flags; dev = nbd_find_device(name); if (!dev || !dev->valid) @@ -532,7 +554,7 @@ } status_t nbd_control(cookie_t *cookie, uint32 op, void *data, size_t len) { - PRINT((DP ">%s(%d, %lu, , %d)\n", __FUNCTION__, WHICH(cookie->dev), op, len)); + PRINT((DP ">%s(%d, %lu, , %ld)\n", __FUNCTION__, WHICH(cookie->dev), op, len)); switch (op) { case B_GET_DEVICE_SIZE: /* this one is broken anyway... */ if (data) { @@ -738,7 +760,9 @@ NULL }; +#if 0 #pragma mark ==== driver hooks ==== +#endif int32 api_version = B_CUR_DRIVER_API_VERSION; From stippi at mail.berlios.de Sun Jun 3 10:16:14 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 3 Jun 2007 10:16:14 +0200 Subject: [Haiku-commits] r21302 - haiku/trunk/src/kits/tracker Message-ID: <200706030816.l538GEIS007151@sheep.berlios.de> Author: stippi Date: 2007-06-03 10:16:13 +0200 (Sun, 03 Jun 2007) New Revision: 21302 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21302&view=rev Modified: haiku/trunk/src/kits/tracker/Utilities.cpp Log: * applied patch by Jonas Sundstr?\195?\182m, the draggable icon in the Find window will be drawn with alpha channel Modified: haiku/trunk/src/kits/tracker/Utilities.cpp =================================================================== --- haiku/trunk/src/kits/tracker/Utilities.cpp 2007-06-03 00:45:56 UTC (rev 21301) +++ haiku/trunk/src/kits/tracker/Utilities.cpp 2007-06-03 08:16:13 UTC (rev 21302) @@ -565,7 +565,12 @@ void DraggableIcon::Draw(BRect) { +#ifdef __HAIKU__ + SetDrawingMode(B_OP_ALPHA); + SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); +#else SetDrawingMode(B_OP_OVER); +#endif DrawBitmap(fBitmap); } @@ -662,8 +667,7 @@ } } loc.y = bounds.bottom - (1 + height.descent); - offscreen->MovePenTo(loc); - offscreen->DrawString(Text()); + offscreen->DrawString(Text(), loc); } offscreen->Sync(); SetDrawingMode(B_OP_COPY); From stippi at mail.berlios.de Sun Jun 3 10:18:34 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 3 Jun 2007 10:18:34 +0200 Subject: [Haiku-commits] r21303 - haiku/trunk/src/servers/registrar Message-ID: <200706030818.l538IYSH007261@sheep.berlios.de> Author: stippi Date: 2007-06-03 10:18:34 +0200 (Sun, 03 Jun 2007) New Revision: 21303 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21303&view=rev Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.cpp Log: * applied patch by Jonas Sundstr?\195?\182m, makes the Escape key cancel the restart/shutdown dialog Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.cpp =================================================================== --- haiku/trunk/src/servers/registrar/ShutdownProcess.cpp 2007-06-03 08:16:13 UTC (rev 21302) +++ haiku/trunk/src/servers/registrar/ShutdownProcess.cpp 2007-06-03 08:18:34 UTC (rev 21303) @@ -1232,6 +1232,7 @@ const char *buttonText = (fReboot ? "Restart" : "Shut Down"); BAlert *alert = new BAlert(title, text, "Cancel", buttonText, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->SetShortcut(0, B_ESCAPE); int32 result = alert->Go(); if (result != 1) From axeld at mail.berlios.de Sun Jun 3 14:36:39 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 3 Jun 2007 14:36:39 +0200 Subject: [Haiku-commits] r21304 - haiku/trunk/src/apps/expander Message-ID: <200706031236.l53CadfC016577@sheep.berlios.de> Author: axeld Date: 2007-06-03 14:36:39 +0200 (Sun, 03 Jun 2007) New Revision: 21304 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21304&view=rev Modified: haiku/trunk/src/apps/expander/DirectoryFilePanel.cpp haiku/trunk/src/apps/expander/DirectoryFilePanel.h Log: Minor cleanup. Modified: haiku/trunk/src/apps/expander/DirectoryFilePanel.cpp =================================================================== --- haiku/trunk/src/apps/expander/DirectoryFilePanel.cpp 2007-06-03 08:18:34 UTC (rev 21303) +++ haiku/trunk/src/apps/expander/DirectoryFilePanel.cpp 2007-06-03 12:36:39 UTC (rev 21304) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2006, Haiku, Inc. All Rights Reserved. + * Copyright 2004-2007, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -33,9 +33,9 @@ DirectoryFilePanel::DirectoryFilePanel(file_panel_mode mode, BMessenger *target, - const entry_ref *startDirectory, uint32 nodeFlavors, - bool allowMultipleSelection, BMessage *message, BRefFilter *filter, - bool modal, bool hideWhenDone) + const entry_ref *startDirectory, uint32 nodeFlavors, + bool allowMultipleSelection, BMessage *message, BRefFilter *filter, + bool modal, bool hideWhenDone) : BFilePanel(mode, target, startDirectory, nodeFlavors, allowMultipleSelection, message, filter, modal, hideWhenDone), fCurrentButton(NULL) @@ -60,13 +60,13 @@ rect.top = rect.bottom - 35; rect.bottom -= 10; } - + rect.right = rect.left -= 30; - float directory_width = be_plain_font->StringWidth("Select current") + 20; - rect.left = (directory_width > 75) ? (rect.right - directory_width) : (rect.right - 75); + float width = be_plain_font->StringWidth("Select current") + 20; + rect.left = width > 75 ? rect.right - width : rect.right - 75; fCurrentButton = new BButton(rect, "directoryButton", "Select current", new BMessage(MSG_DIRECTORY), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); - + background->AddChild(fCurrentButton); fCurrentButton->SetTarget(Messenger()); @@ -81,7 +81,7 @@ void -DirectoryFilePanel::SelectionChanged(void) +DirectoryFilePanel::SelectionChanged() { Window()->Lock(); Modified: haiku/trunk/src/apps/expander/DirectoryFilePanel.h =================================================================== --- haiku/trunk/src/apps/expander/DirectoryFilePanel.h 2007-06-03 08:18:34 UTC (rev 21303) +++ haiku/trunk/src/apps/expander/DirectoryFilePanel.h 2007-06-03 12:36:39 UTC (rev 21304) @@ -1,36 +1,18 @@ -/*****************************************************************************/ -// Expander -// Written by J?r?me Duval -// -// DirectoryFilePanel.h -// -// Copyright (c) 2004 OpenBeOS Project -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -/*****************************************************************************/ +/* + * Copyright 2004-2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * J?r?me Duval + */ +#ifndef _DIRECTORY_FILE_PANEL_H +#define _DIRECTORY_FILE_PANEL_H -#ifndef _DirectoryFilePanel_h -#define _DirectoryFilePanel_h #include #include + const uint32 MSG_DIRECTORY = 'mDIR'; @@ -41,20 +23,21 @@ const char *filetype); }; - class DirectoryFilePanel : public BFilePanel { public: DirectoryFilePanel(file_panel_mode mode = B_OPEN_PANEL, - BMessenger *target = 0, const entry_ref *start_directory = 0, - uint32 node_flavors = 0, bool allow_multiple_selection = true, - BMessage *message = 0, BRefFilter * = 0, - bool modal = false, bool hide_when_done = true); + BMessenger *target = NULL, const entry_ref *startDirectory = NULL, + uint32 nodeFlavors = 0, bool allowMultipleSelection = true, + BMessage *message = NULL, BRefFilter *filter = NULL, + bool modal = false, bool hideWhenDone = true); virtual ~DirectoryFilePanel() {}; - virtual void SelectionChanged(void); + + virtual void SelectionChanged(); virtual void Show(); + // overrides non-virtual BFilePanel::Show() protected: BButton *fCurrentButton; }; -#endif +#endif // _DIRECTORY_FILE_PANEL_H From stippi at mail.berlios.de Sun Jun 3 16:35:50 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 3 Jun 2007 16:35:50 +0200 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer Message-ID: <200706031435.l53EZo78001688@sheep.berlios.de> Author: stippi Date: 2007-06-03 16:35:48 +0200 (Sun, 03 Jun 2007) New Revision: 21305 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21305&view=rev Added: haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp haiku/trunk/src/apps/mediaplayer/PlaylistListView.h Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp haiku/trunk/src/apps/mediaplayer/Controller.h haiku/trunk/src/apps/mediaplayer/ControllerView.cpp haiku/trunk/src/apps/mediaplayer/Jamfile haiku/trunk/src/apps/mediaplayer/ListViews.cpp haiku/trunk/src/apps/mediaplayer/ListViews.h haiku/trunk/src/apps/mediaplayer/MainWin.cpp haiku/trunk/src/apps/mediaplayer/MainWin.h haiku/trunk/src/apps/mediaplayer/Playlist.cpp haiku/trunk/src/apps/mediaplayer/Playlist.h haiku/trunk/src/apps/mediaplayer/PlaylistWindow.cpp haiku/trunk/src/apps/mediaplayer/PlaylistWindow.h Log: * extraced PlaylistListView into it's own files * lots of changes, besically these make the Playlist window usable - drag sorting works (hold shift to copy instead of move items) - removing items with the delete key works - dragging files/folders from Tracker works (hold shift to insert them in the existing playlist, othewise the new files replace the playlist) * some refactoring and bug fixes in previously unused functionality * Playlist can now be locked (needed to be), and is in ControllerView, MainWin and PlaylistListView Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/Controller.cpp 2007-06-03 12:36:39 UTC (rev 21304) +++ haiku/trunk/src/apps/mediaplayer/Controller.cpp 2007-06-03 14:35:48 UTC (rev 21305) @@ -23,11 +23,10 @@ #include #include #include + +#include +#include #include -#include -#include -#include -#include #include #include @@ -87,6 +86,7 @@ , fStopped(true) , fVolume(1.0) + , fRef() , fMediaFile(0) // TODO: remove, InfoWin depends on it but should be fixed ,fAudioTrack(0) @@ -201,6 +201,11 @@ BAutolock al(fVideoSupplierLock); BAutolock vl(fAudioSupplierLock); + if (fRef == ref) + return B_OK; + + fRef = ref; + fAudioTrackList->MakeEmpty(); fVideoTrackList->MakeEmpty(); if (fMediaFile) @@ -466,6 +471,18 @@ } +void +Controller::TogglePlaying() +{ + BAutolock _(fDataLock); + + if (IsPaused() || IsStopped()) + Play(); + else + Pause(); +} + + bool Controller::IsPaused() const { Modified: haiku/trunk/src/apps/mediaplayer/Controller.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/Controller.h 2007-06-03 12:36:39 UTC (rev 21304) +++ haiku/trunk/src/apps/mediaplayer/Controller.h 2007-06-03 14:35:48 UTC (rev 21305) @@ -21,6 +21,7 @@ #ifndef __CONTROLLER_H #define __CONTROLLER_H +#include #include #include #include @@ -76,6 +77,7 @@ void Stop(); void Play(); void Pause(); + void TogglePlaying(); bool IsPaused() const; bool IsStopped() const; @@ -158,6 +160,7 @@ volatile bool fStopped; float fVolume; + entry_ref fRef; BMediaFile * fMediaFile; BMediaTrack * fAudioTrack; BMediaTrack * fVideoTrack; Modified: haiku/trunk/src/apps/mediaplayer/ControllerView.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/ControllerView.cpp 2007-06-03 12:36:39 UTC (rev 21304) +++ haiku/trunk/src/apps/mediaplayer/ControllerView.cpp 2007-06-03 14:35:48 UTC (rev 21305) @@ -20,6 +20,7 @@ */ #include "ControllerView.h" +#include #include #include #include @@ -91,18 +92,13 @@ void ControllerView::TogglePlaying() { - printf("ControllerView::TogglePlaying()\n"); - if (fController->IsPaused() || fController->IsStopped()) - fController->Play(); - else - fController->Pause(); + fController->TogglePlaying(); } void ControllerView::Stop() { - printf("ControllerView::Stop()\n"); fController->Stop(); } @@ -126,7 +122,7 @@ void ControllerView::SkipBackward() { - printf("ControllerView::SkipBackward()\n"); + BAutolock _(fPlaylist); fPlaylist->SetCurrentRefIndex(fPlaylist->CurrentRefIndex() - 1); } @@ -134,7 +130,7 @@ void ControllerView::SkipForward() { - printf("ControllerView::SkipForward()\n"); + BAutolock _(fPlaylist); fPlaylist->SetCurrentRefIndex(fPlaylist->CurrentRefIndex() + 1); } @@ -142,7 +138,6 @@ void ControllerView::VolumeChanged(float value) { - printf("ControllerView::VolumeChanged(%.4f)\n", value); fController->SetVolume(value); } @@ -157,7 +152,6 @@ void ControllerView::PositionChanged(float value) { - printf("ControllerView::PositionChanged(%.2f)\n", value); // 0.0 ... 1.0 fController->SetPosition(value); } @@ -169,6 +163,8 @@ void ControllerView::CheckSkippable() { + BAutolock _(fPlaylist); + bool canSkipNext, canSkipPrevious; fPlaylist->GetSkipInfo(&canSkipPrevious, &canSkipNext); SetSkippable(canSkipPrevious, canSkipNext); Modified: haiku/trunk/src/apps/mediaplayer/Jamfile =================================================================== --- haiku/trunk/src/apps/mediaplayer/Jamfile 2007-06-03 12:36:39 UTC (rev 21304) +++ haiku/trunk/src/apps/mediaplayer/Jamfile 2007-06-03 14:35:48 UTC (rev 21305) @@ -32,6 +32,7 @@ MainApp.cpp MainWin.cpp Playlist.cpp + PlaylistListView.cpp PlaylistObserver.cpp PlaylistWindow.cpp SoundOutput.cpp Modified: haiku/trunk/src/apps/mediaplayer/ListViews.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/ListViews.cpp 2007-06-03 12:36:39 UTC (rev 21304) +++ haiku/trunk/src/apps/mediaplayer/ListViews.cpp 2007-06-03 14:35:48 UTC (rev 21305) @@ -320,21 +320,20 @@ { if (AcceptDragMessage(message)) { DragSortableListView *list = NULL; - if ( message->FindPointer( "list", (void **)&list ) == B_OK - && list == this ) { + if (message->FindPointer("list", (void **)&list) == B_OK + && list == this) { int32 count = CountItems(); - if ( fDropIndex < 0 || fDropIndex > count ) + if (fDropIndex < 0 || fDropIndex > count) fDropIndex = count; - BList items; + BList indices; int32 index; - for ( int32 i = 0; message->FindInt32( "index", i, &index ) == B_OK; i++ ) - if ( BListItem* item = ItemAt(index) ) - items.AddItem( (void*)item ); - if ( items.CountItems() > 0 ) { - if ( modifiers() & B_SHIFT_KEY ) - CopyItems( items, fDropIndex ); + for (int32 i = 0; message->FindInt32("index", i, &index) == B_OK; i++) + indices.AddItem((void*)index); + if (indices.CountItems() > 0) { + if (modifiers() & B_SHIFT_KEY) + CopyItems(indices, fDropIndex); else - MoveItems( items, fDropIndex ); + MoveItems(indices, fDropIndex); } fDropIndex = -1; } @@ -371,9 +370,9 @@ } break; } -// case B_MODIFIERS_CHANGED: -// ModifiersChanged(); -// break; + case B_MODIFIERS_CHANGED: + ModifiersChanged(); + break; case B_MOUSE_WHEEL_CHANGED: { BListView::MessageReceived( message ); BPoint point; @@ -625,42 +624,39 @@ // MoveItems void -DragSortableListView::MoveItems( BList& items, int32 index ) +DragSortableListView::MoveItems(BList& indices, int32 index) { DeselectAll(); // we remove the items while we look at them, the insertion index is decreased // when the items index is lower, so that we insert at the right spot after // removal BList removedItems; - int32 count = items.CountItems(); - for ( int32 i = 0; i < count; i++ ) - { - BListItem* item = (BListItem*)items.ItemAt( i ); - int32 removeIndex = IndexOf( item ); - if ( RemoveItem( item ) && removedItems.AddItem( (void*)item ) ) - { - if ( removeIndex < index ) + int32 count = indices.CountItems(); + for (int32 i = 0; i < count; i++) { + int32 removeIndex = (int32)indices.ItemAtFast(i) - i; + BListItem* item = RemoveItem(removeIndex); + if (item && removedItems.AddItem((void*)item)) { + if (removeIndex < index) index--; } // else ??? -> blow up } - for ( int32 i = 0; BListItem* item = (BListItem*)removedItems.ItemAt( i ); i++ ) - { - if ( AddItem( item, index ) ) - { + count = removedItems.CountItems(); + for (int32 i = 0; i < count; i++) { + BListItem* item = (BListItem*)removedItems.ItemAtFast(i); + if (AddItem(item, index)) { // after we're done, the newly inserted items will be selected - Select( index, true ); + Select(index, true); // next items will be inserted after this one index++; - } - else + } else delete item; } } // CopyItems void -DragSortableListView::CopyItems( BList& items, int32 index ) +DragSortableListView::CopyItems(BList& indices, int32 toIndex) { DeselectAll(); // by inserting the items after we copied all items first, we avoid @@ -668,37 +664,34 @@ // in other words, don't touch the list before we know which items // need to be cloned BList clonedItems; - int32 count = items.CountItems(); - for ( int32 i = 0; i < count; i++ ) - { - BListItem* item = CloneItem( IndexOf( (BListItem*)items.ItemAt( i ) ) ); - if ( item && !clonedItems.AddItem( (void*)item ) ) + int32 count = indices.CountItems(); + for (int32 i = 0; i < count; i++) { + int32 index = (int32)indices.ItemAtFast(i); + BListItem* item = CloneItem(index); + if (item && !clonedItems.AddItem((void*)item)) delete item; } - for ( int32 i = 0; BListItem* item = (BListItem*)clonedItems.ItemAt( i ); i++ ) - { - if ( AddItem( item, index ) ) - { + count = clonedItems.CountItems(); + for (int32 i = 0; i < count; i++) { + BListItem* item = (BListItem*)clonedItems.ItemAtFast(i); + if (AddItem(item, toIndex)) { // after we're done, the newly inserted items will be selected - Select( index, true ); + Select(toIndex, true); // next items will be inserted after this one - index++; - } - else + toIndex++; + } else delete item; } } // RemoveItemList void -DragSortableListView::RemoveItemList( BList& items ) +DragSortableListView::RemoveItemList(BList& indices) { - int32 count = items.CountItems(); - for ( int32 i = 0; i < count; i++ ) - { - BListItem* item = (BListItem*)items.ItemAt( i ); - if ( RemoveItem( item ) ) - delete item; + int32 count = indices.CountItems(); + for (int32 i = 0; i < count; i++) { + int32 index = (int32)indices.ItemAtFast(i) - i; + delete RemoveItem(index); } } @@ -706,13 +699,19 @@ void DragSortableListView::RemoveSelected() { -// if (fFocusedIndex >= 0) -// return; + BList indices; + for (int32 i = 0; true; i++) { + int32 index = CurrentSelection(i); + if (index < 0) + break; + if (!indices.AddItem((void*)index)) + break; + } - BList items; - for ( int32 i = 0; BListItem* item = ItemAt( CurrentSelection( i ) ); i++ ) - items.AddItem( (void*)item ); - RemoveItemList( items ); + DeselectAll(); + + if (indices.CountItems() > 0) + RemoveItemList(indices); } // CountSelectedItems @@ -720,7 +719,7 @@ DragSortableListView::CountSelectedItems() const { int32 count = 0; - while ( CurrentSelection( count ) >= 0 ) + while (CurrentSelection(count) >= 0) count++; return count; } Modified: haiku/trunk/src/apps/mediaplayer/ListViews.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/ListViews.h 2007-06-03 12:36:39 UTC (rev 21304) +++ haiku/trunk/src/apps/mediaplayer/ListViews.h 2007-06-03 14:35:48 UTC (rev 21305) @@ -89,8 +89,8 @@ bool MouseWheelChanged(float x, float y); - virtual void MoveItems(BList& items, int32 toIndex); - virtual void CopyItems(BList& items, int32 toIndex); + virtual void MoveItems(BList& indices, int32 toIndex); + virtual void CopyItems(BList& indices, int32 toIndex); virtual void RemoveItemList(BList& indices); void RemoveSelected(); // uses RemoveItemList() int32 CountSelectedItems() const; Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2007-06-03 12:36:39 UTC (rev 21304) +++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2007-06-03 14:35:48 UTC (rev 21305) @@ -20,25 +20,27 @@ */ #include "MainWin.h" -#include -#include +#include +#include +#include + +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include #include #include +#include #include -#include -#include +#include #include "ControllerObserver.h" +#include "MainApp.h" #include "PlaylistObserver.h" #include "PlaylistWindow.h" -#include "MainApp.h" #define NAME "MediaPlayer" #define MIN_WIDTH 250 @@ -317,7 +319,6 @@ // PlaylistObserver messages case MSG_PLAYLIST_REF_ADDED: { -printf("MSG_PLAYLIST_REF_ADDED\n"); entry_ref ref; int32 index; if (msg->FindRef("refs", &ref) == B_OK @@ -327,7 +328,6 @@ break; } case MSG_PLAYLIST_REF_REMOVED: { -printf("MSG_PLAYLIST_REF_REMOVED\n"); int32 index; if (msg->FindInt32("index", &index) == B_OK) { _RemovePlaylistItem(index); @@ -335,12 +335,12 @@ break; } case MSG_PLAYLIST_CURRENT_REF_CHANGED: { -printf("MSG_PLAYLIST_CURRENT_REF_CHANGED\n"); + BAutolock _(fPlaylist); + int32 index; if (msg->FindInt32("index", &index) < B_OK || index != fPlaylist->CurrentRefIndex()) break; -printf(" index: %ld\n", index); entry_ref ref; if (fPlaylist->GetRefAt(index, &ref) == B_OK) { printf("open ref: %s\n", ref.name); @@ -352,7 +352,6 @@ // ControllerObserver messages case MSG_CONTROLLER_FILE_FINISHED: -printf("MSG_CONTROLLER_FILE_FINISHED\n"); fPlaylist->SetCurrentRefIndex(fPlaylist->CurrentRefIndex() + 1); break; case MSG_CONTROLLER_FILE_CHANGED: @@ -686,7 +685,7 @@ { if (!fPlaylistWindow) { fPlaylistWindow = new PlaylistWindow(BRect(150, 150, 400, 500), - fPlaylist); + fPlaylist, fController); fPlaylistWindow->Show(); return; } @@ -731,34 +730,13 @@ void MainWin::_RefsReceived(BMessage *msg) { - printf("MainWin::_RefsReceived\n"); - // the playlist ist replaced by dropped files // or the dropped files are appended to the end // of the existing playlist if is pressed - bool add = modifiers() & B_SHIFT_KEY; + int32 appendIndex = modifiers() & B_SHIFT_KEY ? + fPlaylist->CountItems() : -1; - if (!add) - fPlaylist->MakeEmpty(); - - bool startPlaying = fPlaylist->CountItems() == 0; - - Playlist temporaryPlaylist; - Playlist* playlist = add ? &temporaryPlaylist : fPlaylist; - - entry_ref ref; - for (int i = 0; B_OK == msg->FindRef("refs", i, &ref); i++) - _AppendToPlaylist(ref, playlist); - - playlist->Sort(); - - if (add) - fPlaylist->AdoptPlaylist(temporaryPlaylist); - - if (startPlaying) { - // open first file - fPlaylist->SetCurrentRefIndex(0); - } + fPlaylist->AppendRefs(msg, appendIndex); } @@ -1414,10 +1392,11 @@ void MainWin::_UpdatePlaylistMenu() { + if (!fPlaylist->Lock()) + return; + fPlaylistMenu->RemoveItems(0, fPlaylistMenu->CountItems(), true); - // TODO: lock fPlaylist - int32 count = fPlaylist->CountItems(); for (int32 i = 0; i < count; i++) { entry_ref ref; @@ -1428,6 +1407,8 @@ fPlaylistMenu->SetTargetForItems(this); _MarkPlaylistItem(fPlaylist->CurrentRefIndex()); + + fPlaylist->Unlock(); } @@ -1462,25 +1443,3 @@ } -void -MainWin::_AppendToPlaylist(const entry_ref& ref, Playlist* playlist) -{ - // recursively append the ref (dive into folders) - BEntry entry(&ref, true); - if (entry.InitCheck() < B_OK) - return; - if (!entry.Exists()) - return; - if (entry.IsDirectory()) { - BDirectory dir(&entry); - if (dir.InitCheck() < B_OK) - return; - entry.Unset(); - entry_ref subRef; - while (dir.GetNextRef(&subRef) == B_OK) - _AppendToPlaylist(subRef, playlist); - } else if (entry.IsFile()) { - playlist->AddRef(ref); - } -} - Modified: haiku/trunk/src/apps/mediaplayer/MainWin.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainWin.h 2007-06-03 12:36:39 UTC (rev 21304) +++ haiku/trunk/src/apps/mediaplayer/MainWin.h 2007-06-03 14:35:48 UTC (rev 21305) @@ -91,8 +91,6 @@ int32 index); void _RemovePlaylistItem(int32 index); void _MarkPlaylistItem(int32 index); - void _AppendToPlaylist(const entry_ref& ref, - Playlist* playlist); BMenuBar* fMenuBar; BView* fBackground; Modified: haiku/trunk/src/apps/mediaplayer/Playlist.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/Playlist.cpp 2007-06-03 12:36:39 UTC (rev 21304) +++ haiku/trunk/src/apps/mediaplayer/Playlist.cpp 2007-06-03 14:35:48 UTC (rev 21305) @@ -25,6 +25,9 @@ #include #include +#include +#include +#include #include using std::nothrow; @@ -43,7 +46,8 @@ Playlist::Playlist() - : fRefs() + : BLocker("playlist lock") + , fRefs() , fCurrentIndex(-1) { } @@ -104,6 +108,10 @@ return false; } _NotifyRefAdded(ref, index); + + if (index <= fCurrentIndex) + SetCurrentRefIndex(fCurrentIndex + 1); + return true; } @@ -129,6 +137,8 @@ entry_ref* ref = (entry_ref*)fRefs.ItemAtFast(i); _NotifyRefAdded(*ref, i); } + if (index <= fCurrentIndex) + SetCurrentRefIndex(fCurrentIndex + count); // empty the other list, so that the entry_refs are no ours other.fRefs.MakeEmpty(); return true; @@ -138,7 +148,7 @@ entry_ref -Playlist::RemoveRef(int32 index) +Playlist::RemoveRef(int32 index, bool careAboutCurrentIndex) { entry_ref _ref; entry_ref* ref = (entry_ref*)fRefs.RemoveItem(index); @@ -147,21 +157,29 @@ _NotifyRefRemoved(index); _ref = *ref; delete ref; + + if (careAboutCurrentIndex) { + if (index == fCurrentIndex) + SetCurrentRefIndex(-1); + else if (index < fCurrentIndex) + SetCurrentRefIndex(fCurrentIndex - 1); + } + return _ref; } -//int32 -//Playlist::IndexOf(const entry_ref& _ref) const -//{ -// int32 count = CountItems(); -// for (int32 i = 0; i < count; i++) { -// entry_ref* ref = (entry_ref*)fRefs.ItemAtFast(i); -// if (*ref == _ref) -// return i; -// } -// return -1; -//} +int32 +Playlist::IndexOf(const entry_ref& _ref) const +{ + int32 count = CountItems(); + for (int32 i = 0; i < count; i++) { + entry_ref* ref = (entry_ref*)fRefs.ItemAtFast(i); + if (*ref == _ref) + return i; + } + return -1; +} status_t @@ -223,6 +241,7 @@ bool Playlist::AddListener(Listener* listener) { + BAutolock _(this); if (listener && !fListeners.HasItem(listener)) return fListeners.AddItem(listener); return false; @@ -232,6 +251,7 @@ void Playlist::RemoveListener(Listener* listener) { + BAutolock _(this); fListeners.RemoveItem(listener); } @@ -239,6 +259,64 @@ // #pragma mark - +void +Playlist::AppendRefs(BMessage* refsReceivedMessage, int32 appendIndex) +{ + // the playlist ist replaced by the refs in the message + // or the refs are appended at the appendIndex + // in the existing playlist + bool add = appendIndex >= 0; + + if (!add) + MakeEmpty(); + + bool startPlaying = CountItems() == 0; + + Playlist temporaryPlaylist; + Playlist* playlist = add ? &temporaryPlaylist : this; + + entry_ref ref; + for (int i = 0; refsReceivedMessage->FindRef("refs", i, &ref) == B_OK; i++) + AppendToPlaylistRecursive(ref, playlist); + + playlist->Sort(); + + if (add) + AdoptPlaylist(temporaryPlaylist, appendIndex); + + if (startPlaying) { + // open first file + SetCurrentRefIndex(0); + } +} + + +/*static*/ void +Playlist::AppendToPlaylistRecursive(const entry_ref& ref, Playlist* playlist) +{ + // recursively append the ref (dive into folders) + BEntry entry(&ref, true); + if (entry.InitCheck() < B_OK) + return; + if (!entry.Exists()) + return; + if (entry.IsDirectory()) { + BDirectory dir(&entry); + if (dir.InitCheck() < B_OK) + return; + entry.Unset(); + entry_ref subRef; + while (dir.GetNextRef(&subRef) == B_OK) + AppendToPlaylistRecursive(subRef, playlist); + } else if (entry.IsFile()) { + playlist->AddRef(ref); + } +} + + +// #pragma mark - + + int Playlist::playlist_cmp(const void *p1, const void *p2) { Modified: haiku/trunk/src/apps/mediaplayer/Playlist.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/Playlist.h 2007-06-03 12:36:39 UTC (rev 21304) +++ haiku/trunk/src/apps/mediaplayer/Playlist.h 2007-06-03 14:35:48 UTC (rev 21305) @@ -23,8 +23,9 @@ #include #include +#include -class Playlist { +class Playlist : public BLocker { public: class Listener { public: @@ -40,51 +41,58 @@ }; public: - Playlist(); - ~Playlist(); - - // list functionality - void MakeEmpty(); - int32 CountItems() const; - - void Sort(); + Playlist(); + ~Playlist(); + + // list functionality + void MakeEmpty(); + int32 CountItems() const; + + void Sort(); + + bool AddRef(const entry_ref& ref); + bool AddRef(const entry_ref& ref, int32 index); + entry_ref RemoveRef(int32 index, + bool careAboutCurrentIndex = true); + + bool AdoptPlaylist(Playlist& other); + bool AdoptPlaylist(Playlist& other, int32 index); + + int32 IndexOf(const entry_ref& ref) const; + status_t GetRefAt(int32 index, entry_ref* ref) const; + // bool HasRef(const entry_ref& ref) const; + + // navigating current ref + void SetCurrentRefIndex(int32 index); + int32 CurrentRefIndex() const; + + void GetSkipInfo(bool* canSkipPrevious, + bool* canSkipNext) const; - bool AddRef(const entry_ref& ref); - bool AddRef(const entry_ref& ref, int32 index); - entry_ref RemoveRef(int32 index); + // listener support + bool AddListener(Listener* listener); + void RemoveListener(Listener* listener); - bool AdoptPlaylist(Playlist& other); - bool AdoptPlaylist(Playlist& other, int32 index); + // support functions + void AppendRefs(BMessage* refsReceivedMessage, + int32 appendIndex = -1); + static void AppendToPlaylistRecursive(const entry_ref& ref, + Playlist* playlist); -// int32 IndexOf(const entry_ref& ref) const; - status_t GetRefAt(int32 index, entry_ref* ref) const; -// bool HasRef(const entry_ref& ref) const; - - // navigating current ref - void SetCurrentRefIndex(int32 index); - int32 CurrentRefIndex() const; - - void GetSkipInfo(bool* canSkipPrevious, - bool* canSkipNext) const; - - // listener support - bool AddListener(Listener* listener); - void RemoveListener(Listener* listener); - private: - static int playlist_cmp(const void* p1, const void* p2); + static int playlist_cmp(const void* p1, const void* p2); - void _NotifyRefAdded(const entry_ref& ref, - int32 index) const; - void _NotifyRefRemoved(int32 index) const; - void _NotifyRefsSorted() const; - void _NotifyCurrentRefChanged(int32 newIndex) const; + void _NotifyRefAdded(const entry_ref& ref, + int32 index) const; + void _NotifyRefRemoved(int32 index) const; + void _NotifyRefsSorted() const; + void _NotifyCurrentRefChanged(int32 newIndex) const; private: - BList fRefs; - BList fListeners; + BList fRefs; + BList fListeners; - int32 fCurrentIndex; + int32 fCurrentIndex; }; #endif Added: haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp 2007-06-03 12:36:39 UTC (rev 21304) +++ haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp 2007-06-03 14:35:48 UTC (rev 21305) @@ -0,0 +1,502 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ +#include "PlaylistListView.h" + +#include +#include + +#include +#include +#include +#include +#include + +#include "Controller.h" +#include "ControllerObserver.h" +#include "ListViews.h" +#include "PlaybackState.h" +#include "Playlist.h" +#include "PlaylistObserver.h" + +using std::nothrow; + + +enum { + DISPLAY_NAME = 0, + DISPLAY_PATH = 1 +}; + + +static float +playback_mark_size(const font_height& fh) +{ + return ceilf(fh.ascent * 0.7); +} + + +static float +text_offset(const font_height& fh) +{ + return ceilf(fh.ascent * 0.8); +} + + +class PlaylistItem : public SimpleItem { + public: + PlaylistItem(const entry_ref& ref); + virtual ~PlaylistItem(); + + void Draw(BView* owner, BRect frame, + const font_height& fh, + bool tintedLine, uint32 mode, + bool active, + uint32 playbackState); + + private: + entry_ref fRef; + +}; + + +PlaylistItem::PlaylistItem(const entry_ref& ref) + : SimpleItem(ref.name), + fRef(ref) +{ +} + + +PlaylistItem::~PlaylistItem() +{ +} + + +void +PlaylistItem::Draw(BView* owner, BRect frame, const font_height& fh, + bool tintedLine, uint32 mode, bool active, uint32 playbackState) +{ + rgb_color color = (rgb_color){ 255, 255, 255, 255 }; + if (tintedLine) + color = tint_color(color, 1.04); + // background + if (IsSelected()) + color = tint_color(color, B_DARKEN_2_TINT); + owner->SetLowColor(color); + owner->FillRect(frame, B_SOLID_LOW); + // label + rgb_color black = (rgb_color){ 0, 0, 0, 255 }; + owner->SetHighColor(black); + const char* text = Text(); + switch (mode) { + case DISPLAY_NAME: + // TODO + break; + case DISPLAY_PATH: + // TODO + break; + default: + break; + } + + float playbackMarkSize = playback_mark_size(fh); + float textOffset = text_offset(fh); + + BString truncatedString(text); + owner->TruncateString(&truncatedString, B_TRUNCATE_MIDDLE, + frame.Width() - playbackMarkSize - textOffset); + owner->DrawString(truncatedString.String(), + BPoint(frame.left + playbackMarkSize + textOffset, + floorf(frame.top + frame.bottom + fh.ascent) / 2 - 1)); + + // playmark + if (active) { + rgb_color green = (rgb_color){ 0, 255, 0, 255 }; + if (playbackState != PLAYBACK_STATE_PLAYING) + green = tint_color(color, B_DARKEN_1_TINT); + + BRect r(0, 0, playbackMarkSize, playbackMarkSize); + r.OffsetTo(frame.left + 4, + ceilf((frame.top + frame.bottom) / 2) - 5); + + BPoint arrow[3]; + arrow[0] = r.LeftTop(); [... truncated: 667 lines follow ...] From axeld at pinc-software.de Sun Jun 3 16:57:45 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Sun, 03 Jun 2007 16:57:45 +0200 CEST Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <200706031435.l53EZo78001688@sheep.berlios.de> Message-ID: <16422146379-BeMail@zon> stippi at BerliOS wrote: > - dragging files/folders from Tracker works (hold shift to insert > them in the existing playlist, othewise the new files replace > the playlist) Isn't that contrary to what one would expect when dropping a file into the playlist directly (and not in the player window)? Bye, Axel. From superstippi at gmx.de Sun Jun 3 17:11:38 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 03 Jun 2007 17:11:38 +0200 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <16422146379-BeMail@zon> References: <16422146379-BeMail@zon> Message-ID: <20070603171138.10591.10@stippis.WG> Axel D?rfler wrote (2007-06-03, 16:57:45 [+0200]): > stippi at BerliOS wrote: > > - dragging files/folders from Tracker works (hold shift to insert > > them in the existing playlist, othewise the new files replace > > the playlist) > > Isn't that contrary to what one would expect when dropping a file into > the playlist directly (and not in the player window)? I would think not, because it would be inconsistent. But I have no hard opinion on this. Best regards, -Stephan From stippi at mail.berlios.de Sun Jun 3 17:18:32 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 3 Jun 2007 17:18:32 +0200 Subject: [Haiku-commits] r21306 - haiku/trunk/src/apps/mediaplayer Message-ID: <200706031518.l53FIWLW005287@sheep.berlios.de> Author: stippi Date: 2007-06-03 17:18:31 +0200 (Sun, 03 Jun 2007) New Revision: 21306 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21306&view=rev Modified: haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp Log: * fix stupid bug that prevented the playlist to be seen at all in Haiku Modified: haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp 2007-06-03 14:35:48 UTC (rev 21305) +++ haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp 2007-06-03 15:18:31 UTC (rev 21306) @@ -188,7 +188,7 @@ fController->AddListener(fControllerObserver); #ifdef __HAIKU__ - SetFlags(Flags() & B_SUBPIXEL_PRECISE); + SetFlags(Flags() | B_SUBPIXEL_PRECISE); #endif } From bonefish at mail.berlios.de Sun Jun 3 18:25:35 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 3 Jun 2007 18:25:35 +0200 Subject: [Haiku-commits] r21307 - buildtools/trunk/jam Message-ID: <200706031625.l53GPZgo012180@sheep.berlios.de> Author: bonefish Date: 2007-06-03 18:25:35 +0200 (Sun, 03 Jun 2007) New Revision: 21307 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21307&view=rev Modified: buildtools/trunk/jam/StatCacheServer.cpp buildtools/trunk/jam/StatCacheServerImpl.h Log: StatCacheServer changes: * A Node can no longer have a referring "." or ".." Entry (except the root directory), not even temporarily. This rules out cycles when resolving paths. * Made the code more robust against missed node monitoring messages. If an entry is encountered that shouldn't be there, it is removed. As implemented before, a Node could end up with a NULL referring Entry, leading to a crash when an Entry that references the Node was moved. Missing node monitoring messages is actually virtually impossible, since a dedicated looper does nothing else but pushing those into a separate queue, but nevertheless Stippi seems to have managed the trick. :-) Modified: buildtools/trunk/jam/StatCacheServer.cpp =================================================================== --- buildtools/trunk/jam/StatCacheServer.cpp 2007-06-03 15:18:31 UTC (rev 21306) +++ buildtools/trunk/jam/StatCacheServer.cpp 2007-06-03 16:25:35 UTC (rev 21307) @@ -18,7 +18,7 @@ //#define DBG(x) { x; } #define DBG(x) -#define OUT printf +#define OUT(format...) {printf(format); fflush(stdout);} static const int32 kMaxSymlinks = 32; @@ -29,6 +29,14 @@ // private BeOS syscall to set the node monitor slot limits extern "C" int _kset_mon_limit_(int num); +static inline bool +is_dot_or_dotdot(const char* name) +{ + if (name && name[0] == '.') + return (name[1] == '\0' || name[1] == '.' && name[2] == '\0'); + return false; +} + // get_dirent_size static inline int32 @@ -138,7 +146,7 @@ fNode = node; if (fNode) { fNode->AddReference(); - if (!fNode->GetEntry()) + if (!fNode->GetEntry() && !is_dot_or_dotdot(fName.c_str())) fNode->SetEntry(this); } } @@ -379,7 +387,7 @@ { entry_ref ref(fStat.st_dev, fStat.st_ino, name); if (!fIsComplete) - return NodeManager::GetDefault()->CreateEntry(ref, entry); + return NodeManager::GetDefault()->CreateEntry(ref, NULL, entry); *entry = NodeManager::GetDefault()->GetEntry(ref); return (*entry ? B_OK : B_ENTRY_NOT_FOUND); } @@ -869,9 +877,19 @@ // CreateEntry status_t -NodeManager::CreateEntry(const entry_ref &entryRef, Entry **_entry) +NodeManager::CreateEntry(const entry_ref &entryRef, const node_ref *nodeRef, + Entry **_entry) { Entry *entry = GetEntry(entryRef); + + // If the entry is known, but its node is not the one it should be, we + // remove the entry. + if (nodeRef && entry && entry->GetNode() + && entry->GetNode()->GetNodeRef() != *nodeRef) { + RemoveEntry(entry); + entry = NULL; + } + if (!entry) { // entry does not yet exist -- create it @@ -901,8 +919,22 @@ delete entry; return error; } + + // If the node already existed, but points to another entry, we + // remove that entry now. We probably missed the respective + // B_ENTRY_REMOVED notification. + if (node->GetEntry() && node->GetEntry() != entry + && !is_dot_or_dotdot(entry->GetName())) { + RemoveEntry(node->GetEntry()); + + // reinit node watching + StopWatching(node); + StartWatching(node); + } + entry->SetNode(node); node->RemoveReference(); + // reference acquired by _CreateNode() // initialization successful: add the entry to the dir and to the // entry map @@ -985,7 +1017,8 @@ // MoveEntry void -NodeManager::MoveEntry(Entry *entry, const entry_ref &newRef) +NodeManager::MoveEntry(Entry *entry, const entry_ref &newRef, + const node_ref &nodeRef) { // get the target directory node_ref newDirRef; @@ -998,18 +1031,19 @@ return; } - // If the directory and/or the name changed, we remove the old entry and - // create a new one. + // If the directory, the name, or the node (missed B_ENTRY_REMOVED and + // B_ENTRY_CREATED) changed, we remove the old entry and create a new one. + Node *node = entry->GetNode(); if (newDir != entry->GetParent() - || strcmp(newRef.name, entry->GetName()) != 0) { + || strcmp(newRef.name, entry->GetName()) != 0 + || (node && node->GetNodeRef() != nodeRef)) { // get a temporary reference to the node, so it won't be unnecessarily // deleted - Node *node = entry->GetNode(); if (node) node->AddReference(); RemoveEntry(entry); - CreateEntry(newRef, &entry); + CreateEntry(newRef, &nodeRef, &entry); if (node) node->RemoveReference(); @@ -1141,13 +1175,15 @@ { // get the info node_ref dirNodeRef; + node_ref nodeRef; const char* name; if (message->FindInt32("device", &dirNodeRef.device) != B_OK || message->FindInt64("directory", &dirNodeRef.node) != B_OK -// || message->FindInt64("node", &nodeID) != B_OK + || message->FindInt64("node", &nodeRef.node) != B_OK || message->FindString("name", &name) != B_OK) { return; } + nodeRef.device = dirNodeRef.device; // get the directory Node *node = NodeManager::GetDefault()->GetNode(dirNodeRef); @@ -1160,7 +1196,7 @@ Entry *entry; if (dir->FindEntry(name, &entry) != B_OK) { entry_ref ref(dirNodeRef.device, dirNodeRef.node, name); - NodeManager::GetDefault()->CreateEntry(ref, &entry); + NodeManager::GetDefault()->CreateEntry(ref, &nodeRef, &entry); } } } @@ -1209,13 +1245,13 @@ // create it if not present Entry *entry; entry_ref newRef(nodeRef.device, newDirID, name); - NodeManager::GetDefault()->CreateEntry(newRef, &entry); + NodeManager::GetDefault()->CreateEntry(newRef, &nodeRef, &entry); return; } // move it entry_ref newRef(nodeRef.device, newDirID, name); - NodeManager::GetDefault()->MoveEntry(node->GetEntry(), newRef); + NodeManager::GetDefault()->MoveEntry(node->GetEntry(), newRef, nodeRef); } // _StatChanged Modified: buildtools/trunk/jam/StatCacheServerImpl.h =================================================================== --- buildtools/trunk/jam/StatCacheServerImpl.h 2007-06-03 15:18:31 UTC (rev 21306) +++ buildtools/trunk/jam/StatCacheServerImpl.h 2007-06-03 16:25:35 UTC (rev 21307) @@ -225,11 +225,13 @@ Node *GetNode(const node_ref &nodeRef); Entry *GetEntry(const entry_ref &entryRef); - status_t CreateEntry(const entry_ref &entryRef, Entry **_entry); + status_t CreateEntry(const entry_ref &entryRef, const node_ref *nodeRef, + Entry **_entry); status_t CreateDirectory(const node_ref &nodeRef, Directory **_dir); void RemoveEntry(Entry *entry); - void MoveEntry(Entry *entry, const entry_ref &newRef); + void MoveEntry(Entry *entry, const entry_ref &newRef, + const node_ref &nodeRef); void EntryUnreferenced(Entry *entry); void NodeUnreferenced(Node *node); From leavengood at gmail.com Sun Jun 3 18:31:08 2007 From: leavengood at gmail.com (Ryan Leavengood) Date: Sun, 3 Jun 2007 12:31:08 -0400 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <20070603171138.10591.10@stippis.WG> References: <16422146379-BeMail@zon> <20070603171138.10591.10@stippis.WG> Message-ID: On 6/3/07, Stephan Assmus wrote: > > Axel D?rfler wrote (2007-06-03, 16:57:45 [+0200]): > > stippi at BerliOS wrote: > > > - dragging files/folders from Tracker works (hold shift to insert > > > them in the existing playlist, othewise the new files replace > > > the playlist) > > > > Isn't that contrary to what one would expect when dropping a file into > > the playlist directly (and not in the player window)? > > I would think not, because it would be inconsistent. But I have no hard > opinion on this. I think the replace operation should require the shift. A user would not expect their whole playlist to be replaced by dragging in some new files. Clearing out a meticulously built playlist after a drag and drop could really anger a user (I know I would be upset.) I would be surprised if any media players behave like this change. It may seem inconsistent but it makes sense that dragging files onto the media player itself replaces the current playing file, whereas dragging onto a playlist should always append to the playlist, not replace it. Ryan From superstippi at gmx.de Sun Jun 3 19:33:53 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 03 Jun 2007 19:33:53 +0200 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: References: <16422146379-BeMail@zon> <20070603171138.10591.10@stippis.WG> Message-ID: <20070603193353.424.1@stippis.WG> Ryan Leavengood wrote (2007-06-03, 18:31:08 [+0200]): > On 6/3/07, Stephan Assmus wrote: > > > > Axel D?rfler wrote (2007-06-03, 16:57:45 [+0200]): > > > stippi at BerliOS wrote: > > > > - dragging files/folders from Tracker works (hold shift to insert > > > > them in the existing playlist, othewise the new files replace > > > > the playlist) > > > > > > Isn't that contrary to what one would expect when dropping a file into > > > the playlist directly (and not in the player window)? > > > > I would think not, because it would be inconsistent. But I have no hard > > opinion on this. > > I think the replace operation should require the shift. A user would > not expect their whole playlist to be replaced by dragging in some new > files. Clearing out a meticulously built playlist after a drag and > drop could really anger a user (I know I would be upset.) > > I would be surprised if any media players behave like this change. Well... ok then. But I find it weird that holding down shift has just the opposite effect, depending wether you drop files on the Playlist window, or on the Player window. Both windows open side by side. Clearly, changing the way dropping on the Player window works, would be even more confusing. So I was under the impression that having it consistent is more important. Plus "shift" is usually associated with "extend" when used together with mouse clicks (like for example when selecting). But if every other media player on the world does it the other way around, I give up. :-) > It may seem inconsistent but it makes sense that dragging files onto > the media player itself replaces the current playing file, whereas > dragging onto a playlist should always append to the playlist, not > replace it. Whatever we end up with, I am strongly considering having an Undo/Redo stack for operations in the Playlist window anyways. I know how frustrating it can be to lose changes on a complicated playlist. Best regards, -Stephan From bonefish at cs.tu-berlin.de Sun Jun 3 20:15:27 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Sun, 03 Jun 2007 20:15:27 +0200 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <20070603193353.424.1@stippis.WG> References: <16422146379-BeMail@zon> <20070603171138.10591.10@stippis.WG> <20070603193353.424.1@stippis.WG> Message-ID: <20070603201527.17504.9@cs.tu-berlin.de> On 2007-06-03 at 19:33:53 [+0200], Stephan Assmus wrote: > > Ryan Leavengood wrote (2007-06-03, 18:31:08 [+0200]): > > On 6/3/07, Stephan Assmus wrote: > > > > > > Axel D?rfler wrote (2007-06-03, 16:57:45 [+0200]): > > > > stippi at BerliOS wrote: > > > > > - dragging files/folders from Tracker works (hold shift to insert > > > > > them in the existing playlist, othewise the new files replace > > > > > the playlist) > > > > > > > > Isn't that contrary to what one would expect when dropping a file into > > > > the playlist directly (and not in the player window)? > > > > > > I would think not, because it would be inconsistent. But I have no hard > > > opinion on this. > > > > I think the replace operation should require the shift. A user would > > not expect their whole playlist to be replaced by dragging in some new > > files. Clearing out a meticulously built playlist after a drag and > > drop could really anger a user (I know I would be upset.) > > > > I would be surprised if any media players behave like this change. > > Well... ok then. But I find it weird that holding down shift has just the > opposite effect, depending wether you drop files on the Playlist window, or > on the Player window. Both windows open side by side. Clearly, changing the > way dropping on the Player window works, would be even more confusing. So I > was under the impression that having it consistent is more important. Plus > "shift" is usually associated with "extend" when used together with mouse > clicks (like for example when selecting). But if every other media player > on the world does it the other way around, I give up. :-) I share your position, BTW. > > It may seem inconsistent but it makes sense that dragging files onto > > the media player itself replaces the current playing file, whereas > > dragging onto a playlist should always append to the playlist, not > > replace it. > > Whatever we end up with, I am strongly considering having an Undo/Redo > stack for operations in the Playlist window anyways. I know how frustrating > it can be to lose changes on a complicated playlist. Yeah, that's definitely a must-have. CU, Ingo From marcusoverhagen at arcor.de Sun Jun 3 20:59:17 2007 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Sun, 3 Jun 2007 20:59:17 +0200 (CEST) Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: References: <16422146379-BeMail@zon> <20070603171138.10591.10@stippis.WG> Message-ID: <9554472.1180897157839.JavaMail.ngmail@webmail19> Ryan Leavengood wrote: > I think the replace operation should require the shift. A user would > not expect their whole playlist to be replaced by dragging in some new > files. Clearing out a meticulously built playlist after a drag and > drop could really anger a user (I know I would be upset.) > > I would be surprised if any media players behave like this change. > > It may seem inconsistent but it makes sense that dragging files onto > the media player itself replaces the current playing file, whereas > dragging onto a playlist should always append to the playlist, not > replace it. I agree with that. Marcus Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 39,85 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From axeld at mail.berlios.de Sun Jun 3 21:23:04 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 3 Jun 2007 21:23:04 +0200 Subject: [Haiku-commits] r21308 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200706031923.l53JN4OS006737@sheep.berlios.de> Author: axeld Date: 2007-06-03 21:23:03 +0200 (Sun, 03 Jun 2007) New Revision: 21308 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21308&view=rev Modified: haiku/trunk/headers/os/interface/Window.h haiku/trunk/src/kits/interface/Window.cpp Log: Implemented B_CLOSE_ON_ESCAPE as mentioned on the mailing list. Modified: haiku/trunk/headers/os/interface/Window.h =================================================================== --- haiku/trunk/headers/os/interface/Window.h 2007-06-03 16:25:35 UTC (rev 21307) +++ haiku/trunk/headers/os/interface/Window.h 2007-06-03 19:23:03 UTC (rev 21308) @@ -82,6 +82,7 @@ B_QUIT_ON_WINDOW_CLOSE = 0x00100000, B_SAME_POSITION_IN_ALL_WORKSPACES = 0x00200000, B_AUTO_UPDATE_SIZE_LIMITS = 0x00400000, + B_CLOSE_ON_ESCAPE = 0x00800000 }; #define B_CURRENT_WORKSPACE 0 Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2007-06-03 16:25:35 UTC (rev 21307) +++ haiku/trunk/src/kits/interface/Window.cpp 2007-06-03 19:23:03 UTC (rev 21308) @@ -3138,6 +3138,15 @@ return true; } + // Optionally close window when the escape key is pressed + if (key == B_ESCAPE && (Flags() & B_CLOSE_ON_ESCAPE) != 0) { + BMessage message(B_QUIT_REQUESTED); + message.AddBool("shortcut", true); + + PostMessage(&message); + return true; + } + // Handle shortcuts if ((modifiers & B_COMMAND_KEY) != 0) { // Command+q has been pressed, so, we will quit From axeld at pinc-software.de Sun Jun 3 21:30:02 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Sun, 03 Jun 2007 21:30:02 +0200 CEST Subject: [Haiku-commits] r21307 - buildtools/trunk/jam In-Reply-To: <200706031625.l53GPZgo012180@sheep.berlios.de> Message-ID: <32759566751-BeMail@zon> bonefish at BerliOS wrote: > * Made the code more robust against missed node monitoring messages. > If > an entry is encountered that shouldn't be there, it is removed. As > implemented before, a Node could end up with a NULL referring > Entry, > leading to a crash when an Entry that references the Node was > moved. > Missing node monitoring messages is actually virtually impossible, > since a dedicated looper does nothing else but pushing those into a > separate queue, but nevertheless Stippi seems to have managed the > trick. :-) He's not alone :-) Thanks, it's a very welcome update! Bye, Axel. From stippi at mail.berlios.de Sun Jun 3 22:18:55 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 3 Jun 2007 22:18:55 +0200 Subject: [Haiku-commits] r21309 - haiku/trunk/src/apps/mediaplayer Message-ID: <200706032018.l53KItEs010443@sheep.berlios.de> Author: stippi Date: 2007-06-03 22:18:55 +0200 (Sun, 03 Jun 2007) New Revision: 21309 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21309&view=rev Modified: haiku/trunk/src/apps/mediaplayer/ListViews.cpp Log: * by popular request, you have to hold shift down in the playlist window when you want to replace the playlist by the stuff you are dragging, the default behaviour is now to insert/append it to the existing items Modified: haiku/trunk/src/apps/mediaplayer/ListViews.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/ListViews.cpp 2007-06-03 19:23:03 UTC (rev 21308) +++ haiku/trunk/src/apps/mediaplayer/ListViews.cpp 2007-06-03 20:18:55 UTC (rev 21309) @@ -556,7 +556,10 @@ { if (AcceptDragMessage(message)) { bool copy = modifiers() & B_SHIFT_KEY; - bool replaceAll = !message->HasPointer("list") && !copy; + bool replaceAll = !message->HasPointer("list") && copy; + // when dragging something in from ie Tracker, the + // user has to hold shift down to replace everything + // (opposite meaning of the normal shift behaviour) BRect r = Bounds(); if (replaceAll) { r.bottom--; // compensate for scrollbar offset From axeld at mail.berlios.de Sun Jun 3 22:20:19 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 3 Jun 2007 22:20:19 +0200 Subject: [Haiku-commits] r21310 - in haiku/trunk: headers/private/kernel src/servers/app/drawing src/system/boot/platform/bios_ia32 src/system/boot/platform/generic Message-ID: <200706032020.l53KKJRC010620@sheep.berlios.de> Author: axeld Date: 2007-06-03 22:20:19 +0200 (Sun, 03 Jun 2007) New Revision: 21310 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21310&view=rev Modified: haiku/trunk/headers/private/kernel/safemode.h haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp haiku/trunk/src/servers/app/drawing/Jamfile haiku/trunk/src/system/boot/platform/bios_ia32/menu.cpp haiku/trunk/src/system/boot/platform/generic/text_menu.cpp Log: Implemented "fail_safe_video_mode" boot option; if you're using it, the app_server will not load any graphics driver (other than VESA). Modified: haiku/trunk/headers/private/kernel/safemode.h =================================================================== --- haiku/trunk/headers/private/kernel/safemode.h 2007-06-03 20:18:55 UTC (rev 21309) +++ haiku/trunk/headers/private/kernel/safemode.h 2007-06-03 20:20:19 UTC (rev 21310) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2005, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2004-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _KERNEL_SAFEMODE_H @@ -17,6 +17,7 @@ #define B_SAFEMODE_DISABLE_ACPI "disable_acpi" #define B_SAFEMODE_DISABLE_SMP "disable_smp" #define B_SAFEMODE_DISABLE_HYPER_THREADING "disable_hyperthreading" +#define B_SAFEMODE_FAIL_SAFE_VIDEO_MODE "fail_safe_video_mode" #ifdef __cplusplus Modified: haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp 2007-06-03 20:18:55 UTC (rev 21309) +++ haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp 2007-06-03 20:20:19 UTC (rev 21310) @@ -22,6 +22,8 @@ #include "ServerProtocol.h" #include "SystemPalette.h" +#include "safemode.h" + #include #include #include @@ -47,23 +49,50 @@ #endif +#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST // This call updates the frame buffer used by the on-screen KDL -#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST extern "C" status_t _kern_frame_buffer_update(void *baseAddress, - int32 width, int32 height, - int32 depth, int32 bytesPerRow); + int32 width, int32 height, int32 depth, int32 bytesPerRow); + +// This call retrieves the system's safemode options +extern "C" status_t _kern_get_safemode_option(const char* parameter, + char* buffer, size_t* _size); #endif +const int32 kDefaultParamsCount = 64; + bool operator==(const display_mode& a, const display_mode& b) { return memcmp(&a, &b, sizeof(display_mode)) == 0; } -const int32 kDefaultParamsCount = 64; -// constructor +bool +use_fail_safe_video_mode() +{ + char buffer[B_FILE_NAME_LENGTH]; + size_t size = sizeof(buffer); + + status_t status = _kern_get_safemode_option( + B_SAFEMODE_FAIL_SAFE_VIDEO_MODE, buffer, &size); + if (status == B_OK) { + if (!strncasecmp(buffer, "true", size) + || !strncasecmp(buffer, "yes", size) + || !strncasecmp(buffer, "on", size) + || !strncasecmp(buffer, "enabled", size)) { + return true; + } + } + + return false; +} + + +// #pragma mark - + + AccelerantHWInterface::AccelerantHWInterface() : HWInterface(), fCardFD(-1), @@ -185,35 +214,36 @@ if (!directory) return -1; - // ToDo: the former R5 "stub" driver is called "vesa" under Haiku; however, - // we do not need to avoid this driver this way when is has been ported - // to the new driver architecture - the special case here can then be - // removed. + int device = -1; int count = 0; - struct dirent *entry; - int device = -1; - char path[PATH_MAX]; - while (count < deviceNumber && (entry = readdir(directory)) != NULL) { - if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..") || - !strcmp(entry->d_name, "stub") || !strcmp(entry->d_name, "vesa")) - continue; + if (!use_fail_safe_video_mode()) { + // ToDo: the former R5 "stub" driver is called "vesa" under Haiku; however, + // we do not need to avoid this driver this way when is has been ported + // to the new driver architecture - the special case here can then be + // removed. + struct dirent *entry; + char path[PATH_MAX]; + while (count < deviceNumber && (entry = readdir(directory)) != NULL) { + if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..") || + !strcmp(entry->d_name, "stub") || !strcmp(entry->d_name, "vesa")) + continue; - if (device >= 0) { - close(device); - device = -1; + if (device >= 0) { + close(device); + device = -1; + } + + sprintf(path, "/dev/graphics/%s", entry->d_name); + device = open(path, B_READ_WRITE); + if (device >= 0) + count++; } - - sprintf(path, "/dev/graphics/%s", entry->d_name); - device = open(path, B_READ_WRITE); - if (device >= 0) - count++; } // Open VESA driver if we were not able to get a better one if (count < deviceNumber) { if (deviceNumber == 1) { - sprintf(path, "/dev/graphics/vesa"); - device = open(path, B_READ_WRITE); + device = open("/dev/graphics/vesa", B_READ_WRITE); fVGADevice = device; // store the device, so that we can access the planar blitter } else { Modified: haiku/trunk/src/servers/app/drawing/Jamfile =================================================================== --- haiku/trunk/src/servers/app/drawing/Jamfile 2007-06-03 20:18:55 UTC (rev 21309) +++ haiku/trunk/src/servers/app/drawing/Jamfile 2007-06-03 20:20:19 UTC (rev 21310) @@ -1,7 +1,7 @@ SubDir HAIKU_TOP src servers app drawing ; UseLibraryHeaders agg ; -UsePrivateHeaders app graphics interface shared ; +UsePrivateHeaders app graphics kernel interface shared ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app ] ; UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ; Modified: haiku/trunk/src/system/boot/platform/bios_ia32/menu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/menu.cpp 2007-06-03 20:18:55 UTC (rev 21309) +++ haiku/trunk/src/system/boot/platform/bios_ia32/menu.cpp 2007-06-03 20:20:19 UTC (rev 21310) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2004-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -23,6 +23,11 @@ item->SetTarget(video_mode_hook); break; case SAFE_MODE_MENU: + menu->AddItem(item = new(nothrow) MenuItem("Use fail-safe video mode")); + item->SetType(MENU_ITEM_MARKABLE); + item->SetData(B_SAFEMODE_FAIL_SAFE_VIDEO_MODE); + item->SetHelpText("The system will use VESA mode and won't try to open any video graphics driver"); + smp_add_safemode_menus(menu); menu->AddItem(item = new(nothrow) MenuItem("Don't call the BIOS")); Modified: haiku/trunk/src/system/boot/platform/generic/text_menu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/generic/text_menu.cpp 2007-06-03 20:18:55 UTC (rev 21309) +++ haiku/trunk/src/system/boot/platform/generic/text_menu.cpp 2007-06-03 20:20:19 UTC (rev 21310) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2004-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -73,8 +73,10 @@ if (line < 0 || line >= menu_height()) return; - console_color background = selected ? kSelectedItemBackgroundColor : kItemBackgroundColor; - console_color foreground = selected ? kSelectedItemColor : kItemColor; + console_color background = selected + ? kSelectedItemBackgroundColor : kItemBackgroundColor; + console_color foreground = selected + ? kSelectedItemColor : kItemColor; if (!item->IsEnabled()) foreground = kDisabledColor; @@ -199,14 +201,15 @@ print_centered(2, "Haiku Boot Loader"); console_set_color(kCopyrightColor, kBackgroundColor); - print_centered(4, "Copyright 2004-2006 Haiku Inc."); + print_centered(4, "Copyright 2004-2007 Haiku Inc."); if (menu->Title()) { console_set_cursor(kOffsetX, kFirstLine - 2); console_set_color(kTitleColor, kTitleBackgroundColor); printf(" %s", menu->Title()); - print_spacing(console_width() - 1 - strlen(menu->Title()) - 2*kOffsetX); + print_spacing(console_width() - 1 + - strlen(menu->Title()) - 2 * kOffsetX); } MenuItemIterator iterator = menu->ItemIterator(); @@ -372,11 +375,13 @@ break; case TEXT_CONSOLE_KEY_PAGE_UP: case TEXT_CONSOLE_KEY_LEFT: - selected = select_previous_valid_item(menu, selected - menu_height() + 1); + selected = select_previous_valid_item(menu, + selected - menu_height() + 1); break; case TEXT_CONSOLE_KEY_PAGE_DOWN: case TEXT_CONSOLE_KEY_RIGHT: - selected = select_next_valid_item(menu, selected + menu_height() - 1); + selected = select_next_valid_item(menu, + selected + menu_height() - 1); break; case TEXT_CONSOLE_KEY_HOME: selected = first_selectable_item(menu); From axeld at mail.berlios.de Sun Jun 3 22:33:56 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 3 Jun 2007 22:33:56 +0200 Subject: [Haiku-commits] r21311 - haiku/trunk/src/kits/interface Message-ID: <200706032033.l53KXulM011566@sheep.berlios.de> Author: axeld Date: 2007-06-03 22:33:56 +0200 (Sun, 03 Jun 2007) New Revision: 21311 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21311&view=rev Modified: haiku/trunk/src/kits/interface/Window.cpp Log: Modal windows no longer install the 'Q' shortcut anymore. This fixes bug #1256. Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2007-06-03 20:20:19 UTC (rev 21310) +++ haiku/trunk/src/kits/interface/Window.cpp 2007-06-03 20:33:56 UTC (rev 21311) @@ -2379,8 +2379,9 @@ fDefaultButton = NULL; // Shortcut 'Q' is handled in _HandleKeyDown() directly, as its message - // get sent to the application, and not one of our handlers - fNoQuitShortcut = false; + // get sent to the application, and not one of our handlers. + // It is only installed for non-modal windows, though. + fNoQuitShortcut = IsModal(); if ((fFlags & B_NOT_CLOSABLE) == 0 && !IsModal()) { // Modal windows default to non-closable, but you can add the shortcut manually, From simontaylor1 at ntlworld.com Sun Jun 3 22:19:50 2007 From: simontaylor1 at ntlworld.com (Simon Taylor) Date: Sun, 03 Jun 2007 21:19:50 +0100 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <20070603193353.424.1@stippis.WG> References: <16422146379-BeMail@zon> <20070603171138.10591.10@stippis.WG> <20070603193353.424.1@stippis.WG> Message-ID: <46632266.4080802@ntlworld.com> Stephan Assmus wrote: > Ryan Leavengood wrote (2007-06-03, 18:31:08 [+0200]): >> On 6/3/07, Stephan Assmus wrote: >>> Axel D?rfler wrote (2007-06-03, 16:57:45 [+0200]): >>>> stippi at BerliOS wrote: >>>>> - dragging files/folders from Tracker works (hold shift to insert >>>>> them in the existing playlist, othewise the new files replace >>>>> the playlist) >>>> Isn't that contrary to what one would expect when dropping a file into >>>> the playlist directly (and not in the player window)? >>> I would think not, because it would be inconsistent. But I have no hard >>> opinion on this. >> I think the replace operation should require the shift. A user would >> not expect their whole playlist to be replaced by dragging in some new >> files. Clearing out a meticulously built playlist after a drag and >> drop could really anger a user (I know I would be upset.) >> >> I would be surprised if any media players behave like this change. > > Well... ok then. But I find it weird that holding down shift has just the > opposite effect, depending wether you drop files on the Playlist window, or > on the Player window. Both windows open side by side. Clearly, changing the > way dropping on the Player window works, would be even more confusing. So I > was under the impression that having it consistent is more important. Plus > "shift" is usually associated with "extend" when used together with mouse > clicks (like for example when selecting). But if every other media player > on the world does it the other way around, I give up. :-) Either option would be fine, as long as the user was given clear feedback about what was happening. I can definitely see the user often wanting to insert new files into a playlist by dropping them into the correct place in the playlist window, which would be indicated by a line in between the current items where the new ones would be inserted. On the other hand, complete replacement would be indicated by a box around the entire playlist list view (and perhaps fading out the current options too to indicate they will disappear from the list if the user continues). I don't think that having different behaviour depending on the target is confusing - the playlist is the ordered list of files, so trying to drag files there to me implies "insert these files here in this list". Dragging to the media player window implies "you there, play this file now". In fact I would might remove the modifiers and just have dragging to main window replacing the list, and dragging to the list inserting new files. I'd still use the technique of fading out the current playlist items when the user is dragging files onto the main window to give an indication of what will happen (and a hint of where to drag to in order to change the behaviour). >> It may seem inconsistent but it makes sense that dragging files onto >> the media player itself replaces the current playing file, whereas >> dragging onto a playlist should always append to the playlist, not >> replace it. > > Whatever we end up with, I am strongly considering having an Undo/Redo > stack for operations in the Playlist window anyways. I know how frustrating > it can be to lose changes on a complicated playlist. Yes that would be great. Perhaps whenever a multi-file playlist is replaced, auto-save it somewhere for future use. Simon > Best regards, > -Stephan > _______________________________________________ > Haiku-commits mailing list > Haiku-commits at lists.berlios.de > https://lists.berlios.de/mailman/listinfo/haiku-commits > From superstippi at gmx.de Sun Jun 3 23:01:38 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 03 Jun 2007 23:01:38 +0200 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <46632266.4080802@ntlworld.com> References: <16422146379-BeMail@zon> <20070603171138.10591.10@stippis.WG> <20070603193353.424.1@stippis.WG> <46632266.4080802@ntlworld.com> Message-ID: <20070603230138.1882.11@stippis.WG> Simon Taylor wrote (2007-06-03, 22:19:50 [+0200]): [shift versus shift] > Either option would be fine, as long as the user was given clear > feedback about what was happening. I can definitely see the user often > wanting to insert new files into a playlist by dropping them into the > correct place in the playlist window, which would be indicated by a line > in between the current items where the new ones would be inserted. On > the other hand, complete replacement would be indicated by a box around > the entire playlist list view (and perhaps fading out the current > options too to indicate they will disappear from the list if the user > continues). > > I don't think that having different behaviour depending on the target is > confusing - the playlist is the ordered list of files, so trying to drag > files there to me implies "insert these files here in this list". > Dragging to the media player window implies "you there, play this file now". > > In fact I would might remove the modifiers and just have dragging to > main window replacing the list, and dragging to the list inserting new > files. I'd still use the technique of fading out the current playlist > items when the user is dragging files onto the main window to give an > indication of what will happen (and a hint of where to drag to in order > to change the behaviour). All of the above is/was implemented except for graying out the existing items when you hover over the player window. The only addition now to what you say above is that you *can* optionally press shift to get the other behaviour, but since doing both is now possible without any modifier, I guess it is fine like it is. The drag feedback already worked exactly like you discribe, minus the graying out. > >> It may seem inconsistent but it makes sense that dragging files onto > >> the media player itself replaces the current playing file, whereas > >> dragging onto a playlist should always append to the playlist, not > >> replace it. > > > > Whatever we end up with, I am strongly considering having an Undo/Redo > > stack for operations in the Playlist window anyways. I know how > > frustrating > > it can be to lose changes on a complicated playlist. > > Yes that would be great. Perhaps whenever a multi-file playlist is > replaced, auto-save it somewhere for future use. I will allow to load/save playlists (not yet implemented). I don't think autosaving is a good idea. Having undo/redo will solve the problem of accidentally wiping your minute list. Actually, I use custom playlists almost never. Maybe at parties. Usually I just drag an album into the player. I wouldn't want that to get saved somewhere. Best regards, -Stephan From stippi at mail.berlios.de Sun Jun 3 23:24:48 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 3 Jun 2007 23:24:48 +0200 Subject: [Haiku-commits] r21312 - in haiku/trunk/src/apps/mediaplayer: . support Message-ID: <200706032124.l53LOmi2015110@sheep.berlios.de> Author: stippi Date: 2007-06-03 23:24:47 +0200 (Sun, 03 Jun 2007) New Revision: 21312 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21312&view=rev Added: haiku/trunk/src/apps/mediaplayer/support/ haiku/trunk/src/apps/mediaplayer/support/AbstractLOAdapter.cpp haiku/trunk/src/apps/mediaplayer/support/AbstractLOAdapter.h haiku/trunk/src/apps/mediaplayer/support/Command.cpp haiku/trunk/src/apps/mediaplayer/support/Command.h haiku/trunk/src/apps/mediaplayer/support/CommandStack.cpp haiku/trunk/src/apps/mediaplayer/support/CommandStack.h haiku/trunk/src/apps/mediaplayer/support/Listener.cpp haiku/trunk/src/apps/mediaplayer/support/Listener.h haiku/trunk/src/apps/mediaplayer/support/ListenerAdapter.cpp haiku/trunk/src/apps/mediaplayer/support/ListenerAdapter.h haiku/trunk/src/apps/mediaplayer/support/NOTE haiku/trunk/src/apps/mediaplayer/support/Notifier.cpp haiku/trunk/src/apps/mediaplayer/support/Notifier.h Removed: haiku/trunk/src/apps/mediaplayer/AbstractLOAdapter.cpp haiku/trunk/src/apps/mediaplayer/AbstractLOAdapter.h Modified: haiku/trunk/src/apps/mediaplayer/Jamfile haiku/trunk/src/apps/mediaplayer/MainWin.cpp haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp haiku/trunk/src/apps/mediaplayer/PlaylistListView.h haiku/trunk/src/apps/mediaplayer/PlaylistWindow.cpp haiku/trunk/src/apps/mediaplayer/PlaylistWindow.h Log: * implemented infrastructure for undo/redo of playlist operations, everything regarding playlist modification is now tunneled through the playlist window Deleted: haiku/trunk/src/apps/mediaplayer/AbstractLOAdapter.cpp Deleted: haiku/trunk/src/apps/mediaplayer/AbstractLOAdapter.h Modified: haiku/trunk/src/apps/mediaplayer/Jamfile =================================================================== --- haiku/trunk/src/apps/mediaplayer/Jamfile 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/Jamfile 2007-06-03 21:24:47 UTC (rev 21312) @@ -7,6 +7,7 @@ # source directories local sourceDirs = supplier + support ; local sourceDir ; @@ -21,8 +22,16 @@ MediaTrackVideoSupplier.cpp VideoSupplier.cpp + # support + AbstractLOAdapter.cpp + Command.cpp + CommandStack.cpp + Listener.cpp + ListenerAdapter.cpp + Notifier.cpp + RWLocker.cpp + # . - AbstractLOAdapter.cpp Controller.cpp ControllerObserver.cpp ControllerView.cpp Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2007-06-03 21:24:47 UTC (rev 21312) @@ -166,6 +166,15 @@ _SetupWindow(); + // setup the playlist window now, we need to have it + // running for the undo/redo playlist editing + fPlaylistWindow = new PlaylistWindow(BRect(150, 150, 400, 500), + fPlaylist, fController); + fPlaylistWindow->Hide(); + fPlaylistWindow->Show(); + // this makes sure the window thread is running without + // showing the window just yet + Show(); } @@ -683,13 +692,6 @@ void MainWin::ShowPlaylistWindow() { - if (!fPlaylistWindow) { - fPlaylistWindow = new PlaylistWindow(BRect(150, 150, 400, 500), - fPlaylist, fController); - fPlaylistWindow->Show(); - return; - } - if (fPlaylistWindow->Lock()) { if (fPlaylistWindow->IsHidden()) fPlaylistWindow->Show(); @@ -728,15 +730,18 @@ void -MainWin::_RefsReceived(BMessage *msg) +MainWin::_RefsReceived(BMessage* msg) { // the playlist ist replaced by dropped files // or the dropped files are appended to the end // of the existing playlist if is pressed int32 appendIndex = modifiers() & B_SHIFT_KEY ? fPlaylist->CountItems() : -1; + msg->AddInt32("append_index", appendIndex); - fPlaylist->AppendRefs(msg, appendIndex); + // forward the message to the playlist window, + // so that undo/redo is used for modifying the playlist + fPlaylistWindow->PostMessage(msg); } Modified: haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp 2007-06-03 21:24:47 UTC (rev 21312) @@ -252,12 +252,12 @@ case B_SIMPLE_DATA: if (message->HasRef("refs")) - _RefsReceived(message, fDropIndex); + RefsReceived(message, fDropIndex); else if (message->HasPointer("list")) SimpleListView::MessageReceived(message); break; case B_REFS_RECEIVED: - _RefsReceived(message, fDropIndex); + RefsReceived(message, fDropIndex); break; default: @@ -421,6 +421,18 @@ } +void +PlaylistListView::RefsReceived(BMessage* message, int32 appendIndex) +{ + if (!fPlaylist->Lock()) + return; + + fPlaylist->AppendRefs(message, appendIndex); + + fPlaylist->Unlock(); +} + + // #pragma mark - @@ -489,14 +501,3 @@ } -void -PlaylistListView::_RefsReceived(BMessage* message, int32 dropIndex) -{ - if (!fPlaylist->Lock()) - return; - - fPlaylist->AppendRefs(message, dropIndex); - - fPlaylist->Unlock(); -} - Modified: haiku/trunk/src/apps/mediaplayer/PlaylistListView.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/PlaylistListView.h 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/PlaylistListView.h 2007-06-03 21:24:47 UTC (rev 21312) @@ -38,6 +38,10 @@ virtual void DrawListItem(BView* owner, int32 index, BRect frame) const; + // PlaylistListView + void RefsReceived(BMessage* message, + int32 appendIndex); + private: void _FullSync(); void _AddItem(const entry_ref& ref, int32 index); @@ -46,9 +50,6 @@ void _SetCurrentPlaylistIndex(int32 index); void _SetPlaybackState(uint32 state); - void _RefsReceived(BMessage* message, - int32 dropIndex); - Playlist* fPlaylist; PlaylistObserver* fPlaylistObserver; Modified: haiku/trunk/src/apps/mediaplayer/PlaylistWindow.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/PlaylistWindow.cpp 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/PlaylistWindow.cpp 2007-06-03 21:24:47 UTC (rev 21312) @@ -7,25 +7,50 @@ */ #include "PlaylistWindow.h" +#include +#include +#include #include #include +#include +#include "CommandStack.h" #include "PlaylistListView.h" +#include "RWLocker.h" PlaylistWindow::PlaylistWindow(BRect frame, Playlist* playlist, Controller* controller) - : BWindow(frame, "Playlist", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS) + : BWindow(frame, "Playlist", B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, + B_ASYNCHRONOUS_CONTROLS) + + , fLocker(new RWLocker("command stack lock")) + , fCommandStack(new CommandStack(fLocker)) + , fCommandStackListener(this) { frame = Bounds(); + + _CreateMenu(frame); + frame.right -= B_V_SCROLL_BAR_WIDTH; - PlaylistListView* listView = new PlaylistListView(frame, playlist, - controller); + fListView = new PlaylistListView(frame, playlist, controller); - fTopView = new BScrollView("playlist scrollview", - listView, B_FOLLOW_ALL, 0, false, true, B_NO_BORDER); + BScrollView* scrollView = new BScrollView("playlist scrollview", + fListView, B_FOLLOW_ALL, 0, false, true, B_NO_BORDER); + fTopView = scrollView; AddChild(fTopView); + + // small visual tweak + if (BScrollBar* scrollBar = scrollView->ScrollBar(B_VERTICAL)) { + // make it so the frame of the menubar is also the frame of + // the scroll bar (appears to be) + scrollBar->MoveBy(0, -1); + scrollBar->ResizeBy(0, 1); + } + + fCommandStack->AddListener(&fCommandStackListener); + _ObjectChanged(fCommandStack); } @@ -34,6 +59,10 @@ // give listeners a chance to detach themselves fTopView->RemoveSelf(); delete fTopView; + + fCommandStack->RemoveListener(&fCommandStackListener); + delete fCommandStack; + delete fLocker; } @@ -53,9 +82,91 @@ if (LastMouseMovedView()) PostMessage(message, LastMouseMovedView()); break; + + case B_UNDO: + fCommandStack->Undo(); + break; + case B_REDO: + fCommandStack->Redo(); + break; + + case MSG_OBJECT_CHANGED: { + Notifier* notifier; + if (message->FindPointer("object", (void**)¬ifier) == B_OK) + _ObjectChanged(notifier); + break; + } + + case B_REFS_RECEIVED: + case B_SIMPLE_DATA: { + // only accept this message when it comes from the + // player window, _not_ when it is dropped in this window + // outside of the playlist! + int32 appendIndex; + if (message->FindInt32("append_index", &appendIndex) == B_OK) { + fListView->RefsReceived(message, appendIndex); + } + break; + } + default: BWindow::MessageReceived(message); break; } } + +// #pragma mark - + + +void +PlaylistWindow::_CreateMenu(BRect& frame) +{ + frame.bottom = 15; + BMenuBar* menuBar = new BMenuBar(frame, "main menu"); + BMenu* fileMenu = new BMenu("Playlist"); + menuBar->AddItem(fileMenu); + // TODO add some items: "Open", "Save", "Make Empty"... + + BMenu* editMenu = new BMenu("Edit"); + BMessage* message = new BMessage(B_UNDO); + fUndoMI = new BMenuItem("Undo", message); + editMenu->AddItem(fUndoMI); + message = new BMessage(B_REDO); + fRedoMI = new BMenuItem("Undo", message); + editMenu->AddItem(fRedoMI); + menuBar->AddItem(editMenu); + + AddChild(menuBar); + fileMenu->SetTargetForItems(this); + editMenu->SetTargetForItems(this); + + menuBar->ResizeToPreferred(); + frame = Bounds(); + frame.top = menuBar->Frame().bottom + 1; +} + + +// _ObjectChanged +void +PlaylistWindow::_ObjectChanged(const Notifier* object) +{ + if (object == fCommandStack) { + // relable Undo item and update enabled status + BString label("Undo"); + fUndoMI->SetEnabled(fCommandStack->GetUndoName(label)); + if (fUndoMI->IsEnabled()) + fUndoMI->SetLabel(label.String()); + else + fUndoMI->SetLabel(""); + + // relable Redo item and update enabled status + label.SetTo("Redo"); + fRedoMI->SetEnabled(fCommandStack->GetRedoName(label)); + if (fRedoMI->IsEnabled()) + fRedoMI->SetLabel(label.String()); + else + fRedoMI->SetLabel(""); + } +} + Modified: haiku/trunk/src/apps/mediaplayer/PlaylistWindow.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/PlaylistWindow.h 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/PlaylistWindow.h 2007-06-03 21:24:47 UTC (rev 21312) @@ -11,8 +11,16 @@ #include +#include "ListenerAdapter.h" + +class BMenuBar; +class BMenuItem; +class CommandStack; class Controller; +class Notifier; class Playlist; +class PlaylistListView; +class RWLocker; class PlaylistWindow : public BWindow { public: @@ -25,7 +33,19 @@ virtual void MessageReceived(BMessage* message); private: + void _CreateMenu(BRect& frame); + void _ObjectChanged(const Notifier* object); + + Playlist* fPlaylist; + PlaylistListView* fListView; + BView* fTopView; + BMenuItem* fUndoMI; + BMenuItem* fRedoMI; + + RWLocker* fLocker; + CommandStack* fCommandStack; + ListenerAdapter fCommandStackListener; }; #endif // PLAYLIST_WINDOW_H Copied: haiku/trunk/src/apps/mediaplayer/support/AbstractLOAdapter.cpp (from rev 21291, haiku/trunk/src/apps/mediaplayer/AbstractLOAdapter.cpp) Copied: haiku/trunk/src/apps/mediaplayer/support/AbstractLOAdapter.h (from rev 21291, haiku/trunk/src/apps/mediaplayer/AbstractLOAdapter.h) Added: haiku/trunk/src/apps/mediaplayer/support/Command.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/Command.cpp 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/support/Command.cpp 2007-06-03 21:24:47 UTC (rev 21312) @@ -0,0 +1,91 @@ +/* + * Copyright 2006, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ + +#include "Command.h" + +#include + +#include + +// constructor +Command::Command() + : fTimeStamp(system_time()) +{ +} + +// destructor +Command::~Command() +{ +} + +// InitCheck +status_t +Command::InitCheck() +{ + return B_NO_INIT; +} + +// Perform +status_t +Command::Perform() +{ + return B_ERROR; +} + +// Undo +status_t +Command::Undo() +{ + return B_ERROR; +} + +// Redo +status_t +Command::Redo() +{ + return Perform(); +} + +// GetName +void +Command::GetName(BString& name) +{ + name << "Name of action goes here."; +} + +// UndoesPrevious +bool +Command::UndoesPrevious(const Command* previous) +{ + return false; +} + +// CombineWithNext +bool +Command::CombineWithNext(const Command* next) +{ + return false; +} + +// CombineWithPrevious +bool +Command::CombineWithPrevious(const Command* previous) +{ + return false; +} + + +// _GetString +const char* +Command::_GetString(uint32 key, const char* defaultString) const +{ +// if (LanguageManager* manager = LanguageManager::Default()) +// return manager->GetString(key, defaultString); +// else + return defaultString; +} Added: haiku/trunk/src/apps/mediaplayer/support/Command.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/Command.h 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/support/Command.h 2007-06-03 21:24:47 UTC (rev 21312) @@ -0,0 +1,41 @@ +/* + * Copyright 2006, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ + +#ifndef COMMAND_H +#define COMMAND_H + +#include +#include + +class BString; + +class Command { + public: + Command(); + virtual ~Command(); + + virtual status_t InitCheck(); + + virtual status_t Perform(); + virtual status_t Undo(); + virtual status_t Redo(); + + virtual void GetName(BString& name); + + virtual bool UndoesPrevious(const Command* previous); + virtual bool CombineWithNext(const Command* next); + virtual bool CombineWithPrevious(const Command* previous); + + protected: + const char* _GetString(uint32 key, + const char* defaultString) const; + + bigtime_t fTimeStamp; +}; + +#endif // COMMAND_H Added: haiku/trunk/src/apps/mediaplayer/support/CommandStack.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/CommandStack.cpp 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/support/CommandStack.cpp 2007-06-03 21:24:47 UTC (rev 21312) @@ -0,0 +1,252 @@ +/* + * Copyright 2006-2007, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ + +#include "CommandStack.h" + +#include +#include + +#include +#include + +#include "Command.h" +#include "RWLocker.h" + +// constructor +CommandStack::CommandStack(RWLocker* locker) + : Notifier() + , fLocker(locker) + , fSavedCommand(NULL) +{ +} + +// destructor +CommandStack::~CommandStack() +{ + Clear(); +} + +// Perform +status_t +CommandStack::Perform(Command* command) +{ + if (!fLocker->WriteLock()) + return B_ERROR; + + status_t ret = command ? B_OK : B_BAD_VALUE; + if (ret == B_OK) + ret = command->InitCheck(); + + if (ret == B_OK) + ret = command->Perform(); + + if (ret == B_OK) + ret = _AddCommand(command); + + if (ret != B_OK) { + // no one else feels responsible... + delete command; + } + fLocker->WriteUnlock(); + + Notify(); + + return ret; +} + +// Undo +status_t +CommandStack::Undo() +{ + if (!fLocker->WriteLock()) + return B_ERROR; + + status_t status = B_ERROR; + if (!fUndoHistory.empty()) { + Command* command = fUndoHistory.top(); + fUndoHistory.pop(); + status = command->Undo(); + if (status == B_OK) + fRedoHistory.push(command); + else + fUndoHistory.push(command); + } + fLocker->WriteUnlock(); + + Notify(); + + return status; +} + +// Redo +status_t +CommandStack::Redo() +{ + if (!fLocker->WriteLock()) + return B_ERROR; + + status_t status = B_ERROR; + if (!fRedoHistory.empty()) { + Command* command = fRedoHistory.top(); + fRedoHistory.pop(); + status = command->Redo(); + if (status == B_OK) + fUndoHistory.push(command); + else + fRedoHistory.push(command); + } + fLocker->WriteUnlock(); + + Notify(); + + return status; +} + +// UndoName +bool +CommandStack::GetUndoName(BString& name) +{ + bool success = false; + if (fLocker->ReadLock()) { + if (!fUndoHistory.empty()) { + name << " "; + fUndoHistory.top()->GetName(name); + success = true; + } + fLocker->ReadUnlock(); + } + return success; +} + +// RedoName +bool +CommandStack::GetRedoName(BString& name) +{ + bool success = false; + if (fLocker->ReadLock()) { + if (!fRedoHistory.empty()) { + name << " "; + fRedoHistory.top()->GetName(name); + success = true; + } + fLocker->ReadUnlock(); + } + return success; +} + +// Clear +void +CommandStack::Clear() +{ + if (fLocker->WriteLock()) { + while (!fUndoHistory.empty()) { + delete fUndoHistory.top(); + fUndoHistory.pop(); + } + while (!fRedoHistory.empty()) { + delete fRedoHistory.top(); + fRedoHistory.pop(); + } + fLocker->WriteUnlock(); + } + + Notify(); +} + +// Save +void +CommandStack::Save() +{ + if (fLocker->WriteLock()) { + if (!fUndoHistory.empty()) + fSavedCommand = fUndoHistory.top(); + fLocker->WriteUnlock(); + } + + Notify(); +} + +// IsSaved +bool +CommandStack::IsSaved() +{ + bool saved = false; + if (fLocker->ReadLock()) { + saved = fUndoHistory.empty(); + if (fSavedCommand && !saved) { + if (fSavedCommand == fUndoHistory.top()) + saved = true; + } + fLocker->ReadUnlock(); + } + return saved; +} + +// #pragma mark - + +// _AddCommand +status_t +CommandStack::_AddCommand(Command* command) +{ + status_t status = B_OK; + + bool add = true; + if (!fUndoHistory.empty()) { + // try to collapse commands to a single command + // or remove this and the previous command if + // they reverse each other + if (Command* top = fUndoHistory.top()) { + if (command->UndoesPrevious(top)) { + add = false; + fUndoHistory.pop(); + delete top; + delete command; + } else if (top->CombineWithNext(command)) { + add = false; + delete command; + // after collapsing, the command might + // have changed it's mind about InitCheck() + // (the commands reversed each other) + if (top->InitCheck() < B_OK) { + fUndoHistory.pop(); + delete top; + } + } else if (command->CombineWithPrevious(top)) { + fUndoHistory.pop(); + delete top; + // after collapsing, the command might + // have changed it's mind about InitCheck() + // (the commands reversed each other) + if (command->InitCheck() < B_OK) { + delete command; + add = false; + } + } + } + } + if (add) { + try { + fUndoHistory.push(command); + } catch (...) { + status = B_ERROR; + } + } + + if (status == B_OK) { + // the redo stack needs to be empty + // as soon as a command was added (also in case of collapsing) + while (!fRedoHistory.empty()) { + delete fRedoHistory.top(); + fRedoHistory.pop(); + } + } + + return status; +} + + Added: haiku/trunk/src/apps/mediaplayer/support/CommandStack.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/CommandStack.h 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/support/CommandStack.h 2007-06-03 21:24:47 UTC (rev 21312) @@ -0,0 +1,48 @@ +/* + * Copyright 2006-2007, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ +#ifndef COMMAND_STACK_H +#define COMMAND_STACK_H + +#include + +#include "Notifier.h" + +class BString; +class RWLocker; +class Command; + +class CommandStack : public Notifier { + public: + CommandStack(RWLocker* locker); + virtual ~CommandStack(); + + status_t Perform(Command* command); + + status_t Undo(); + status_t Redo(); + + bool GetUndoName(BString& name); + bool GetRedoName(BString& name); + + void Clear(); + void Save(); + bool IsSaved(); + + private: + status_t _AddCommand(Command* command); + + RWLocker* fLocker; + + typedef stack command_stack; + + command_stack fUndoHistory; + command_stack fRedoHistory; + Command* fSavedCommand; +}; + +#endif // COMMAND_STACK_H Added: haiku/trunk/src/apps/mediaplayer/support/Listener.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/Listener.cpp 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/support/Listener.cpp 2007-06-03 21:24:47 UTC (rev 21312) @@ -0,0 +1,18 @@ +/* + * Copyright 2006, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ + +#include "Listener.h" + +Listener::Listener() +{ +} + +Listener::~Listener() +{ +} + Added: haiku/trunk/src/apps/mediaplayer/support/Listener.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/Listener.h 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/support/Listener.h 2007-06-03 21:24:47 UTC (rev 21312) @@ -0,0 +1,23 @@ +/* + * Copyright 2006-2007, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ +#ifndef LISTENER_H +#define LISTENER_H + +#include + +class Notifier; + +class Listener { + public: + Listener(); + virtual ~Listener(); + + virtual void ObjectChanged(const Notifier* object) = 0; +}; + +#endif // LISTENER_H Added: haiku/trunk/src/apps/mediaplayer/support/ListenerAdapter.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/ListenerAdapter.cpp 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/support/ListenerAdapter.cpp 2007-06-03 21:24:47 UTC (rev 21312) @@ -0,0 +1,32 @@ +/* + * Copyright 2006, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ +#include "ListenerAdapter.h" + +#include + +// constructor +ListenerAdapter::ListenerAdapter(BHandler* handler) + : Listener() + , AbstractLOAdapter(handler) +{ +} + +// destructor +ListenerAdapter::~ListenerAdapter() +{ +} + +// ObjectChanged +void +ListenerAdapter::ObjectChanged(const Notifier* object) +{ + BMessage message(MSG_OBJECT_CHANGED); + message.AddPointer("object", object); + + DeliverMessage(message); +} Added: haiku/trunk/src/apps/mediaplayer/support/ListenerAdapter.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/ListenerAdapter.h 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/support/ListenerAdapter.h 2007-06-03 21:24:47 UTC (rev 21312) @@ -0,0 +1,26 @@ +/* + * Copyright 2007, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ +#ifndef LISTENER_ADAPTER_H +#define LISTENER_ADAPTER_H + +#include "AbstractLOAdapter.h" +#include "Listener.h" + +enum { + MSG_OBJECT_CHANGED = 'obch' +}; + +class ListenerAdapter : public Listener, public AbstractLOAdapter { + public: + ListenerAdapter(BHandler* handler); + virtual ~ListenerAdapter(); + + virtual void ObjectChanged(const Notifier* object); +}; + +#endif // LISTENER_ADAPTER_H Added: haiku/trunk/src/apps/mediaplayer/support/NOTE =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/NOTE 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/support/NOTE 2007-06-03 21:24:47 UTC (rev 21312) @@ -0,0 +1,3 @@ +This folder contains some generic classes. The same code is used in Icon-O-Matic btw. I should move my lazy butt and place this code somewhere common. Ideas? + +-Stephan Added: haiku/trunk/src/apps/mediaplayer/support/Notifier.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/Notifier.cpp 2007-06-03 20:33:56 UTC (rev 21311) +++ haiku/trunk/src/apps/mediaplayer/support/Notifier.cpp 2007-06-03 21:24:47 UTC (rev 21312) @@ -0,0 +1,105 @@ +/* + * Copyright 2006-2007, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ + +#include "Notifier.h" + +#include +#include + +#include + +#include "Listener.h" + +// constructor +Notifier::Notifier() + : fListeners(2), + fSuspended(0), + fPendingNotifications(false) +{ +} + +// destructor [... truncated: 142 lines follow ...] From axeld at mail.berlios.de Sun Jun 3 23:43:20 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 3 Jun 2007 23:43:20 +0200 Subject: [Haiku-commits] r21313 - haiku/trunk/src/servers/registrar Message-ID: <200706032143.l53LhKJH016587@sheep.berlios.de> Author: axeld Date: 2007-06-03 23:43:20 +0200 (Sun, 03 Jun 2007) New Revision: 21313 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21313&view=rev Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.cpp Log: No longer allow the shutdown window being closed using the shortcut. Patch by Jonas Sundstrom, thanks! Modified: haiku/trunk/src/servers/registrar/ShutdownProcess.cpp =================================================================== --- haiku/trunk/src/servers/registrar/ShutdownProcess.cpp 2007-06-03 21:24:47 UTC (rev 21312) +++ haiku/trunk/src/servers/registrar/ShutdownProcess.cpp 2007-06-03 21:43:20 UTC (rev 21313) @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006, Ingo Weinhold, bonefish at users.sf.net. + * Copyright 2005-2007, Ingo Weinhold, bonefish at users.sf.net. * Distributed under the terms of the MIT License. */ @@ -232,10 +232,16 @@ ~ShutdownWindow() { - for (int32 i = 0; AppInfo *info = (AppInfo*)fAppInfos.ItemAt(i); i++) + for (int32 i = 0; AppInfo *info = (AppInfo*)fAppInfos.ItemAt(i); i++) { delete info; + } } + virtual bool QuitRequested() + { + return false; + } + status_t Init(BMessenger target) { // create the views From axeld at mail.berlios.de Sun Jun 3 23:52:11 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 3 Jun 2007 23:52:11 +0200 Subject: [Haiku-commits] r21314 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200706032152.l53LqBmU017390@sheep.berlios.de> Author: axeld Date: 2007-06-03 23:52:11 +0200 (Sun, 03 Jun 2007) New Revision: 21314 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21314&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Lock.h Log: Fixed an initialization problem of the ReadWriteLock pointed out by geist, also added a comment on how the ownership is used when doing read locking. Thanks! Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Lock.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Lock.h 2007-06-03 21:43:20 UTC (rev 21313) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Lock.h 2007-06-03 21:52:11 UTC (rev 21314) @@ -1,12 +1,15 @@ -/* Lock - simple semaphores, read/write lock implementation - * Roughly based on a Be sample code written by Nathan Schrenk. +/* * - * Copyright 2001-2006, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2001-2007, Axel D?rfler, axeld at pinc-software.de. * This file may be used under the terms of the MIT License. */ #ifndef LOCK_H #define LOCK_H +/*! Simple semaphores, read/write lock implementation + Roughly based on a Be sample code written by Nathan Schrenk. +*/ + #include "system_dependencies.h" #include "Utility.h" @@ -333,11 +336,16 @@ class ReadWriteLock { public: ReadWriteLock(const char *name) + : + fOwner(-1) { Initialize(name); } ReadWriteLock() + : + fSemaphore(-1), + fOwner(-1) { } @@ -362,6 +370,7 @@ status_t Lock() { + // This allows nested locking when holding a write lock thread_id currentThread = find_thread(NULL); if (currentThread == fOwner) { fOwnerCount++; From simontaylor1 at ntlworld.com Sun Jun 3 23:54:03 2007 From: simontaylor1 at ntlworld.com (Simon Taylor) Date: Sun, 03 Jun 2007 22:54:03 +0100 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <20070603230138.1882.11@stippis.WG> References: <16422146379-BeMail@zon> <20070603171138.10591.10@stippis.WG> <20070603193353.424.1@stippis.WG> <46632266.4080802@ntlworld.com> <20070603230138.1882.11@stippis.WG> Message-ID: <4663387B.2000204@ntlworld.com> Stephan Assmus wrote: > Simon Taylor wrote (2007-06-03, 22:19:50 [+0200]): > [shift versus shift] >> Either option would be fine, as long as the user was given clear >> feedback about what was happening. I can definitely see the user often >> wanting to insert new files into a playlist by dropping them into the >> correct place in the playlist window, which would be indicated by a line >> in between the current items where the new ones would be inserted. On >> the other hand, complete replacement would be indicated by a box around >> the entire playlist list view (and perhaps fading out the current >> options too to indicate they will disappear from the list if the user >> continues). >> >> I don't think that having different behaviour depending on the target is >> confusing - the playlist is the ordered list of files, so trying to drag >> files there to me implies "insert these files here in this list". >> Dragging to the media player window implies "you there, play this file now". >> >> In fact I would might remove the modifiers and just have dragging to >> main window replacing the list, and dragging to the list inserting new >> files. I'd still use the technique of fading out the current playlist >> items when the user is dragging files onto the main window to give an >> indication of what will happen (and a hint of where to drag to in order >> to change the behaviour). > > All of the above is/was implemented except for graying out the existing items > when you hover over the player window. The only addition now to what you say > above is that you *can* optionally press shift to get the other behaviour, > but since doing both is now possible without any modifier, I guess it is fine > like it is. Great. I'll remember to check what's already there in future. Nice that it was already so similar to how I feel it should be - that's definitely one of my favourite things about Haiku, doing these little things correctly. > The drag feedback already worked exactly like you discribe, minus the graying > out. The fact replacement needs a modifier for playlist drops probably means the change in feedback from insertion line to box does enough to imply the whole list will be replaced. It might still be a nice addition though. >>>> It may seem inconsistent but it makes sense that dragging files onto >>>> the media player itself replaces the current playing file, whereas >>>> dragging onto a playlist should always append to the playlist, not >>>> replace it. >>> Whatever we end up with, I am strongly considering having an Undo/Redo >>> stack for operations in the Playlist window anyways. I know how >>> frustrating >>> it can be to lose changes on a complicated playlist. >> Yes that would be great. Perhaps whenever a multi-file playlist is >> replaced, auto-save it somewhere for future use. > > I will allow to load/save playlists (not yet implemented). I don't think > autosaving is a good idea. Having undo/redo will solve the problem of > accidentally wiping your minute list. Actually, I use custom playlists almost > never. Maybe at parties. Usually I just drag an album into the player. I > wouldn't want that to get saved somewhere. Yes I'd not really thought through the autosaving. I was thinking it might avoid having to go back through undoing every individual addition in the current playlist to get to the one that was previously replaced. Maybe actions could be grouped a bit in the undo stack to help - so perhaps any set of consecutive actions becomes one undo step. Hmm that's probably not a good idea either. Simon From superstippi at gmx.de Mon Jun 4 00:08:11 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Mon, 04 Jun 2007 00:08:11 +0200 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <4663387B.2000204@ntlworld.com> References: <16422146379-BeMail@zon> <20070603171138.10591.10@stippis.WG> <20070603193353.424.1@stippis.WG> <46632266.4080802@ntlworld.com> <20070603230138.1882.11@stippis.WG> <4663387B.2000204@ntlworld.com> Message-ID: <20070604000811.3834.13@stippis.WG> Simon Taylor wrote (2007-06-03, 23:54:03 [+0200]): > Stephan Assmus wrote: > > Simon Taylor wrote (2007-06-03, 22:19:50 [+0200]): > >> Yes that would be great. Perhaps whenever a multi-file playlist is > >> replaced, auto-save it somewhere for future use. > > > > I will allow to load/save playlists (not yet implemented). I don't think > > autosaving is a good idea. Having undo/redo will solve the problem of > > accidentally wiping your minute list. Actually, I use custom playlists > > almost > > never. Maybe at parties. Usually I just drag an album into the player. I > > wouldn't want that to get saved somewhere. > > Yes I'd not really thought through the autosaving. I was thinking it > might avoid having to go back through undoing every individual addition > in the current playlist to get to the one that was previously replaced. > Maybe actions could be grouped a bit in the undo stack to help - so > perhaps any set of consecutive actions becomes one undo step. Hmm that's > probably not a good idea either. I'd just go with the intuitive/simple thing and allow to load and save playlists. Best regards, -Stephan From axeld at mail.berlios.de Mon Jun 4 00:55:16 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 4 Jun 2007 00:55:16 +0200 Subject: [Haiku-commits] r21315 - haiku/trunk/src/system/kernel Message-ID: <200706032255.l53MtGdc025997@sheep.berlios.de> Author: axeld Date: 2007-06-04 00:55:09 +0200 (Mon, 04 Jun 2007) New Revision: 21315 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21315&view=rev Modified: haiku/trunk/src/system/kernel/module.cpp Log: * Applied a patch by Siarzhuk Zharski that allows open_module_list() to be used during early boot. Thanks! * Fixed open_module_list() so that it can deal with a NULL prefix. * Added a note that get_next_loaded_module_name() is implemented incorrectly. * Minor cleanup. Modified: haiku/trunk/src/system/kernel/module.cpp =================================================================== --- haiku/trunk/src/system/kernel/module.cpp 2007-06-03 21:52:11 UTC (rev 21314) +++ haiku/trunk/src/system/kernel/module.cpp 2007-06-03 22:55:09 UTC (rev 21315) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Copyright 2001, Thomas Kurschel. All rights reserved. @@ -130,6 +130,7 @@ uint32 path_base_length; const char *current_module_path; bool builtin_modules; + bool loaded_modules; } module_iterator; @@ -693,31 +694,62 @@ static status_t -iterator_get_next_module(module_iterator *iterator, char *buffer, size_t *_bufferSize) +iterator_get_next_module(module_iterator *iterator, char *buffer, + size_t *_bufferSize) { status_t status; TRACE(("iterator_get_next_module() -- start\n")); if (iterator->builtin_modules) { - int32 i; - - for (i = iterator->module_offset; sBuiltInModules[i] != NULL; i++) { + for (int32 i = iterator->module_offset; sBuiltInModules[i] != NULL; i++) { // the module name must fit the prefix - if (strncmp(sBuiltInModules[i]->name, iterator->prefix, iterator->prefix_length)) + if (strncmp(sBuiltInModules[i]->name, iterator->prefix, + iterator->prefix_length)) continue; - *_bufferSize = strlcpy(buffer, sBuiltInModules[i]->name, *_bufferSize); + *_bufferSize = strlcpy(buffer, sBuiltInModules[i]->name, + *_bufferSize); iterator->module_offset = i + 1; return B_OK; } iterator->builtin_modules = false; } + if (iterator->loaded_modules) { + recursive_lock_lock(&sModulesLock); + hash_iterator hashIterator; + hash_open(sModulesHash, &hashIterator); + + struct module *module = (struct module *)hash_next(sModulesHash, + &hashIterator); + for (int32 i = 0; module != NULL; i++) { + if (i >= iterator->module_offset) { + if (!strncmp(module->name, iterator->prefix, + iterator->prefix_length)) { + *_bufferSize = strlcpy(buffer, module->name, *_bufferSize); + iterator->module_offset = i + 1; + + hash_close(sModulesHash, &hashIterator, false); + recursive_lock_unlock(&sModulesLock); + return B_OK; + } + } + module = (struct module *)hash_next(sModulesHash, &hashIterator); + } + + hash_close(sModulesHash, &hashIterator, false); + recursive_lock_unlock(&sModulesLock); + + // prevent from falling into modules hash iteration again + iterator->loaded_modules = false; + } + nextPath: if (iterator->current_dir == NULL) { // get next directory path from the stack - const char *path = iterator_pop_path_from_stack(iterator, &iterator->path_base_length); + const char *path = iterator_pop_path_from_stack(iterator, + &iterator->path_base_length); if (path == NULL) { // we are finished, there are no more entries on the stack return B_ENTRY_NOT_FOUND; @@ -755,7 +787,8 @@ // check if the prefix matches int32 passedOffset, commonLength; passedOffset = strlen(iterator->current_path) + 1; - commonLength = iterator->path_base_length + iterator->prefix_length - passedOffset; + commonLength = iterator->path_base_length + iterator->prefix_length + - passedOffset; if (commonLength > 0) { // the prefix still reaches into the new path part @@ -763,8 +796,8 @@ if (commonLength > length) commonLength = length; - if (strncmp(dirent->d_name, - iterator->prefix + passedOffset - iterator->path_base_length, commonLength)) + if (strncmp(dirent->d_name, iterator->prefix + passedOffset + - iterator->path_base_length, commonLength)) goto nextModuleImage; } @@ -791,8 +824,8 @@ return B_NO_MEMORY; if (S_ISDIR(st.st_mode)) { - status = iterator_push_path_on_stack(iterator, iterator->current_module_path, - iterator->path_base_length); + status = iterator_push_path_on_stack(iterator, + iterator->current_module_path, iterator->path_base_length); if (status < B_OK) return status; @@ -1058,12 +1091,6 @@ * contain all modules available under the prefix. * The structure is then used by read_next_module_name(), and * must be freed by calling close_module_list(). - * - * During early boot, when there is no boot device accessible, - * it will only find built-in modules, not those that have - * been preloaded - use get_next_loaded_module_name() instead - * if you need to have a list of loaded modules. - * ToDo: this could be changed */ void * @@ -1085,36 +1112,45 @@ memset(iterator, 0, sizeof(module_iterator)); - // ToDo: possibly, the prefix don't have to be copied, just referenced - iterator->prefix = strdup(prefix ? prefix : ""); + iterator->prefix = strdup(prefix != NULL ? prefix : ""); if (iterator->prefix == NULL) { free(iterator); return NULL; } - iterator->prefix_length = strlen(prefix); + iterator->prefix_length = strlen(iterator->prefix); - // first, we'll traverse over the built-in modules - iterator->builtin_modules = true; + if (gBootDevice > 0) { + // We do have a boot device to scan - // put all search paths on the stack - for (i = 0; i < NUM_MODULE_PATHS; i++) { - if (sDisableUserAddOns && i >= FIRST_USER_MODULE_PATH) - break; + // first, we'll traverse over the built-in modules + iterator->builtin_modules = true; + iterator->loaded_modules = false; - // Build path component: base path + '/' + prefix - size_t length = strlen(sModulePaths[i]); - char *path = (char *)malloc(length + iterator->prefix_length + 2); - if (path == NULL) { - // ToDo: should we abort the whole operation here? - // if we do, don't forget to empty the stack - continue; - } + // put all search paths on the stack + for (i = 0; i < NUM_MODULE_PATHS; i++) { + if (sDisableUserAddOns && i >= FIRST_USER_MODULE_PATH) + break; - memcpy(path, sModulePaths[i], length); - path[length] = '/'; - memcpy(path + length + 1, prefix, iterator->prefix_length + 1); + // Build path component: base path + '/' + prefix + size_t length = strlen(sModulePaths[i]); + char *path = (char *)malloc(length + iterator->prefix_length + 2); + if (path == NULL) { + // ToDo: should we abort the whole operation here? + // if we do, don't forget to empty the stack + continue; + } - iterator_push_path_on_stack(iterator, path, length + 1); + memcpy(path, sModulePaths[i], length); + path[length] = '/'; + memcpy(path + length + 1, iterator->prefix, + iterator->prefix_length + 1); + + iterator_push_path_on_stack(iterator, path, length + 1); + } + } else { + // include loaded modules in case there is no boot device yet + iterator->builtin_modules = false; + iterator->loaded_modules = true; } return (void *)iterator; @@ -1158,7 +1194,7 @@ /** Return the next module name from the available list, using - * a structure previously created by a call to open_module_list. + * a structure previously created by a call to open_module_list(). * Returns B_OK as long as it found another module, B_ENTRY_NOT_FOUND * when done. */ @@ -1221,6 +1257,8 @@ } recursive_lock_lock(&sModulesLock); + + // TODO: this is completely unsafe!!! struct module *module = (struct module *)hash_next(sModulesHash, iterator); if (module != NULL) { From axeld at mail.berlios.de Mon Jun 4 01:10:00 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 4 Jun 2007 01:10:00 +0200 Subject: [Haiku-commits] r21316 - haiku/trunk/src/system/kernel Message-ID: <200706032310.l53NA0nC009954@sheep.berlios.de> Author: axeld Date: 2007-06-04 01:09:59 +0200 (Mon, 04 Jun 2007) New Revision: 21316 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21316&view=rev Modified: haiku/trunk/src/system/kernel/module.cpp Log: get_next_loaded_module_name() now uses the same (inefficient) mechanism read_next_module_name() is using thanks to Siarzhuk - the previous mechanism was completely unsafe. Modified: haiku/trunk/src/system/kernel/module.cpp =================================================================== --- haiku/trunk/src/system/kernel/module.cpp 2007-06-03 22:55:09 UTC (rev 21315) +++ haiku/trunk/src/system/kernel/module.cpp 2007-06-03 23:09:59 UTC (rev 21316) @@ -1245,30 +1245,27 @@ if (_cookie == NULL || buffer == NULL || _bufferSize == NULL) return B_BAD_VALUE; - hash_iterator *iterator = (hash_iterator *)*_cookie; - status_t status; + status_t status = B_ENTRY_NOT_FOUND; + uint32 offset = *_cookie; - if (iterator == NULL) { - iterator = hash_open(sModulesHash, NULL); - if (iterator == NULL) - return B_NO_MEMORY; - - *(hash_iterator **)_cookie = iterator; - } - recursive_lock_lock(&sModulesLock); - - // TODO: this is completely unsafe!!! - struct module *module = (struct module *)hash_next(sModulesHash, iterator); - if (module != NULL) { - *_bufferSize = strlcpy(buffer, module->name, *_bufferSize); - status = B_OK; - } else { - hash_close(sModulesHash, iterator, true); - status = B_ENTRY_NOT_FOUND; + hash_iterator iterator; + hash_open(sModulesHash, &iterator); + struct module *module = (struct module *)hash_next(sModulesHash, + &iterator); + + for (uint32 i = 0; module != NULL; i++) { + if (i >= offset) { + *_bufferSize = strlcpy(buffer, module->name, *_bufferSize); + *_cookie = i + 1; + status = B_OK; + break; + } + module = (struct module *)hash_next(sModulesHash, &iterator); } + hash_close(sModulesHash, &iterator, false); recursive_lock_unlock(&sModulesLock); return status; From axeld at pinc-software.de Mon Jun 4 01:23:57 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 04 Jun 2007 01:23:57 +0200 CEST Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <20070603230138.1882.11@stippis.WG> Message-ID: <46794842346-BeMail@zon> Stephan Assmus wrote: > > Yes that would be great. Perhaps whenever a multi-file playlist is > > replaced, auto-save it somewhere for future use. > I will allow to load/save playlists (not yet implemented). I don't > think > autosaving is a good idea. Having undo/redo will solve the problem of > accidentally wiping your minute list. Actually, I use custom > playlists almost > never. Maybe at parties. Usually I just drag an album into the > player. I > wouldn't want that to get saved somewhere. At least I like that SoundPlay resumes the playback at the song where I left the computer the day before; but I agree that not everyone would like that, especially in a standard media player (that does more than just playing music). Bye, Axel. From superstippi at gmx.de Mon Jun 4 01:52:54 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Mon, 04 Jun 2007 01:52:54 +0200 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <46794842346-BeMail@zon> References: <46794842346-BeMail@zon> Message-ID: <20070604015254.4326.15@stippis.WG> Axel D?rfler wrote (2007-06-04, 01:23:57 [+0200]): > Stephan Assmus wrote: > > > Yes that would be great. Perhaps whenever a multi-file playlist is > > > replaced, auto-save it somewhere for future use. > > I will allow to load/save playlists (not yet implemented). I don't > > think > > autosaving is a good idea. Having undo/redo will solve the problem of > > accidentally wiping your minute list. Actually, I use custom > > playlists almost > > never. Maybe at parties. Usually I just drag an album into the > > player. I > > wouldn't want that to get saved somewhere. > > At least I like that SoundPlay resumes the playback at the song where I > left the computer the day before; but I agree that not everyone would > like that, especially in a standard media player (that does more than > just playing music). I want that feature too, but that's just persistence. It doesn't require to save any and all playlists, just the current one when you quit the program. Best regards, -Stephan From stippi at mail.berlios.de Mon Jun 4 03:00:07 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 4 Jun 2007 03:00:07 +0200 Subject: [Haiku-commits] r21317 - in haiku/trunk/src/apps/mediaplayer: . playlist support Message-ID: <200706040100.l54107Y5015509@sheep.berlios.de> Author: stippi Date: 2007-06-04 03:00:03 +0200 (Mon, 04 Jun 2007) New Revision: 21317 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21317&view=rev Added: haiku/trunk/src/apps/mediaplayer/playlist/ haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.cpp haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.h haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.cpp haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.h haiku/trunk/src/apps/mediaplayer/playlist/ListViews.cpp haiku/trunk/src/apps/mediaplayer/playlist/ListViews.h haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.cpp haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.h haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.cpp haiku/trunk/src/apps/mediaplayer/playlist/PlaylistListView.h haiku/trunk/src/apps/mediaplayer/playlist/PlaylistObserver.cpp haiku/trunk/src/apps/mediaplayer/playlist/PlaylistObserver.h haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.cpp haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.h haiku/trunk/src/apps/mediaplayer/support/AutoLocker.h haiku/trunk/src/apps/mediaplayer/support/RWLocker.cpp haiku/trunk/src/apps/mediaplayer/support/RWLocker.h Removed: haiku/trunk/src/apps/mediaplayer/ListViews.cpp haiku/trunk/src/apps/mediaplayer/ListViews.h haiku/trunk/src/apps/mediaplayer/Playlist.cpp haiku/trunk/src/apps/mediaplayer/Playlist.h haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp haiku/trunk/src/apps/mediaplayer/PlaylistListView.h haiku/trunk/src/apps/mediaplayer/PlaylistObserver.cpp haiku/trunk/src/apps/mediaplayer/PlaylistObserver.h haiku/trunk/src/apps/mediaplayer/PlaylistWindow.cpp haiku/trunk/src/apps/mediaplayer/PlaylistWindow.h Modified: haiku/trunk/src/apps/mediaplayer/Jamfile Log: * probably fixed the build, did I forget some files before? * implemented full undo/redo for any playlist operations Modified: haiku/trunk/src/apps/mediaplayer/Jamfile =================================================================== --- haiku/trunk/src/apps/mediaplayer/Jamfile 2007-06-03 23:09:59 UTC (rev 21316) +++ haiku/trunk/src/apps/mediaplayer/Jamfile 2007-06-04 01:00:03 UTC (rev 21317) @@ -6,6 +6,7 @@ # source directories local sourceDirs = + playlist supplier support ; @@ -16,6 +17,17 @@ } Application MediaPlayer : + # playlist + CopyPLItemsCommand.cpp + ImportPLItemsCommand.cpp + ListViews.cpp + MovePLItemsCommand.cpp + Playlist.cpp + PlaylistListView.cpp + PlaylistObserver.cpp + PlaylistWindow.cpp + RemovePLItemsCommand.cpp + # supplier AudioSupplier.cpp MediaTrackAudioSupplier.cpp @@ -37,13 +49,8 @@ ControllerView.cpp DrawingTidbits.cpp InfoWin.cpp - ListViews.cpp MainApp.cpp MainWin.cpp - Playlist.cpp - PlaylistListView.cpp - PlaylistObserver.cpp - PlaylistWindow.cpp SoundOutput.cpp TransportButton.cpp TransportControlGroup.cpp Deleted: haiku/trunk/src/apps/mediaplayer/ListViews.cpp Deleted: haiku/trunk/src/apps/mediaplayer/ListViews.h Deleted: haiku/trunk/src/apps/mediaplayer/Playlist.cpp Deleted: haiku/trunk/src/apps/mediaplayer/Playlist.h Deleted: haiku/trunk/src/apps/mediaplayer/PlaylistListView.cpp Deleted: haiku/trunk/src/apps/mediaplayer/PlaylistListView.h Deleted: haiku/trunk/src/apps/mediaplayer/PlaylistObserver.cpp Deleted: haiku/trunk/src/apps/mediaplayer/PlaylistObserver.h Deleted: haiku/trunk/src/apps/mediaplayer/PlaylistWindow.cpp Deleted: haiku/trunk/src/apps/mediaplayer/PlaylistWindow.h Added: haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.cpp 2007-06-03 23:09:59 UTC (rev 21316) +++ haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.cpp 2007-06-04 01:00:03 UTC (rev 21317) @@ -0,0 +1,116 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ + +#include "CopyPLItemsCommand.h" + +#include +#include + +#include + +#include "Playlist.h" + + +using std::nothrow; + + +CopyPLItemsCommand::CopyPLItemsCommand(Playlist* playlist, + const int32* indices, int32 count, int32 toIndex) + : Command() + , fPlaylist(playlist) + , fRefs(count > 0 ? new (nothrow) entry_ref[count] : NULL) + , fToIndex(toIndex) + , fCount(count) +{ + if (!indices || !fPlaylist || !fRefs) { + // indicate a bad object state + delete[] fRefs; + fRefs = NULL; + return; + } + + // init original entries and + for (int32 i = 0; i < fCount; i++) { + if (fPlaylist->GetRefAt(indices[i], &fRefs[i]) < B_OK) { + delete[] fRefs; + fRefs = NULL; + return; + } + } +} + + +CopyPLItemsCommand::~CopyPLItemsCommand() +{ + delete[] fRefs; +} + + +status_t +CopyPLItemsCommand::InitCheck() +{ + if (!fPlaylist || !fRefs) + return B_NO_INIT; + return B_OK; +} + + +status_t +CopyPLItemsCommand::Perform() +{ + BAutolock _(fPlaylist); + + status_t ret = B_OK; + + // add refs to playlist at the insertion index + int32 index = fToIndex; + for (int32 i = 0; i < fCount; i++) { + if (!fPlaylist->AddRef(fRefs[i], index++)) { + ret = B_NO_MEMORY; + break; + } + } + if (ret < B_OK) + return ret; + + return B_OK; +} + + +status_t +CopyPLItemsCommand::Undo() +{ + BAutolock _(fPlaylist); + + // remember currently playling ref in case we copy items over it + entry_ref currentRef; + bool adjustCurrentRef = fPlaylist->GetRefAt(fPlaylist->CurrentRefIndex(), + ¤tRef) == B_OK; + + // remove refs from playlist + int32 index = fToIndex; + for (int32 i = 0; i < fCount; i++) { + fPlaylist->RemoveRef(index++, false); + } + + // take care about currently played ref + if (adjustCurrentRef) + fPlaylist->SetCurrentRefIndex(fPlaylist->IndexOf(currentRef)); + + return B_OK; +} + + +void +CopyPLItemsCommand::GetName(BString& name) +{ + if (fCount > 1) + name << "Copy Entries"; + else + name << "Copy Entry"; +} Added: haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.h 2007-06-03 23:09:59 UTC (rev 21316) +++ haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.h 2007-06-04 01:00:03 UTC (rev 21317) @@ -0,0 +1,39 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ +#ifndef COPY_PL_ITEMS_COMMAND_H +#define COPY_PL_ITEMS_COMMAND_H + + +#include "Command.h" + +class Playlist; + +class CopyPLItemsCommand : public Command { + public: + CopyPLItemsCommand( + Playlist* playlist, + const int32* indices, + int32 count, + int32 toIndex); + virtual ~CopyPLItemsCommand(); + + virtual status_t InitCheck(); + + virtual status_t Perform(); + virtual status_t Undo(); + + virtual void GetName(BString& name); + + private: + Playlist* fPlaylist; + entry_ref* fRefs; + int32 fToIndex; + int32 fCount; +}; + +#endif // COPY_PL_ITEMS_COMMAND_H Added: haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.cpp 2007-06-03 23:09:59 UTC (rev 21316) +++ haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.cpp 2007-06-04 01:00:03 UTC (rev 21317) @@ -0,0 +1,156 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ + +#include "ImportPLItemsCommand.h" + +#include +#include + +#include + +#include "Playlist.h" + + +using std::nothrow; + + +ImportPLItemsCommand::ImportPLItemsCommand(Playlist* playlist, + const BMessage* refsMessage, int32 toIndex) + : Command() + , fPlaylist(playlist) + + , fOldRefs(NULL) + , fOldCount(0) + + , fNewRefs(NULL) + , fNewCount(0) + + , fToIndex(toIndex) +{ + if (!fPlaylist) + return; + + Playlist temp; + temp.AppendRefs(refsMessage); + + fNewCount = temp.CountItems(); + if (fNewCount <= 0) + return; + + fNewRefs = new (nothrow) entry_ref[fNewCount]; + if (!fNewRefs) + return; + + // init new entries + for (int32 i = 0; i < fNewCount; i++) { + if (temp.GetRefAt(i, &fNewRefs[i]) < B_OK) { + delete[] fNewRefs; + fNewRefs = NULL; + return; + } + } + + if (fToIndex < 0) { + fOldCount = fPlaylist->CountItems(); + if (fOldCount > 0) { + fOldRefs = new (nothrow) entry_ref[fOldCount]; + if (!fOldRefs) { + // indicate bad object init + delete[] fNewRefs; + fNewRefs = NULL; + return; + } + } + } + + for (int32 i = 0; i < fOldCount; i++) { + if (fPlaylist->GetRefAt(i, &fOldRefs[i]) < B_OK) { + // indicate bad object init + delete[] fNewRefs; + fNewRefs = NULL; + return; + } + } +} + + +ImportPLItemsCommand::~ImportPLItemsCommand() +{ + delete[] fOldRefs; + delete[] fNewRefs; +} + + +status_t +ImportPLItemsCommand::InitCheck() +{ + if (!fPlaylist || !fNewRefs) + return B_NO_INIT; + return B_OK; +} + + +status_t +ImportPLItemsCommand::Perform() +{ + BAutolock _(fPlaylist); + + int32 index = fToIndex; + if (fToIndex < 0) { + fPlaylist->MakeEmpty(); + index = 0; + } + + bool startPlaying = fPlaylist->CountItems() == 0; + + // add refs to playlist at the insertion index + for (int32 i = 0; i < fNewCount; i++) { + if (!fPlaylist->AddRef(fNewRefs[i], index++)) + return B_NO_MEMORY; + } + + if (startPlaying) { + // open first file + fPlaylist->SetCurrentRefIndex(0); + } + + return B_OK; +} + + +status_t +ImportPLItemsCommand::Undo() +{ + BAutolock _(fPlaylist); + + if (fToIndex < 0) { + // remove new refs from playlist and restore old refs + fPlaylist->MakeEmpty(); + for (int32 i = 0; i < fOldCount; i++) { + if (!fPlaylist->AddRef(fOldRefs[i], i)) + return B_NO_MEMORY; + } + } else { + // remove refs from playlist + for (int32 i = 0; i < fNewCount; i++) { + fPlaylist->RemoveRef(fToIndex); + } + } + + return B_OK; +} + + +void +ImportPLItemsCommand::GetName(BString& name) +{ + if (fNewCount > 1) + name << "Import Entries"; + else + name << "Import Entry"; +} Added: haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.h 2007-06-03 23:09:59 UTC (rev 21316) +++ haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.h 2007-06-04 01:00:03 UTC (rev 21317) @@ -0,0 +1,41 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ +#ifndef IMPORT_PL_ITEMS_COMMAND_H +#define IMPORT_PL_ITEMS_COMMAND_H + + +#include "Command.h" + +class BMessage; +class Playlist; + +class ImportPLItemsCommand : public Command { + public: + ImportPLItemsCommand( + Playlist* playlist, + const BMessage* refsMessage, + int32 toIndex); + virtual ~ImportPLItemsCommand(); + + virtual status_t InitCheck(); + + virtual status_t Perform(); + virtual status_t Undo(); + + virtual void GetName(BString& name); + + private: + Playlist* fPlaylist; + entry_ref* fOldRefs; + int32 fOldCount; + entry_ref* fNewRefs; + int32 fNewCount; + int32 fToIndex; +}; + +#endif // IMPORT_PL_ITEMS_COMMAND_H Copied: haiku/trunk/src/apps/mediaplayer/playlist/ListViews.cpp (from rev 21309, haiku/trunk/src/apps/mediaplayer/ListViews.cpp) Copied: haiku/trunk/src/apps/mediaplayer/playlist/ListViews.h (from rev 21305, haiku/trunk/src/apps/mediaplayer/ListViews.h) Added: haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.cpp 2007-06-03 23:09:59 UTC (rev 21316) +++ haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.cpp 2007-06-04 01:00:03 UTC (rev 21317) @@ -0,0 +1,181 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ + +#include "MovePLItemsCommand.h" + +#include +#include + +#include + +#include "Playlist.h" + + +using std::nothrow; + + +MovePLItemsCommand::MovePLItemsCommand(Playlist* playlist, + const int32* indices, int32 count, int32 toIndex) + : Command() + , fPlaylist(playlist) + , fRefs(count > 0 ? new (nothrow) entry_ref[count] : NULL) + , fIndices(count > 0 ? new (nothrow) int32[count] : NULL) + , fToIndex(toIndex) + , fCount(count) +{ + if (!indices || !fPlaylist || !fRefs || !fIndices) { + // indicate a bad object state + delete[] fRefs; + fRefs = NULL; + return; + } + + memcpy(fIndices, indices, fCount * sizeof(int32)); + + // init original entry indices and + // adjust toIndex compensating for items that + // are removed before that index + int32 itemsBeforeIndex = 0; + for (int32 i = 0; i < fCount; i++) { + if (fPlaylist->GetRefAt(fIndices[i], &fRefs[i]) < B_OK) { + delete[] fRefs; + fRefs = NULL; + return; + } + if (fIndices[i] < fToIndex) + itemsBeforeIndex++; + } + fToIndex -= itemsBeforeIndex; +} + + +MovePLItemsCommand::~MovePLItemsCommand() +{ + delete[] fRefs; + delete[] fIndices; +} + + +status_t +MovePLItemsCommand::InitCheck() +{ + if (!fPlaylist || !fRefs || !fIndices) + return B_NO_INIT; + + // analyse the move, don't return B_OK in case + // the container state does not change... + + int32 index = fIndices[0]; + // NOTE: fIndices == NULL if fCount < 1 + + if (index != fToIndex) { + // a change is guaranteed + return B_OK; + } + + // the insertion index is the same as the index of the first + // moved item, a change only occures if the indices of the + // moved items is not contiguous + bool isContiguous = true; + for (int32 i = 1; i < fCount; i++) { + if (fIndices[i] != index + 1) { + isContiguous = false; + break; + } + index = fIndices[i]; + } + if (isContiguous) { + // the container state will not change because of the move + return B_ERROR; + } + + return B_OK; +} + + +status_t +MovePLItemsCommand::Perform() +{ + BAutolock _(fPlaylist); + + status_t ret = B_OK; + + // remember currently playling ref in case we move it + entry_ref currentRef; + bool adjustCurrentRef = fPlaylist->GetRefAt(fPlaylist->CurrentRefIndex(), + ¤tRef) == B_OK; + + // remove refs from playlist + for (int32 i = 0; i < fCount; i++) { + // "- i" to account for the items already removed + fPlaylist->RemoveRef(fIndices[i] - i, false); + } + + // add refs to playlist at the insertion index + int32 index = fToIndex; + for (int32 i = 0; i < fCount; i++) { + if (!fPlaylist->AddRef(fRefs[i], index++)) { + ret = B_NO_MEMORY; + break; + } + } + if (ret < B_OK) + return ret; + + // take care about currently played ref + if (adjustCurrentRef) + fPlaylist->SetCurrentRefIndex(fPlaylist->IndexOf(currentRef)); + + return B_OK; +} + + +status_t +MovePLItemsCommand::Undo() +{ + BAutolock _(fPlaylist); + + status_t ret = B_OK; + + // remember currently playling ref in case we move it + entry_ref currentRef; + bool adjustCurrentRef = fPlaylist->GetRefAt(fPlaylist->CurrentRefIndex(), + ¤tRef) == B_OK; + + // remove refs from playlist + int32 index = fToIndex; + for (int32 i = 0; i < fCount; i++) { + fPlaylist->RemoveRef(index++, false); + } + + // add ref to playlist at remembered indices + for (int32 i = 0; i < fCount; i++) { + if (!fPlaylist->AddRef(fRefs[i], fIndices[i])) { + ret = B_NO_MEMORY; + break; + } + } + if (ret < B_OK) + return ret; + + // take care about currently played ref + if (adjustCurrentRef) + fPlaylist->SetCurrentRefIndex(fPlaylist->IndexOf(currentRef)); + + return B_OK; +} + + +void +MovePLItemsCommand::GetName(BString& name) +{ + if (fCount > 1) + name << "Move Entries"; + else + name << "Move Entry"; +} Added: haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.h 2007-06-03 23:09:59 UTC (rev 21316) +++ haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.h 2007-06-04 01:00:03 UTC (rev 21317) @@ -0,0 +1,40 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan A?mus + */ +#ifndef MOVE_PL_ITEMS_COMMAND_H +#define MOVE_PL_ITEMS_COMMAND_H + + +#include "Command.h" + +class Playlist; + +class MovePLItemsCommand : public Command { + public: + MovePLItemsCommand( + Playlist* playlist, + const int32* indices, + int32 count, + int32 toIndex); + virtual ~MovePLItemsCommand(); + + virtual status_t InitCheck(); + + virtual status_t Perform(); + virtual status_t Undo(); + + virtual void GetName(BString& name); + + private: + Playlist* fPlaylist; + entry_ref* fRefs; + int32* fIndices; + int32 fToIndex; + int32 fCount; +}; + +#endif // MOVE_PL_ITEMS_COMMAND_H Copied: haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp (from rev 21305, haiku/trunk/src/apps/mediaplayer/Playlist.cpp) =================================================================== --- haiku/trunk/src/apps/mediaplayer/Playlist.cpp 2007-06-03 14:35:48 UTC (rev 21305) +++ haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp 2007-06-04 01:00:03 UTC (rev 21317) @@ -0,0 +1,381 @@ +/* + * Playlist.cpp - Media Player for the Haiku Operating System + * + * Copyright (C) 2006 Marcus Overhagen + * Copyright (C) 2007 Stephan A?mus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#include "Playlist.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +using std::nothrow; + +// TODO: using BList for objects is bad, replace it with a template + +Playlist::Listener::Listener() {} +Playlist::Listener::~Listener() {} +void Playlist::Listener::RefAdded(const entry_ref& ref, int32 index) {} +void Playlist::Listener::RefRemoved(int32 index) {} +void Playlist::Listener::RefsSorted() {} +void Playlist::Listener::CurrentRefChanged(int32 newIndex) {} + + +// #pragma mark - + + +Playlist::Playlist() + : BLocker("playlist lock") + , fRefs() + , fCurrentIndex(-1) +{ +} + + +Playlist::~Playlist() +{ + MakeEmpty(); + + if (fListeners.CountItems() > 0) + debugger("Playlist::~Playlist() - there are still listeners attached!"); +} + + +void +Playlist::MakeEmpty() +{ + int32 count = fRefs.CountItems(); + for (int32 i = count - 1; i >= 0; i--) { + entry_ref* ref = (entry_ref*)fRefs.RemoveItem(i); + _NotifyRefRemoved(i); + delete ref; + } + SetCurrentRefIndex(-1); +} + + +int32 +Playlist::CountItems() const +{ + return fRefs.CountItems(); +} + + +void +Playlist::Sort() +{ + fRefs.SortItems(playlist_cmp); + _NotifyRefsSorted(); +} + + +bool +Playlist::AddRef(const entry_ref &ref) +{ + return AddRef(ref, CountItems()); +} + + +bool +Playlist::AddRef(const entry_ref &ref, int32 index) +{ + entry_ref* copy = new (nothrow) entry_ref(ref); + if (!copy) + return false; + if (!fRefs.AddItem(copy, index)) { + delete copy; + return false; + } + _NotifyRefAdded(ref, index); + + if (index <= fCurrentIndex) + SetCurrentRefIndex(fCurrentIndex + 1); + + return true; +} + + +bool +Playlist::AdoptPlaylist(Playlist& other) +{ + return AdoptPlaylist(other, CountItems()); +} + + +bool +Playlist::AdoptPlaylist(Playlist& other, int32 index) +{ + if (&other == this) + return false; + // NOTE: this is not intended to merge two "equal" playlists + // the given playlist is assumed to be a temporary "dummy" + if (fRefs.AddList(&other.fRefs, index)) { + // take care of the notifications + int32 count = other.fRefs.CountItems(); + for (int32 i = index; i < index + count; i++) { + entry_ref* ref = (entry_ref*)fRefs.ItemAtFast(i); + _NotifyRefAdded(*ref, i); + } + if (index <= fCurrentIndex) + SetCurrentRefIndex(fCurrentIndex + count); + // empty the other list, so that the entry_refs are no ours + other.fRefs.MakeEmpty(); + return true; + } + return false; +} + + +entry_ref +Playlist::RemoveRef(int32 index, bool careAboutCurrentIndex) +{ + entry_ref _ref; + entry_ref* ref = (entry_ref*)fRefs.RemoveItem(index); + if (!ref) + return _ref; + _NotifyRefRemoved(index); + _ref = *ref; + delete ref; + + if (careAboutCurrentIndex) { + if (index == fCurrentIndex) + SetCurrentRefIndex(-1); + else if (index < fCurrentIndex) + SetCurrentRefIndex(fCurrentIndex - 1); + } + + return _ref; +} + + +int32 +Playlist::IndexOf(const entry_ref& _ref) const +{ + int32 count = CountItems(); + for (int32 i = 0; i < count; i++) { + entry_ref* ref = (entry_ref*)fRefs.ItemAtFast(i); + if (*ref == _ref) + return i; + } + return -1; +} + + +status_t +Playlist::GetRefAt(int32 index, entry_ref* _ref) const +{ + if (!_ref) + return B_BAD_VALUE; + entry_ref* ref = (entry_ref*)fRefs.ItemAt(index); + if (!ref) + return B_BAD_INDEX; + *_ref = *ref; + + return B_OK; +} + + +//bool +//Playlist::HasRef(const entry_ref& ref) const +//{ +// return IndexOf(ref) >= 0; +//} + + + +// #pragma mark - + + +void +Playlist::SetCurrentRefIndex(int32 index) +{ + if (index == fCurrentIndex) + return; + + fCurrentIndex = index; + _NotifyCurrentRefChanged(fCurrentIndex); +} + + +int32 +Playlist::CurrentRefIndex() const +{ + return fCurrentIndex; +} + + +void +Playlist::GetSkipInfo(bool* canSkipPrevious, bool* canSkipNext) const +{ + if (canSkipPrevious) + *canSkipPrevious = fCurrentIndex > 0; + if (canSkipNext) + *canSkipNext = fCurrentIndex < CountItems() - 1; +} + + +// pragma mark - + + +bool +Playlist::AddListener(Listener* listener) +{ + BAutolock _(this); + if (listener && !fListeners.HasItem(listener)) + return fListeners.AddItem(listener); + return false; +} + + +void +Playlist::RemoveListener(Listener* listener) +{ + BAutolock _(this); + fListeners.RemoveItem(listener); +} + + +// #pragma mark - + + +void +Playlist::AppendRefs(const BMessage* refsReceivedMessage, int32 appendIndex) +{ + // the playlist ist replaced by the refs in the message + // or the refs are appended at the appendIndex + // in the existing playlist + bool add = appendIndex >= 0; + + if (!add) + MakeEmpty(); + + bool startPlaying = CountItems() == 0; + + Playlist temporaryPlaylist; + Playlist* playlist = add ? &temporaryPlaylist : this; + + entry_ref ref; + for (int i = 0; refsReceivedMessage->FindRef("refs", i, &ref) == B_OK; i++) + AppendToPlaylistRecursive(ref, playlist); + + playlist->Sort(); + + if (add) + AdoptPlaylist(temporaryPlaylist, appendIndex); + + if (startPlaying) { + // open first file + SetCurrentRefIndex(0); + } +} + + +/*static*/ void +Playlist::AppendToPlaylistRecursive(const entry_ref& ref, Playlist* playlist) +{ + // recursively append the ref (dive into folders) + BEntry entry(&ref, true); + if (entry.InitCheck() < B_OK) + return; + if (!entry.Exists()) + return; + if (entry.IsDirectory()) { + BDirectory dir(&entry); + if (dir.InitCheck() < B_OK) + return; + entry.Unset(); + entry_ref subRef; + while (dir.GetNextRef(&subRef) == B_OK) + AppendToPlaylistRecursive(subRef, playlist); + } else if (entry.IsFile()) { + playlist->AddRef(ref); + } +} + + +// #pragma mark - [... truncated: 1833 lines follow ...] From nielx at mail.berlios.de Mon Jun 4 08:37:04 2007 From: nielx at mail.berlios.de (nielx at BerliOS) Date: Mon, 4 Jun 2007 08:37:04 +0200 Subject: [Haiku-commits] r21318 - haiku/trunk/docs/user/support Message-ID: <200706040637.l546b4P4017387@sheep.berlios.de> Author: nielx Date: 2007-06-04 08:37:04 +0200 (Mon, 04 Jun 2007) New Revision: 21318 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21318&view=rev Modified: haiku/trunk/docs/user/support/Archivable.dox Log: Patch by Thom Holwerda. Proofreading. Modified: haiku/trunk/docs/user/support/Archivable.dox =================================================================== --- haiku/trunk/docs/user/support/Archivable.dox 2007-06-04 01:00:03 UTC (rev 21317) +++ haiku/trunk/docs/user/support/Archivable.dox 2007-06-04 06:37:04 UTC (rev 21318) @@ -3,12 +3,15 @@ * Distributed under the terms of the MIT License. * * Author: - * Niels Sascha Reedijk + * Niels Sascha Reedijk + * * Proofreader: - * David Weizades + * David Weizades + * Thom Holwerda + * * Corresponds to: - * /trunk/headers/os/support/Archivable.h rev 19972 - * /trunk/src/kits/support/Archivable.cpp rev 19095 + * /trunk/headers/os/support/Archivable.h rev 19972 + * /trunk/src/kits/support/Archivable.cpp rev 19095 */ /*! @@ -20,7 +23,7 @@ \class BArchivable \ingroup support \ingroup libbe - \brief Interfaced for objects that can be archived into a BMessage. + \brief Interface for objects that can be archived into a BMessage. BArchivable provides an interface for objects that can be put into message archives and extracted into objects in another location. Using this you are @@ -32,13 +35,13 @@ disk. The objective of this interface, however, is to store objects that will be restored to other objects. To illustrate this point, BArchivable messages know how to restore themselves whereas BFlattenables have a datatype which - you need to map to classes manually. + you need to map to classes manually. Archiving is done with the Archive() method. If your class supports it, the - caller can request it to store in to a deep archive, meaning that all child + caller can request it to store into a deep archive, meaning that all child objects in it will be stored. Extracting the archive works with the Instantiate() method, which is static. Since the interface is designed to - extract objects without the caller knowing what kind of object it actually is + extract objects without the caller knowing what kind of object it actually is, the global function #instantiate_object() instantiates a message without you manually having to determine the class the message is from. This adds considerable flexibility and allows BArchivable to be used in combination with @@ -46,7 +49,7 @@ To provide this interface in your classes you should publicly inherit this class. You should implement Archive() and Instantiate(), and provide one - constructor that takes one BMessage argument. + constructor that takes one BMessage argument. */ /*! @@ -76,7 +79,7 @@ \param into The message you store your object in. \param deep If \c true, all children of this object should be stored as well. - Only pay attention of this parameter if you actually have child objects. + Only pay attention to this parameter if you actually have child objects. \retval B_OK The archiving succeeded. \retval "error codes" The archiving did not succeed. */ @@ -93,7 +96,7 @@ \retval You should return a pointer to your object, or \c NULL if you fail. \warning The default implementation will always return \c NULL. Even though - it is possible to store plain BArchive objects it is impossible to restore + it is possible to store plain BArchive objects, it is impossible to restore them. \see instantiate_object(BMessage *from) */ @@ -101,8 +104,8 @@ /*! \fn virtual status_t BArchivable::Perform(perform_code d, void* arg) \brief Internal method. - \internal This method is defined in case of unforseen binary compatbility API - issues. Currently nothing of interest in implemented. + \internal This method is defined in case of unforeseen binary compatibility + API issues. Currently nothing of interest is implemented. */ ///// Global methods ///// @@ -123,19 +126,19 @@ different application or library. This function is similar to instantiate_object(BMessage *from), except that - it takes the \a id argument referring to an image where the object might + it takes the \a id argument referring to an image where the object might be stored. \note Images are names for executable files. Image id's refer to these executable files that have been loaded by your application. Have a look - at the kernel API for further info. + at the kernel API for further information. */ /*! \fn BArchivable* instantiate_object(BMessage *from) \brief Instantiate an archived object. - This global function will determine the base class, based on the \a from + This global function will determine the base class, based on the \a from argument, and it will call the Instantiate() function of that object to restore it. @@ -160,7 +163,7 @@ /*! \fn instantiation_func find_instantiation_func(const char* className) - \brief Internal function that searches for the instantiation func of a + \brief Internal function that searches for the instantiation func of a specific class. Use instantiate_object() instead. */ From jonas at kirilla.com Mon Jun 4 13:09:31 2007 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Mon, 04 Jun 2007 13:09:31 +0200 CEST Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <20070604015254.4326.15@stippis.WG> Message-ID: <2475018089-BeMail@kirilla> Stephan Assmus wrote: ... > I want that feature too, but that's just persistence. It doesn't > require to save any and all playlists, just the current one > when you quit the program. All this playlisting.. *grumble* I blame WinAmp. I would like to have a Haiku media player simply play the next file in the Tracker folder, and Alt-Up/Down do what they do in Mail and ShowImage. This should be the default, IMO. I don't know if it's a good idea to combine a playlist and a plain Tracker mode in the same application, but if one does implement these two modes Alt-Up/Down could have its behavior depend on the current mode. For Tracker mode, I think it may also be okay to have it skip to the super-/siblingfolder by default at the end of each folder. This could be done silently, or it could be done with Tracker scripting to select the file which is currently playing. If desired the player could open/close folders. /Jonas. From superstippi at gmx.de Mon Jun 4 13:50:29 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Mon, 04 Jun 2007 13:50:29 +0200 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <2475018089-BeMail@kirilla> References: <2475018089-BeMail@kirilla> Message-ID: <20070604135029.13361.7@stippis.WG> Jonas Sundstr?m wrote (2007-06-04, 13:09:31 [+0200]): > All this playlisting.. *grumble* I blame WinAmp. > > I would like to have a Haiku media player simply play the next > file in the Tracker folder, and Alt-Up/Down do what they do in > Mail and ShowImage. This should be the default, IMO. The idea is certainly interesting, I will think about that some more. Right now, I could see problems, like what if you want to support cross fading with individual settings per file? But that could be solved with attributes, directly editable in Tracker. Well, certainly something to think about. Best regards, -Stephan From jackburton at mail.berlios.de Mon Jun 4 14:20:59 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 4 Jun 2007 14:20:59 +0200 Subject: [Haiku-commits] r21319 - haiku/trunk/src/system/kernel/vm Message-ID: <200706041220.l54CKxGC006313@sheep.berlios.de> Author: jackburton Date: 2007-06-04 14:20:58 +0200 (Mon, 04 Jun 2007) New Revision: 21319 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21319&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm.cpp haiku/trunk/src/system/kernel/vm/vm_address_space.c Log: Renamed a couple of variables, for easier reading... Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2007-06-04 06:37:04 UTC (rev 21318) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2007-06-04 12:20:58 UTC (rev 21319) @@ -58,7 +58,7 @@ #define ROUNDOWN(a, b) (((a) / (b)) * (b)) -extern vm_address_space *kernel_aspace; +extern vm_address_space *gKernelAddressSpace; #define REGION_HASH_TABLE_SIZE 1024 static area_id sNextAreaID; @@ -103,11 +103,9 @@ static vm_area * vm_get_area(area_id id) { - vm_area *area; - acquire_sem_etc(sAreaHashLock, READ_COUNT, 0, 0); - area = (vm_area *)hash_lookup(sAreaHash, &id); + vm_area *area = (vm_area *)hash_lookup(sAreaHash, &id); if (area != NULL) atomic_add(&area->ref_count, 1); @@ -138,14 +136,12 @@ create_area_struct(vm_address_space *addressSpace, const char *name, uint32 wiring, uint32 protection) { - vm_area *area = NULL; - // restrict the area name to B_OS_NAME_LENGTH size_t length = strlen(name) + 1; if (length > B_OS_NAME_LENGTH) length = B_OS_NAME_LENGTH; - area = (vm_area *)malloc(sizeof(vm_area)); + vm_area *area = (vm_area *)malloc(sizeof(vm_area)); if (area == NULL) return NULL; @@ -1325,7 +1321,7 @@ // have been adapted. Maybe it should be part of the kernel settings, // anyway (so that old drivers can always work). #if 0 - if (sourceArea->aspace == kernel_aspace && addressSpace != kernel_aspace + if (sourceArea->aspace == gKernelAddressSpace && addressSpace != gKernelAddressSpace && !(sourceArea->protection & B_USER_CLONEABLE_AREA)) { // kernel areas must not be cloned in userland, unless explicitly // declared user-cloneable upon construction @@ -2578,7 +2574,7 @@ void vm_free_unused_boot_loader_range(addr_t start, addr_t size) { - vm_translation_map *map = &kernel_aspace->translation_map; + vm_translation_map *map = &gKernelAddressSpace->translation_map; addr_t end = start + size; addr_t lastEnd = start; vm_area *area; @@ -2591,7 +2587,7 @@ map->ops->lock(map); - for (area = kernel_aspace->areas; area; area = area->address_space_next) { + for (area = gKernelAddressSpace->areas; area; area = area->address_space_next) { addr_t areaStart = area->base; addr_t areaEnd = areaStart + area->size; @@ -2985,7 +2981,7 @@ arch_vm_translation_map_init_post_sem(args); vm_address_space_init_post_sem(); - for (area = kernel_aspace->areas; area; area = area->address_space_next) { + for (area = gKernelAddressSpace->areas; area; area = area->address_space_next) { if (area->id == RESERVED_AREA_ID) continue; @@ -3621,14 +3617,14 @@ status_t vm_get_physical_page(addr_t paddr, addr_t *_vaddr, uint32 flags) { - return (*kernel_aspace->translation_map.ops->get_physical_page)(paddr, _vaddr, flags); + return (*gKernelAddressSpace->translation_map.ops->get_physical_page)(paddr, _vaddr, flags); } status_t vm_put_physical_page(addr_t vaddr) { - return (*kernel_aspace->translation_map.ops->put_physical_page)(vaddr); + return (*gKernelAddressSpace->translation_map.ops->put_physical_page)(vaddr); } @@ -4038,13 +4034,12 @@ area_id find_area(const char *name) { - struct hash_iterator iterator; - vm_area *area; - area_id id = B_NAME_NOT_FOUND; - acquire_sem_etc(sAreaHashLock, READ_COUNT, 0, 0); + struct hash_iterator iterator; hash_open(sAreaHash, &iterator); + vm_area *area; + area_id id = B_NAME_NOT_FOUND; while ((area = (vm_area *)hash_next(sAreaHash, &iterator)) != NULL) { if (area->id == RESERVED_AREA_ID) continue; @@ -4065,12 +4060,10 @@ status_t _get_area_info(area_id id, area_info *info, size_t size) { - vm_area *area; - if (size != sizeof(area_info) || info == NULL) return B_BAD_VALUE; - area = vm_get_area(id); + vm_area *area = vm_get_area(id); if (area == NULL) return B_BAD_VALUE; @@ -4085,8 +4078,6 @@ _get_next_area_info(team_id team, int32 *cookie, area_info *info, size_t size) { addr_t nextBase = *(addr_t *)cookie; - vm_address_space *addressSpace; - vm_area *area; // we're already through the list if (nextBase == (addr_t)-1) @@ -4095,12 +4086,14 @@ if (team == B_CURRENT_TEAM) team = team_get_current_team_id(); + vm_address_space *addressSpace; if (!team_is_valid(team) || team_get_address_space(team, &addressSpace) != B_OK) return B_BAD_VALUE; acquire_sem_etc(addressSpace->sem, READ_COUNT, 0, 0); + vm_area *area; for (area = addressSpace->areas; area; area = area->address_space_next) { if (area->id == RESERVED_AREA_ID) continue; @@ -4142,26 +4135,24 @@ status_t resize_area(area_id areaID, size_t newSize) { - vm_cache_ref *cacheRef; - vm_area *area, *current; - status_t status = B_OK; - size_t oldSize; + vm_area *current; // is newSize a multiple of B_PAGE_SIZE? if (newSize & (B_PAGE_SIZE - 1)) return B_BAD_VALUE; - area = vm_get_area(areaID); + vm_area *area = vm_get_area(areaID); if (area == NULL) return B_BAD_VALUE; - cacheRef = area->cache_ref; + vm_cache_ref *cacheRef = area->cache_ref; mutex_lock(&cacheRef->lock); // Resize all areas of this area's cache - oldSize = area->size; - + size_t oldSize = area->size; + status_t status = B_OK; + // ToDo: we should only allow to resize anonymous memory areas! if (!cacheRef->cache->temporary) { status = B_NOT_ALLOWED; @@ -4169,7 +4160,6 @@ } // ToDo: we must lock all address spaces here! - if (oldSize < newSize) { // We need to check if all areas of this cache can be resized @@ -4250,19 +4240,16 @@ static status_t transfer_area(area_id id, void **_address, uint32 addressSpec, team_id target) { - vm_address_space *sourceAddressSpace, *targetAddressSpace; - vm_translation_map *map; - vm_area *area, *reserved; - void *reservedAddress; - status_t status; - - area = vm_get_area(id); + vm_address_space *sourceAddressSpace; + vm_address_space *targetAddressSpace; + void *reservedAddress = NULL; + vm_area *reserved; + vm_area *area = vm_get_area(id); if (area == NULL) return B_BAD_VALUE; // ToDo: check if the current team owns the area - - status = team_get_address_space(target, &targetAddressSpace); + status_t status = team_get_address_space(target, &targetAddressSpace); if (status != B_OK) goto err1; @@ -4271,7 +4258,6 @@ // transfer failed. sourceAddressSpace = area->address_space; - reserved = create_reserved_area_struct(sourceAddressSpace, 0); if (reserved == NULL) { status = B_NO_MEMORY; @@ -4470,13 +4456,11 @@ status_t _user_get_area_info(area_id area, area_info *userInfo) { - area_info info; - status_t status; - if (!IS_USER_ADDRESS(userInfo)) return B_BAD_ADDRESS; - - status = get_area_info(area, &info); + + area_info info; + status_t status = get_area_info(area, &info); if (status < B_OK) return status; @@ -4493,8 +4477,6 @@ status_t _user_get_next_area_info(team_id team, int32 *userCookie, area_info *userInfo) { - status_t status; - area_info info; int32 cookie; if (!IS_USER_ADDRESS(userCookie) @@ -4502,7 +4484,8 @@ || user_memcpy(&cookie, userCookie, sizeof(int32)) < B_OK) return B_BAD_ADDRESS; - status = _get_next_area_info(team, &cookie, &info, sizeof(area_info)); + area_info info; + status_t status = _get_next_area_info(team, &cookie, &info, sizeof(area_info)); if (status != B_OK) return status; @@ -4541,9 +4524,6 @@ status_t _user_transfer_area(area_id area, void **userAddress, uint32 addressSpec, team_id target) { - status_t status; - void *address; - // filter out some unavailable values (for userland) switch (addressSpec) { case B_ANY_KERNEL_ADDRESS: @@ -4551,11 +4531,12 @@ return B_BAD_VALUE; } + void *address; if (!IS_USER_ADDRESS(userAddress) || user_memcpy(&address, userAddress, sizeof(address)) < B_OK) return B_BAD_ADDRESS; - status = transfer_area(area, &address, addressSpec, target); + status_t status = transfer_area(area, &address, addressSpec, target); if (status < B_OK) return status; @@ -4572,8 +4553,7 @@ { char name[B_OS_NAME_LENGTH]; void *address; - area_id clonedArea; - + // filter out some unavailable values (for userland) switch (addressSpec) { case B_ANY_KERNEL_ADDRESS: @@ -4591,7 +4571,7 @@ fix_protection(&protection); - clonedArea = vm_clone_area(vm_current_user_address_space_id(), name, &address, + area_id clonedArea = vm_clone_area(vm_current_user_address_space_id(), name, &address, addressSpec, protection, REGION_NO_PRIVATE_MAP, sourceArea); if (clonedArea < B_OK) return clonedArea; @@ -4610,7 +4590,6 @@ size_t size, uint32 lock, uint32 protection) { char name[B_OS_NAME_LENGTH]; - area_id area; void *address; // filter out some unavailable values (for userland) @@ -4634,7 +4613,7 @@ fix_protection(&protection); - area = vm_create_anonymous_area(vm_current_user_address_space_id(), + area_id area = vm_create_anonymous_area(vm_current_user_address_space_id(), (char *)name, &address, addressSpec, size, lock, protection); if (area >= B_OK && user_memcpy(userAddress, &address, sizeof(address)) < B_OK) { Modified: haiku/trunk/src/system/kernel/vm/vm_address_space.c =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_address_space.c 2007-06-04 06:37:04 UTC (rev 21318) +++ haiku/trunk/src/system/kernel/vm/vm_address_space.c 2007-06-04 12:20:58 UTC (rev 21319) @@ -26,11 +26,11 @@ # define TRACE(x) ; #endif -vm_address_space *kernel_aspace; +vm_address_space *gKernelAddressSpace; #define ASPACE_HASH_TABLE_SIZE 1024 -static void *aspace_table; -static sem_id aspace_hash_sem; +static void *sAddressSpaceTable; +static sem_id sAddressSpaceHashSem; static void @@ -75,7 +75,7 @@ { team_id id = strtoul(argv[1], NULL, 0); - aspace = hash_lookup(aspace_table, &id); + aspace = hash_lookup(sAddressSpaceTable, &id); if (aspace == NULL) { dprintf("invalid aspace id\n"); } else { @@ -95,12 +95,12 @@ dprintf("addr\tid\tbase\t\tsize\n"); - hash_open(aspace_table, &iter); - while ((as = hash_next(aspace_table, &iter)) != NULL) { + hash_open(sAddressSpaceTable, &iter); + while ((as = hash_next(sAddressSpaceTable, &iter)) != NULL) { dprintf("%p\t0x%lx\t0x%lx\t\t0x%lx\n", as, as->id, as->base, as->size); } - hash_close(aspace_table, &iter, false); + hash_close(sAddressSpaceTable, &iter, false); return 0; } @@ -140,7 +140,7 @@ { TRACE(("delete_address_space: called on aspace 0x%lx\n", addressSpace->id)); - if (addressSpace == kernel_aspace) + if (addressSpace == gKernelAddressSpace) panic("tried to delete the kernel aspace!\n"); // put this aspace in the deletion state @@ -164,11 +164,11 @@ { vm_address_space *aspace; - acquire_sem_etc(aspace_hash_sem, READ_COUNT, 0, 0); - aspace = hash_lookup(aspace_table, &aid); + acquire_sem_etc(sAddressSpaceHashSem, READ_COUNT, 0, 0); + aspace = hash_lookup(sAddressSpaceTable, &aid); if (aspace) atomic_add(&aspace->ref_count, 1); - release_sem_etc(aspace_hash_sem, READ_COUNT, 0); + release_sem_etc(sAddressSpaceHashSem, READ_COUNT, 0); return aspace; } @@ -178,22 +178,22 @@ vm_get_kernel_address_space(void) { /* we can treat this one a little differently since it can't be deleted */ - atomic_add(&kernel_aspace->ref_count, 1); - return kernel_aspace; + atomic_add(&gKernelAddressSpace->ref_count, 1); + return gKernelAddressSpace; } vm_address_space * vm_kernel_address_space(void) { - return kernel_aspace; + return gKernelAddressSpace; } team_id vm_kernel_address_space_id(void) { - return kernel_aspace->id; + return gKernelAddressSpace->id; } @@ -231,12 +231,12 @@ { bool remove = false; - acquire_sem_etc(aspace_hash_sem, WRITE_COUNT, 0, 0); + acquire_sem_etc(sAddressSpaceHashSem, WRITE_COUNT, 0, 0); if (atomic_add(&aspace->ref_count, -1) == 1) { - hash_remove(aspace_table, aspace); + hash_remove(sAddressSpaceTable, aspace); remove = true; } - release_sem_etc(aspace_hash_sem, WRITE_COUNT, 0); + release_sem_etc(sAddressSpaceHashSem, WRITE_COUNT, 0); if (remove) delete_address_space(aspace); @@ -310,9 +310,9 @@ } // add the aspace to the global hash table - acquire_sem_etc(aspace_hash_sem, WRITE_COUNT, 0, 0); - hash_insert(aspace_table, addressSpace); - release_sem_etc(aspace_hash_sem, WRITE_COUNT, 0); + acquire_sem_etc(sAddressSpaceHashSem, WRITE_COUNT, 0, 0); + hash_insert(sAddressSpaceTable, addressSpace); + release_sem_etc(sAddressSpaceHashSem, WRITE_COUNT, 0); *_addressSpace = addressSpace; return B_OK; @@ -322,7 +322,7 @@ void vm_address_space_walk_start(struct hash_iterator *iterator) { - hash_open(aspace_table, iterator); + hash_open(sAddressSpaceTable, iterator); } @@ -331,11 +331,11 @@ { vm_address_space *aspace; - acquire_sem_etc(aspace_hash_sem, READ_COUNT, 0, 0); - aspace = hash_next(aspace_table, iterator); + acquire_sem_etc(sAddressSpaceHashSem, READ_COUNT, 0, 0); + aspace = hash_next(sAddressSpaceTable, iterator); if (aspace) atomic_add(&aspace->ref_count, 1); - release_sem_etc(aspace_hash_sem, READ_COUNT, 0); + release_sem_etc(sAddressSpaceHashSem, READ_COUNT, 0); return aspace; } @@ -343,22 +343,22 @@ status_t vm_address_space_init(void) { - aspace_hash_sem = -1; + sAddressSpaceHashSem = -1; // create the area and address space hash tables { vm_address_space *aspace; - aspace_table = hash_init(ASPACE_HASH_TABLE_SIZE, (addr_t)&aspace->hash_next - (addr_t)aspace, + sAddressSpaceTable = hash_init(ASPACE_HASH_TABLE_SIZE, (addr_t)&aspace->hash_next - (addr_t)aspace, &aspace_compare, &aspace_hash); - if (aspace_table == NULL) + if (sAddressSpaceTable == NULL) panic("vm_init: error creating aspace hash table\n"); } - kernel_aspace = NULL; + gKernelAddressSpace = NULL; // create the initial kernel address space if (vm_create_address_space(1, KERNEL_BASE, KERNEL_SIZE, - true, &kernel_aspace) != B_OK) + true, &gKernelAddressSpace) != B_OK) panic("vm_init: error creating kernel address space!\n"); add_debugger_command("aspaces", &dump_aspace_list, "Dump a list of all address spaces"); @@ -371,15 +371,15 @@ status_t vm_address_space_init_post_sem(void) { - status_t status = arch_vm_translation_map_init_kernel_map_post_sem(&kernel_aspace->translation_map); + status_t status = arch_vm_translation_map_init_kernel_map_post_sem(&gKernelAddressSpace->translation_map); if (status < B_OK) return status; - status = kernel_aspace->sem = create_sem(WRITE_COUNT, "kernel_aspacelock"); + status = gKernelAddressSpace->sem = create_sem(WRITE_COUNT, "kernel_aspacelock"); if (status < B_OK) return status; - status = aspace_hash_sem = create_sem(WRITE_COUNT, "aspace_hash_sem"); + status = sAddressSpaceHashSem = create_sem(WRITE_COUNT, "aspace_hash_sem"); if (status < B_OK) return status; From axeld at pinc-software.de Mon Jun 4 14:55:48 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 04 Jun 2007 14:55:48 +0200 CEST Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <2475018089-BeMail@kirilla> Message-ID: <9476703452-BeMail@zon> "Jonas Sundstr?m" wrote: > I would like to have a Haiku media player simply play the next > file in the Tracker folder, and Alt-Up/Down do what they do in > Mail and ShowImage. This should be the default, IMO. If you would need to press the next/previous button to play those files, then I would definitely agree with you; I would find it very annoying, though, if the player would always automatically play the next file (like the next movie in that folder). Bye, Axel. From superstippi at gmx.de Mon Jun 4 15:20:17 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Mon, 04 Jun 2007 15:20:17 +0200 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <9476703452-BeMail@zon> References: <9476703452-BeMail@zon> Message-ID: <20070604152017.15441.10@stippis.WG> Axel D?rfler wrote (2007-06-04, 14:55:48 [+0200]): > "Jonas Sundstr?m" wrote: > > I would like to have a Haiku media player simply play the next > > file in the Tracker folder, and Alt-Up/Down do what they do in > > Mail and ShowImage. This should be the default, IMO. > > If you would need to press the next/previous button to play those > files, then I would definitely agree with you; I would find it very > annoying, though, if the player would always automatically play the > next file (like the next movie in that folder). Additionally, Jonas, how would you envision creating your own *sequence* of files? I mean not based on any Tracker sorting. Best regards, -Stephan From jackburton at mail.berlios.de Mon Jun 4 16:09:21 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Mon, 4 Jun 2007 16:09:21 +0200 Subject: [Haiku-commits] r21320 - haiku/trunk/src/servers/app Message-ID: <200706041409.l54E9L6P019533@sheep.berlios.de> Author: jackburton Date: 2007-06-04 16:09:16 +0200 (Mon, 04 Jun 2007) New Revision: 21320 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21320&view=rev Modified: haiku/trunk/src/servers/app/Desktop.cpp Log: Initialize all variables in the constructor Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2007-06-04 12:20:58 UTC (rev 21319) +++ haiku/trunk/src/servers/app/Desktop.cpp 2007-06-04 14:09:16 UTC (rev 21320) @@ -312,6 +312,8 @@ fActiveScreen(NULL), fWindowLock("window lock"), fMouseEventWindow(NULL), + fWindowUnderMouse(NULL), + fViewUnderMouse(B_NULL_TOKEN), fFocus(NULL), fFront(NULL), fBack(NULL) From jonas at kirilla.com Mon Jun 4 16:20:29 2007 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Mon, 04 Jun 2007 16:20:29 +0200 CEST Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <9476703452-BeMail@zon> Message-ID: <6013617128-BeMail@kirilla> "Axel D?rfler" wrote: > "Jonas Sundstr?m" wrote: > > I would like to have a Haiku media player simply play the next > > file in the Tracker folder, and Alt-Up/Down do what they do in > > Mail and ShowImage. This should be the default, IMO. > > If you would need to press the next/previous button to play those > files, then I would definitely agree with you; I would find it very > annoying, though, if the player would always automatically play the > next file (like the next movie in that folder). One could have separate preferences for audio and video, whether or not the player should stop or continue, for each class of media. With sensible defaults of course. If a playlist file (native, m3u, ...) was opened, naturally the player should respect that and not continue beyond it. /Jonas. From revol at free.fr Mon Jun 4 17:33:28 2007 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Mon, 04 Jun 2007 17:33:28 +0200 CEST Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <2475018089-BeMail@kirilla> Message-ID: <2379278388-BeMail@laptop> > Stephan Assmus wrote: > ... > > I want that feature too, but that's just persistence. It doesn't > > require to save any and all playlists, just the current one > > when you quit the program. > > All this playlisting.. *grumble* I blame WinAmp. > > I would like to have a Haiku media player simply play the next > file in the Tracker folder, and Alt-Up/Down do what they do in > Mail and ShowImage. This should be the default, IMO. Problem is some "media" is actually a playlist. .asx files are XML playlists... so we have to support playlists anyway, even if we don't show items separately. Fran?ois. From jonas at kirilla.com Mon Jun 4 17:21:18 2007 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Mon, 04 Jun 2007 17:21:18 +0200 CEST Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <20070604152017.15441.10@stippis.WG> Message-ID: <9662584457-BeMail@kirilla> Stephan Assmus wrote: > > Axel D?rfler wrote (2007-06-04, 14:55:48 [+0200]): > > "Jonas Sundstr?m" wrote: > > > I would like to have a Haiku media player simply play the next > > > file in the Tracker folder, and Alt-Up/Down do what they do in > > > Mail and ShowImage. This should be the default, IMO. > > > > If you would need to press the next/previous button to play those > > files, then I would definitely agree with you; I would find it very > > annoying, though, if the player would always automatically play the > > next file (like the next movie in that folder). Sometimes it could be the desired behavior to have the player continue with the next video in the same folder. It depends on the use pattern. There are many different ways to listen to music or watch videos. > Additionally, Jonas, how would you envision creating your own > *sequence* of files? I mean not based on any Tracker sorting. I guess a playlist is the only way if you want to specify an arbitrary but exact sequence. I don't mean to say that playlists aren't worthwhile, but I think we rely too much on them - people having .m3u:s in every folder, always having to think of the playlist. Audio file collections are by nature highly sequential. A lot of the time I just want to listen from point X and forward, and when I get bored I choose some other point Y and play on from there. (Why plan and specify what I'm going to listen to when that plan is going to change anyway before too long.) Take shuffle. In a playlist-oriented player it's a shuffle of the playlist. In a collection-oriented player (using BFS queries or an iTunes-like database) shuffle could be more open-ended and adapt to user input and refinement, like "more rock", "less personal favorites". This doesn't necessarily replace the playlist. The playlist, as a finite order of steps, is perfect for when you drop/open multiple files, or when you explicity open a playlist file, but having the opening of single files result in a single-entry playlist when that's the least common use case for audio? Perhaps it would be confusing to have the player have all these different modes. I don't know. /Jonas. From axeld at mail.berlios.de Mon Jun 4 17:32:02 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 4 Jun 2007 17:32:02 +0200 Subject: [Haiku-commits] r21321 - in haiku/trunk: headers/private/graphics/intel_extreme src/add-ons/accelerants/intel_extreme src/add-ons/kernel/drivers/graphics/intel_extreme Message-ID: <200706041532.l54FW2vD029149@sheep.berlios.de> Author: axeld Date: 2007-06-04 17:32:01 +0200 (Mon, 04 Jun 2007) New Revision: 21321 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21321&view=rev Modified: haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h haiku/trunk/src/add-ons/accelerants/intel_extreme/mode.cpp haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp Log: * Work in progress to support the i965 chipset as well; still works on i865, but doesn't work on i965 yet. * B_GET_DISPLAY_MODE now returns the mode actually configured in the chip instead of the last mode set; while this isn't really necessary, it allows to check what mode was used during startup. Modified: haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h =================================================================== --- haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h 2007-06-04 14:09:16 UTC (rev 21320) +++ haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h 2007-06-04 15:32:01 UTC (rev 21321) @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -24,9 +24,12 @@ #define INTEL_TYPE_GROUP_MASK 0xf0 #define INTEL_TYPE_7xx 0x01 #define INTEL_TYPE_8xx 0x02 -#define INTEL_TYPE_9xx 0x03 +#define INTEL_TYPE_9xx 0x04 #define INTEL_TYPE_83x 0x10 #define INTEL_TYPE_85x 0x20 +#define INTEL_TYPE_915 0x10 +#define INTEL_TYPE_945 0x20 +#define INTEL_TYPE_965 0x40 #define DEVICE_NAME "intel_extreme" #define INTEL_ACCELERANT_NAME "intel_extreme.accelerant" @@ -220,9 +223,12 @@ #define DISPLAY_PLL_2X_CLOCK (1UL << 30) #define DISPLAY_PLL_SYNC_LOCK_ENABLED (1UL << 29) #define DISPLAY_PLL_NO_VGA_CONTROL (1UL << 28) +#define DISPLAY_PLL_MODE_ANALOG (1UL << 26) +#define DISPLAY_PLL_DIVIDE_HIGH (1UL << 24) #define DISPLAY_PLL_DIVIDE_4X (1UL << 23) -#define DISPLAY_PLL_POST_DIVISOR_MASK 0x001f0000 -#define DISPLAY_PLL_POST_DIVISOR_SHIFT 16 +#define DISPLAY_PLL_POST1_DIVISOR_MASK 0x001f0000 +#define DISPLAY_PLL_9xx_POST1_DIVISOR_MASK 0x00ff0000 +#define DISPLAY_PLL_POST1_DIVISOR_SHIFT 16 #define DISPLAY_PLL_DIVISOR_1 (1UL << 8) #define DISPLAY_PLL_N_DIVISOR_MASK 0x001f0000 #define DISPLAY_PLL_M1_DIVISOR_MASK 0x00001f00 @@ -230,6 +236,7 @@ #define DISPLAY_PLL_N_DIVISOR_SHIFT 16 #define DISPLAY_PLL_M1_DIVISOR_SHIFT 8 #define DISPLAY_PLL_M2_DIVISOR_SHIFT 0 +#define DISPLAY_PLL_PULSE_PHASE_SHIFT 9 #define INTEL_DISPLAY_A_ANALOG_PORT 0x61100 #define DISPLAY_MONITOR_PORT_ENABLED (1UL << 31) Modified: haiku/trunk/src/add-ons/accelerants/intel_extreme/mode.cpp =================================================================== --- haiku/trunk/src/add-ons/accelerants/intel_extreme/mode.cpp 2007-06-04 14:09:16 UTC (rev 21320) +++ haiku/trunk/src/add-ons/accelerants/intel_extreme/mode.cpp 2007-06-04 15:32:01 UTC (rev 21321) @@ -1,7 +1,10 @@ /* - * Copyright 2006, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * + * Support for i915 chipset and up based on the X driver, + * Copyright 2006 Intel Corporation. + * * Authors: * Axel D?rfler, axeld at pinc-software.de */ @@ -11,6 +14,7 @@ #include "accelerant.h" #include "utility.h" +#include #include #include @@ -29,6 +33,40 @@ (B_8_BIT_DAC | B_HARDWARE_CURSOR | B_PARALLEL_ACCESS | B_DPMS | B_SUPPORTS_OVERLAYS) +struct display_registers { + uint32 pll; + uint32 divisors; + uint32 control; + uint32 pipe_config; + uint32 horiz_total; + uint32 horiz_blank; + uint32 horiz_sync; + uint32 vert_total; + uint32 vert_blank; + uint32 vert_sync; + uint32 size; + uint32 stride; + uint32 position; + uint32 pipe_source; +}; + +struct pll_divisors { + uint32 post; + uint32 post1; + uint32 post2; + bool post2_high; + uint32 n; + uint32 m; + uint32 m1; + uint32 m2; +}; + +struct pll_limits { + pll_divisors min; + pll_divisors max; + float min_post2_frequency; +}; + static const display_mode kBaseModeList[] = { {{25175, 640, 656, 752, 800, 350, 387, 389, 449, B_POSITIVE_HSYNC}, B_CMAP8, 640, 350, 0, 0, MODE_FLAGS}, /* 640x350 - www.epanorama.net/documents/pc/vga_timing.html) */ {{25175, 640, 656, 752, 800, 400, 412, 414, 449, B_POSITIVE_VSYNC}, B_CMAP8, 640, 400, 0, 0, MODE_FLAGS}, /* 640x400 - www.epanorama.net/documents/pc/vga_timing.html) */ @@ -69,10 +107,10 @@ static const uint32 kMaxNumModes = kNumBaseModes * 4; -/** Creates the initial mode list of the primary accelerant. - * It's called from intel_init_accelerant(). - */ - +/*! + Creates the initial mode list of the primary accelerant. + It's called from intel_init_accelerant(). +*/ status_t create_mode_list(void) { @@ -119,30 +157,95 @@ static void -compute_pll_divisors(const display_mode ¤t, uint32 &postDivisor, - uint32 &nDivisor, uint32 &m1Divisor, uint32 &m2Divisor) +get_pll_limits(pll_limits &limits) { + // Note, the limits are taken from the X driver; they have not yet been tested + + if ((gInfo->shared_info->device_type & INTEL_TYPE_9xx) != 0) { + // TODO: support LVDS output limits as well + static const pll_limits kLimits = { + // p, p1, p2, high, n, m, m1, m2 + { 5, 1, 5, false, 5, 70, 12, 7}, // min + { 80, 8, 10, true, 10, 120, 22, 11}, // max + 200000 + }; + limits = kLimits; + } else { + // TODO: support LVDS output limits as well + static const pll_limits kLimits = { + // p, p1, p2, high, n, m, m1, m2 + { 4, 2, 2, false, 5, 96, 20, 8}, + {128, 33, 4, true, 18, 140, 28, 18}, + 165000 + }; + limits = kLimits; + } + + TRACE(("PLL limits, min: p %lu (p1 %lu, p2 %lu), n %lu, m %lu (m1 %lu, m2 %lu)\n", + limits.min.post, limits.min.post1, limits.min.post2, limits.min.n, + limits.min.m, limits.min.m1, limits.min.m2)); + TRACE(("PLL limits, max: p %lu (p1 %lu, p2 %lu), n %lu, m %lu (m1 %lu, m2 %lu)\n", + limits.max.post, limits.max.post1, limits.max.post2, limits.max.n, + limits.max.m, limits.max.m1, limits.max.m2)); +} + + +static bool +valid_pll_divisors(const pll_divisors& divisors, const pll_limits& limits) +{ + pll_info &info = gInfo->shared_info->pll_info; + uint32 vco = info.reference_frequency * divisors.m / divisors.n; + uint32 frequency = vco / divisors.post; + + if (divisors.post < limits.min.post || divisors.post > limits.max.post + || divisors.m < limits.min.m || divisors.m > limits.max.m + || frequency < info.min_frequency || frequency > info.max_frequency) + return false; + + return true; +} + + +static void +compute_pll_divisors(const display_mode ¤t, pll_divisors& divisors) +{ float requestedPixelClock = current.timing.pixel_clock / 1000.0f; float referenceClock = gInfo->shared_info->pll_info.reference_frequency / 1000.0f; + pll_limits limits; + get_pll_limits(limits); TRACE(("required MHz: %g\n", requestedPixelClock)); + if (current.timing.pixel_clock < limits.min_post2_frequency) { + divisors.post2 = limits.min.post2; + divisors.post2_high = limits.min.post2_high; + } else { + divisors.post2 = limits.max.post2; + divisors.post2_high = limits.max.post2_high; + } + float best = requestedPixelClock; - uint32 bestP = 0, bestN = 0, bestM = 0; + pll_divisors bestDivisors; - // Note, the limits are taken from the X driver; they have not yet been tested + for (divisors.post1 = limits.min.post1; divisors.post1 <= limits.max.post1; + divisors.post1++) { + for (divisors.n = limits.min.n; divisors.n <= limits.max.n; divisors.n++) { + for (divisors.m1 = limits.min.m1; divisors.m1 <= limits.max.m1; + divisors.m1++) { + for (divisors.m2 = limits.min.m2; divisors.m2 < divisors.m1 + && divisors.m2 <= limits.max.m2; divisors.m2++) { + divisors.m = 5 * divisors.m1 + divisors.m2; + divisors.post = divisors.post1 * divisors.post2; - for (uint32 p = 3; p < 31; p++) { - for (uint32 n = 3; n < 16; n++) { - for (uint32 m1 = 6; m1 < 26; m1++) { - for (uint32 m2 = 6; m2 < 16; m2++) { - uint32 m = m1 * 5 + m2; - float error = fabs(requestedPixelClock - ((referenceClock * m) / n) / (p*4)); + if (!valid_pll_divisors(divisors, limits)) + continue; + + float error = fabs(requestedPixelClock + - ((referenceClock * divisors.m) / divisors.n) / divisors.post); if (error < best) { best = error; - bestP = p; - bestN = n; - bestM = m; + bestDivisors = divisors; + if (error == 0) break; } @@ -151,19 +254,12 @@ } } - postDivisor = bestP; - nDivisor = bestN; + divisors = bestDivisors; - TRACE(("found: %g MHz (p = %lu, n = %lu, m = %lu (m1 = %lu, m2 = %lu)\n", - ((referenceClock * bestM) / bestN) / (bestP*4), bestP, bestN, bestM, - m1Divisor, m2Divisor)); - - m1Divisor = bestM / 5; - m2Divisor = bestM % 5; - while (m2Divisor < 6) { - m1Divisor--; - m2Divisor += 5; - } + TRACE(("found: %g MHz, p = %lu (p1 = %lu, p2 = %lu), n = %lu, m = %lu (m1 = %lu, m2 = %lu)\n", + ((referenceClock * divisors.m) / divisors.n) / divisors.post, + divisors.post, divisors.post1, divisors.post2, divisors.n, + divisors.m, divisors.m1, divisors.m2)); } @@ -216,7 +312,8 @@ intel_get_mode_list(display_mode *modeList) { TRACE(("intel_get_mode_info()\n")); - memcpy(modeList, gInfo->mode_list, gInfo->shared_info->mode_count * sizeof(display_mode)); + memcpy(modeList, gInfo->mode_list, + gInfo->shared_info->mode_count * sizeof(display_mode)); return B_OK; } @@ -256,14 +353,34 @@ if (mode == NULL || intel_propose_display_mode(&target, mode, mode)) return B_BAD_VALUE; + uint32 colorMode, bytesPerRow, bitsPerPixel; + get_color_space_format(target, colorMode, bytesPerRow, bitsPerPixel); + +debug_printf("new resolution: %ux%ux%lu\n", target.timing.h_display, target.timing.v_display, bitsPerPixel); +#if 0 +static bool first = true; +if (first) { + int fd = open("/boot/home/ie_.regs", O_CREAT | O_WRONLY, 0644); + if (fd >= 0) { + for (int32 i = 0; i < 0x80000; i += 16) { + char line[512]; + int length = sprintf(line, "%05lx: %08lx %08lx %08lx %08lx\n", + i, read32(i), read32(i + 4), read32(i + 8), read32(i + 12)); + write(fd, line, length); + } + close(fd); + sync(); + } + first = false; +} +#endif + //return B_ERROR; + intel_shared_info &sharedInfo = *gInfo->shared_info; Autolock locker(sharedInfo.accelerant_lock); set_display_power_mode(B_DPMS_OFF); - uint32 colorMode, bytesPerRow, bitsPerPixel; - get_color_space_format(target, colorMode, bytesPerRow, bitsPerPixel); - // free old and allocate new frame buffer in graphics memory intel_free_memory(gInfo->frame_buffer_handle); @@ -312,8 +429,8 @@ | ((target.timing.flags & B_POSITIVE_HSYNC) != 0 ? DISPLAY_MONITOR_POSITIVE_HSYNC : 0) | ((target.timing.flags & B_POSITIVE_VSYNC) != 0 ? DISPLAY_MONITOR_POSITIVE_VSYNC : 0)); - uint32 postDivisor, nDivisor, m1Divisor, m2Divisor; - compute_pll_divisors(target, postDivisor, nDivisor, m1Divisor, m2Divisor); + pll_divisors divisors; + compute_pll_divisors(target, divisors); // switch divisor register with every mode change (not required) uint32 divisorRegister; @@ -323,13 +440,41 @@ divisorRegister = INTEL_DISPLAY_A_PLL_DIVISOR_0; write32(divisorRegister, - (((nDivisor - 2) << DISPLAY_PLL_N_DIVISOR_SHIFT) & DISPLAY_PLL_N_DIVISOR_MASK) - | (((m1Divisor - 2) << DISPLAY_PLL_M1_DIVISOR_SHIFT) & DISPLAY_PLL_M1_DIVISOR_MASK) - | (((m2Divisor - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) & DISPLAY_PLL_M2_DIVISOR_MASK)); + (((divisors.n - 2) << DISPLAY_PLL_N_DIVISOR_SHIFT) & DISPLAY_PLL_N_DIVISOR_MASK) + | (((divisors.m1 - 2) << DISPLAY_PLL_M1_DIVISOR_SHIFT) & DISPLAY_PLL_M1_DIVISOR_MASK) + | (((divisors.m2 - 2) << DISPLAY_PLL_M2_DIVISOR_SHIFT) & DISPLAY_PLL_M2_DIVISOR_MASK)); + + uint32 pll = DISPLAY_PLL_ENABLED | DISPLAY_PLL_NO_VGA_CONTROL; + if ((gInfo->shared_info->device_type & INTEL_TYPE_9xx) != 0) { +// pll |= ((1 << (divisors.post1 - 1)) << DISPLAY_PLL_POST1_DIVISOR_SHIFT) +// & DISPLAY_PLL_9xx_POST1_DIVISOR_MASK; + pll |= ((divisors.post1 - 1) << DISPLAY_PLL_POST1_DIVISOR_SHIFT) + & DISPLAY_PLL_9xx_POST1_DIVISOR_MASK; + if (divisors.post2_high) + pll |= DISPLAY_PLL_DIVIDE_HIGH; + + pll |= DISPLAY_PLL_MODE_ANALOG; + + if ((gInfo->shared_info->device_type & INTEL_TYPE_GROUP_MASK) == INTEL_TYPE_965) + pll |= 6 << DISPLAY_PLL_PULSE_PHASE_SHIFT; + } else { + if (divisors.post2_high) + pll |= DISPLAY_PLL_DIVIDE_4X; + pll |= DISPLAY_PLL_2X_CLOCK; + pll |= (((divisors.post1 - 2) << DISPLAY_PLL_POST1_DIVISOR_SHIFT) + & DISPLAY_PLL_POST1_DIVISOR_MASK); + } + + pll |= (divisorRegister == INTEL_DISPLAY_A_PLL_DIVISOR_1 ? DISPLAY_PLL_DIVISOR_1 : 0); + + debug_printf("PLL is %#lx, write: %#lx\n", read32(INTEL_DISPLAY_A_PLL), pll); + write32(INTEL_DISPLAY_A_PLL, pll); +#if 0 write32(INTEL_DISPLAY_A_PLL, DISPLAY_PLL_ENABLED | DISPLAY_PLL_2X_CLOCK | DISPLAY_PLL_NO_VGA_CONTROL | DISPLAY_PLL_DIVIDE_4X - | (((postDivisor - 2) << DISPLAY_PLL_POST_DIVISOR_SHIFT) & DISPLAY_PLL_POST_DIVISOR_MASK) + | (((divisors.post1 - 2) << DISPLAY_PLL_POST1_DIVISOR_SHIFT) & DISPLAY_PLL_POST1_DIVISOR_MASK) | (divisorRegister == INTEL_DISPLAY_A_PLL_DIVISOR_1 ? DISPLAY_PLL_DIVISOR_1 : 0)); +#endif } // These two have to be set for display B, too - this obviously means @@ -366,20 +511,6 @@ sharedInfo.current_mode = target; sharedInfo.bits_per_pixel = bitsPerPixel; -#if 0 -int fd = open("/boot/home/ie.regs", O_CREAT | O_WRONLY, 0644); -if (fd >= 0) { - for (int32 i = 0; i < 0x80000; i += 16) { - char line[512]; - int length = sprintf(line, "%05lx: %08lx %08lx %08lx %08lx\n", - i, read32(i), read32(i + 4), read32(i + 8), read32(i + 12)); - write(fd, line, length); - } - close(fd); - sync(); -} -#endif - return B_OK; } @@ -388,7 +519,96 @@ intel_get_display_mode(display_mode *_currentMode) { TRACE(("intel_get_display_mode()\n")); - *_currentMode = gInfo->shared_info->current_mode; + + display_mode &mode = *_currentMode; + + uint32 pll = read32(INTEL_DISPLAY_A_PLL); + uint32 pllDivisor = read32((pll & DISPLAY_PLL_DIVISOR_1) != 0 + ? INTEL_DISPLAY_A_PLL_DIVISOR_1 : INTEL_DISPLAY_A_PLL_DIVISOR_0); + + pll_divisors divisors; + divisors.m1 = (pllDivisor & DISPLAY_PLL_M1_DIVISOR_MASK) + >> DISPLAY_PLL_M1_DIVISOR_SHIFT; + divisors.m2 = (pllDivisor & DISPLAY_PLL_M2_DIVISOR_MASK) + >> DISPLAY_PLL_M2_DIVISOR_SHIFT; + divisors.n = (pllDivisor & DISPLAY_PLL_N_DIVISOR_MASK) + >> DISPLAY_PLL_N_DIVISOR_SHIFT; + + pll_limits limits; + get_pll_limits(limits); + + if ((gInfo->shared_info->device_type & INTEL_TYPE_9xx) != 0) { + divisors.post1 = (pll & DISPLAY_PLL_9xx_POST1_DIVISOR_MASK) + >> DISPLAY_PLL_POST1_DIVISOR_SHIFT; + + if ((pll & DISPLAY_PLL_DIVIDE_HIGH) != 0) + divisors.post2 = limits.max.post2; + else + divisors.post2 = limits.min.post2; + } else { + // 8xx + divisors.post1 = (pll & DISPLAY_PLL_POST1_DIVISOR_MASK) + >> DISPLAY_PLL_POST1_DIVISOR_SHIFT; + + if ((pll & DISPLAY_PLL_DIVIDE_4X) != 0) + divisors.post2 = limits.max.post2; + else + divisors.post2 = limits.min.post2; + } + + divisors.m = 5 * divisors.m1 + divisors.m2; + divisors.post = divisors.post1 * divisors.post2; + + float referenceClock = gInfo->shared_info->pll_info.reference_frequency / 1000.0f; + float pixelClock = ((referenceClock * divisors.m) / divisors.n) / divisors.post; + + // timing + + mode.timing.pixel_clock = uint32(pixelClock * 1000); + mode.timing.flags = 0; + + uint32 value = read32(INTEL_DISPLAY_A_HTOTAL); + mode.timing.h_total = (value >> 16) + 1; + mode.timing.h_display = (value & 0xffff) + 1; + + value = read32(INTEL_DISPLAY_A_HSYNC); + mode.timing.h_sync_end = (value >> 16) + 1; + mode.timing.h_sync_start = (value & 0xffff) + 1; + + value = read32(INTEL_DISPLAY_A_VTOTAL); + mode.timing.v_total = (value >> 16) + 1; + mode.timing.v_display = (value & 0xffff) + 1; + + value = read32(INTEL_DISPLAY_A_VSYNC); + mode.timing.v_sync_end = (value >> 16) + 1; + mode.timing.v_sync_start = (value & 0xffff) + 1; + + // image size and color space + + value = read32(INTEL_DISPLAY_A_IMAGE_SIZE); + mode.virtual_width = (value >> 16) + 1; + mode.virtual_height = (value & 0xffff) + 1; + + value = read32(INTEL_DISPLAY_A_CONTROL); + switch (value & DISPLAY_CONTROL_COLOR_MASK) { + case DISPLAY_CONTROL_RGB32: + default: + mode.space = B_RGB32; + break; + case DISPLAY_CONTROL_RGB16: + mode.space = B_RGB16; + break; + case DISPLAY_CONTROL_RGB15: + mode.space = B_RGB15; + break; + case DISPLAY_CONTROL_CMAP8: + mode.space = B_CMAP8; + break; + } + + mode.h_display_start = 0; + mode.v_display_start = 0; + mode.flags = 0; return B_OK; } Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp 2007-06-04 14:09:16 UTC (rev 21320) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp 2007-06-04 15:32:01 UTC (rev 21321) @@ -57,7 +57,7 @@ static status_t -checkDeviceInfo(struct intel_info *info) +check_device_info(struct intel_info *info) { if (!info || info->cookie_magic != INTEL_COOKIE_MAGIC) return B_BAD_VALUE; @@ -66,6 +66,38 @@ } +static int +getset_register(int argc, char **argv) +{ + if (argc < 2 || argc > 3) { + kprintf("usage: %s [set-to-value]\n", argv[0]); + return 0; + } + + uint32 reg = parse_expression(argv[1]); + uint32 value = 0; + bool set = argc == 3; + if (set) + value = parse_expression(argv[2]); + + kprintf("intel_extreme register %#lx\n", reg); + + intel_info &info = *gDeviceInfo[0]; + uint32 oldValue = read32(info.registers + reg); + + kprintf(" %svalue: %#lx (%lu)\n", set ? "old " : "", oldValue, oldValue); + + if (set) { + write32(info.registers + reg, value); + + value = read32(info.registers + reg); + kprintf(" new value: %#lx (%lu)\n", value, value); + } + + return 0; +} + + // #pragma mark - Device Hooks @@ -94,10 +126,15 @@ status_t status = B_OK; + // TODO: the second open will succeed even though the first one failed! if (info->open_count++ == 0) { // this device has been opened for the first time, so // we allocate needed resources and initialize the structure status = intel_extreme_init(*info); + if (status == B_OK) { + add_debugger_command("ie_reg", getset_register, + "dumps or sets the specified intel_extreme register"); + } } release_lock(&gLock); @@ -112,11 +149,10 @@ TRACE((DEVICE_NAME ": close\n")); struct intel_info *info; - if (checkDeviceInfo(info = (intel_info *)data) != B_OK) + if (check_device_info(info = (intel_info *)data) != B_OK) return B_BAD_VALUE; info->cookie_magic = INTEL_FREE_COOKIE_MAGIC; - return B_OK; } @@ -135,6 +171,7 @@ if (info->open_count-- == 1) { // release info structure info->cookie_magic = 0; + remove_debugger_command("ie_reg", getset_register); intel_extreme_uninit(*info); } @@ -149,7 +186,7 @@ { struct intel_info *info; - if (checkDeviceInfo(info = (intel_info *)data) != B_OK) + if (check_device_info(info = (intel_info *)data) != B_OK) return B_BAD_VALUE; switch (op) { Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp 2007-06-04 14:09:16 UTC (rev 21320) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp 2007-06-04 15:32:01 UTC (rev 21321) @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -49,6 +49,7 @@ {0x2592, INTEL_TYPE_9xx, "i915GM"}, {0x2772, INTEL_TYPE_9xx, "i945G"}, {0x27a2, INTEL_TYPE_9xx, "i945GM"}, + {0x29a2, INTEL_TYPE_9xx | INTEL_TYPE_965, "i965G"} #endif }; Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp 2007-06-04 14:09:16 UTC (rev 21320) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp 2007-06-04 15:32:01 UTC (rev 21321) @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -418,14 +418,14 @@ info.shared_info->frame_buffer_offset = 0; info.shared_info->dpms_mode = B_DPMS_ON; - if (info.device_type == INTEL_TYPE_9xx) { + if ((info.device_type & INTEL_TYPE_9xx) != 0) { info.shared_info->pll_info.reference_frequency = 96000; // 96 kHz info.shared_info->pll_info.max_frequency = 400000; // 400 MHz RAM DAC speed - info.shared_info->pll_info.min_frequency = 20000; // 20 MHz (not tested) + info.shared_info->pll_info.min_frequency = 20000; // 20 MHz } else { info.shared_info->pll_info.reference_frequency = 48000; // 48 kHz info.shared_info->pll_info.max_frequency = 350000; // 350 MHz RAM DAC speed - info.shared_info->pll_info.min_frequency = 25000; // 25 MHz (not tested) + info.shared_info->pll_info.min_frequency = 25000; // 25 MHz } info.shared_info->pll_info.divisor_register = INTEL_DISPLAY_A_PLL_DIVISOR_0; From revol at free.fr Mon Jun 4 17:40:01 2007 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Mon, 04 Jun 2007 17:40:01 +0200 CEST Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <20070604135029.13361.7@stippis.WG> Message-ID: <2772828362-BeMail@laptop> > > Jonas Sundstr?m wrote (2007-06-04, 13:09:31 [+0200]): > > All this playlisting.. *grumble* I blame WinAmp. > > > > I would like to have a Haiku media player simply play the next > > file in the Tracker folder, and Alt-Up/Down do what they do in > > Mail and ShowImage. This should be the default, IMO. > > The idea is certainly interesting, I will think about that some more. > Right > now, I could see problems, like what if you want to support cross > fading > with individual settings per file? But that could be solved with > attributes, directly editable in Tracker. Well, certainly something > to > think about. Ideally that should work with queries as well... What about some playlist interface that would handle the directory mime type (and query) this way ? Would be nice to have that above an access layer which could handle http: and file: the same way. What about hierarchical playlists ? (actually some playlists formats use that already). Fran?ois. From axeld at mail.berlios.de Mon Jun 4 18:04:06 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 4 Jun 2007 18:04:06 +0200 Subject: [Haiku-commits] r21322 - in haiku/trunk: headers/private/graphics/intel_extreme src/add-ons/kernel/drivers/graphics/intel_extreme Message-ID: <200706041604.l54G46ti001851@sheep.berlios.de> Author: axeld Date: 2007-06-04 18:04:05 +0200 (Mon, 04 Jun 2007) New Revision: 21322 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21322&view=rev Modified: haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h Log: * The second open will now fail, too, in case the hardware could not be initialized correctly. * Got rid of this superfluous cookie stuff - either the VFS behaves correctly, or we're screwed anyway. * Made adding debugger commands optional depending on if DEBUG_COMMANDS is defined or not. * Minor other cleanup. Modified: haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h =================================================================== --- haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h 2007-06-04 15:32:01 UTC (rev 21321) +++ haiku/trunk/headers/private/graphics/intel_extreme/intel_extreme.h 2007-06-04 16:04:05 UTC (rev 21322) @@ -34,9 +34,6 @@ #define DEVICE_NAME "intel_extreme" #define INTEL_ACCELERANT_NAME "intel_extreme.accelerant" -#define INTEL_COOKIE_MAGIC 'intl' -#define INTEL_FREE_COOKIE_MAGIC 'itlf' - // info about PLL on graphics card struct pll_info { uint32 reference_frequency; Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp 2007-06-04 15:32:01 UTC (rev 21321) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp 2007-06-04 16:04:05 UTC (rev 21322) @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -24,6 +24,8 @@ #include +#define DEBUG_COMMANDS + #define TRACE_DEVICE #ifdef TRACE_DEVICE # define TRACE(x) dprintf x @@ -56,16 +58,7 @@ }; -static status_t -check_device_info(struct intel_info *info) -{ - if (!info || info->cookie_magic != INTEL_COOKIE_MAGIC) - return B_BAD_VALUE; - - return B_OK; -} - - +#ifdef DEBUG_COMMANDS static int getset_register(int argc, char **argv) { @@ -96,6 +89,7 @@ return 0; } +#endif // DEBUG_COMMANDS // #pragma mark - Device Hooks @@ -119,40 +113,38 @@ if (!thisName) return B_BAD_VALUE; } + intel_info *info = gDeviceInfo[id]; - *_cookie = info; acquire_lock(&gLock); - status_t status = B_OK; - - // TODO: the second open will succeed even though the first one failed! - if (info->open_count++ == 0) { + if (info->open_count == 0) { // this device has been opened for the first time, so // we allocate needed resources and initialize the structure - status = intel_extreme_init(*info); - if (status == B_OK) { + info->init_status = intel_extreme_init(*info); + if (info->init_status == B_OK) { +#ifdef DEBUG_COMMANDS add_debugger_command("ie_reg", getset_register, "dumps or sets the specified intel_extreme register"); +#endif + + info->open_count++; } } release_lock(&gLock); - return status; + if (info->init_status == B_OK) + *_cookie = info; + + return info->init_status; } static status_t -device_close(void *data) +device_close(void */*data*/) { TRACE((DEVICE_NAME ": close\n")); - struct intel_info *info; - - if (check_device_info(info = (intel_info *)data) != B_OK) - return B_BAD_VALUE; - - info->cookie_magic = INTEL_FREE_COOKIE_MAGIC; return B_OK; } @@ -161,34 +153,30 @@ device_free(void *data) { struct intel_info *info = (intel_info *)data; - status_t retval = B_NO_ERROR; - if (info == NULL || info->cookie_magic != INTEL_FREE_COOKIE_MAGIC) - retval = B_BAD_VALUE; - acquire_lock(&gLock); if (info->open_count-- == 1) { // release info structure - info->cookie_magic = 0; - remove_debugger_command("ie_reg", getset_register); + info->init_status = B_NO_INIT; intel_extreme_uninit(*info); + +#ifdef DEBUG_COMMANDS + remove_debugger_command("ie_reg", getset_register); +#endif } release_lock(&gLock); - return retval; + return B_OK; } static status_t device_ioctl(void *data, uint32 op, void *buffer, size_t bufferLength) { - struct intel_info *info; + struct intel_info *info = (intel_info *)data; - if (check_device_info(info = (intel_info *)data) != B_OK) - return B_BAD_VALUE; - switch (op) { case B_GET_ACCELERANT_SIGNATURE: strcpy((char *)buffer, INTEL_ACCELERANT_NAME); @@ -210,7 +198,8 @@ // needed for cloning case INTEL_GET_DEVICE_NAME: #ifdef __HAIKU__ - if (user_strlcpy((char *)buffer, gDeviceNames[info->id], B_PATH_NAME_LENGTH) < B_OK) + if (user_strlcpy((char *)buffer, gDeviceNames[info->id], + B_PATH_NAME_LENGTH) < B_OK) return B_BAD_ADDRESS; #else strncpy((char *)buffer, gDeviceNames[info->id], B_PATH_NAME_LENGTH); @@ -223,7 +212,8 @@ { intel_allocate_graphics_memory allocMemory; #ifdef __HAIKU__ - if (user_memcpy(&allocMemory, buffer, sizeof(intel_allocate_graphics_memory)) < B_OK) + if (user_memcpy(&allocMemory, buffer, + sizeof(intel_allocate_graphics_memory)) < B_OK) return B_BAD_ADDRESS; #else memcpy(&allocMemory, buffer, sizeof(intel_allocate_graphics_memory)); @@ -237,7 +227,8 @@ if (status == B_OK) { // copy result #ifdef __HAIKU__ - if (user_memcpy(buffer, &allocMemory, sizeof(intel_allocate_graphics_memory)) < B_OK) + if (user_memcpy(buffer, &allocMemory, + sizeof(intel_allocate_graphics_memory)) < B_OK) return B_BAD_ADDRESS; #else memcpy(buffer, &allocMemory, sizeof(intel_allocate_graphics_memory)); @@ -250,7 +241,8 @@ { intel_free_graphics_memory freeMemory; #ifdef __HAIKU__ - if (user_memcpy(&freeMemory, buffer, sizeof(intel_free_graphics_memory)) < B_OK) + if (user_memcpy(&freeMemory, buffer, + sizeof(intel_free_graphics_memory)) < B_OK) return B_BAD_ADDRESS; #else memcpy(&freeMemory, buffer, sizeof(intel_free_graphics_memory)); Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp 2007-06-04 15:32:01 UTC (rev 21321) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp 2007-06-04 16:04:05 UTC (rev 21322) @@ -76,7 +76,8 @@ continue; // check device - for (uint32 i = 0; i < sizeof(kSupportedDevices) / sizeof(kSupportedDevices[0]); i++) { + for (uint32 i = 0; i < sizeof(kSupportedDevices) + / sizeof(kSupportedDevices[0]); i++) { if (info.device_id == kSupportedDevices[i].device_id) { type = i; *_cookie = index + 1; @@ -169,6 +170,7 @@ // initialize the structure for later use memset(gDeviceInfo[found], 0, sizeof(intel_info)); + gDeviceInfo[found]->init_status = B_NO_INIT; gDeviceInfo[found]->id = found; gDeviceInfo[found]->pci = info; gDeviceInfo[found]->registers = (uint8 *)info->u.h0.base_registers[0]; Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp 2007-06-04 15:32:01 UTC (rev 21321) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp 2007-06-04 16:04:05 UTC (rev 21322) @@ -20,6 +20,14 @@ #include +#define TRACE_DEVICE +#ifdef TRACE_DEVICE +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + + class AreaKeeper { public: AreaKeeper(); @@ -492,11 +500,7 @@ init_interrupt_handler(info); - info.cookie_magic = INTEL_COOKIE_MAGIC; - // this makes the cookie valid to be used - - dprintf(DEVICE_NAME "intel_extreme_init() completed successfully!\n"); - + TRACE((DEVICE_NAME "intel_extreme_init() completed successfully!\n")); return B_OK; } @@ -504,7 +508,7 @@ void intel_extreme_uninit(intel_info &info) { - dprintf(DEVICE_NAME": intel_extreme_uninit()\n"); + TRACE((DEVICE_NAME": intel_extreme_uninit()\n")); if (!info.fake_interrupts && info.shared_info->vblank_sem > 0) { // disable interrupt generation Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h 2007-06-04 15:32:01 UTC (rev 21321) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h 2007-06-04 16:04:05 UTC (rev 21322) @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -17,8 +17,8 @@ struct intel_info { - uint32 cookie_magic; int32 open_count; + status_t init_status; int32 id; pci_info *pci; uint8 *registers; From axeld at pinc-software.de Mon Jun 4 18:10:38 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 04 Jun 2007 18:10:38 +0200 CEST Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <9662584457-BeMail@kirilla> Message-ID: <21166074205-BeMail@zon> "Jonas Sundstr?m" wrote: > Perhaps it would be confusing to have the player have all these > different modes. I don't know. How about 3rd party opportunity? :-) Bye, Axel. From jonas at kirilla.com Mon Jun 4 18:36:09 2007 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Mon, 04 Jun 2007 18:36:09 +0200 CEST Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <21166074205-BeMail@zon> Message-ID: <14153575040-BeMail@kirilla> "Axel D?rfler" wrote: > "Jonas Sundstr?m" wrote: > > Perhaps it would be confusing to have the player have all these > > different modes. I don't know. > > How about 3rd party opportunity? :-) Hehe.. :) Mind you, Be apparently considered the playlist a 3rd party opportunity. ;P My general opinion is that if something should be a added to a Haiku application which is/was a BeOS application, it should be done in a way which continues the design we have inherited, extending it gently. Sometimes what people want isn't the right thing. People wanted Single Window Navigation, which IMO is not in line with classic BeOS, or the MacOS it was meant to replace. /Jonas. From leavengood at gmail.com Mon Jun 4 19:19:52 2007 From: leavengood at gmail.com (Ryan Leavengood) Date: Mon, 4 Jun 2007 13:19:52 -0400 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <14153575040-BeMail@kirilla> References: <21166074205-BeMail@zon> <14153575040-BeMail@kirilla> Message-ID: On 6/4/07, Jonas Sundstr?m wrote: > > Mind you, Be apparently considered the playlist a 3rd party > opportunity. ;P Yeah but the line between what was standard third party stuff and OS stuff back in the Be days has changed. Though we need to be careful about going too crazy in implementing everything within or with the OS. > My general opinion is that if something should be a added to a > Haiku application which is/was a BeOS application, it should be > done in a way which continues the design we have inherited, > extending it gently. Yeah that makes sense. I'm sort of on the fence on this playlist thing. A lot of times I will listen to music in directory order (which is usually the CD track order), so playing from a directory would be fine. But sometimes I want to mix things up by re-arranging a song or two. Not having that option would annoy me. Maybe there is a way to do both without getting too confusing or complicated? But I agree it is definitely the "Be way" to have a playlist from a directory listing or a query result. > Sometimes what people want isn't the right thing. People wanted > Single Window Navigation, which IMO is not in line with classic > BeOS, or the MacOS it was meant to replace. I know what you mean, but that sounds pretty elitist. Regardless of whether it seems "right" or not, if users want or prefer something, that should be seriously considered. Ryan From jonas at kirilla.com Mon Jun 4 20:09:33 2007 From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=) Date: Mon, 04 Jun 2007 20:09:33 +0200 CEST Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: Message-ID: <19757782934-BeMail@kirilla> "Ryan Leavengood" wrote: ... > > Sometimes what people want isn't the right thing. People > > wanted Single Window Navigation, which IMO is not in > > line with classic BeOS, or the MacOS it was meant to replace. > > I know what you mean, but that sounds pretty elitist. Regardless > of whether it seems "right" or not, if users want or prefer > something, > that should be seriously considered. Considered, yes. I admitt that it is elitist, but nobody benefits from an OS with conflicting ideas and mechanisms. It wouldn't be good for users, or 3'rd party developers. I think there has to be a shared creative vision, and follow-through, for the result to be good. Reimplementing R5 is at least something of a shared vision. Sorry for abusing the commits list like this. :I I mean this in a general sense and not as argumentation for Tracker support in the MediaPlayer. /Jonas. From axeld at mail.berlios.de Mon Jun 4 20:21:44 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 4 Jun 2007 20:21:44 +0200 Subject: [Haiku-commits] r21323 - haiku/trunk/src/apps/mediaplayer/playlist Message-ID: <200706041821.l54ILiaj026967@sheep.berlios.de> Author: axeld Date: 2007-06-04 20:21:44 +0200 (Mon, 04 Jun 2007) New Revision: 21323 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21323&view=rev Modified: haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.h haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.h haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.h haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.h Log: Fixed build under Dano; doesn't work there, though, but hangs on start in some endless loop. Modified: haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.h 2007-06-04 16:04:05 UTC (rev 21322) +++ haiku/trunk/src/apps/mediaplayer/playlist/CopyPLItemsCommand.h 2007-06-04 18:21:44 UTC (rev 21323) @@ -12,6 +12,7 @@ #include "Command.h" class Playlist; +struct entry_ref; class CopyPLItemsCommand : public Command { public: Modified: haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.h 2007-06-04 16:04:05 UTC (rev 21322) +++ haiku/trunk/src/apps/mediaplayer/playlist/ImportPLItemsCommand.h 2007-06-04 18:21:44 UTC (rev 21323) @@ -13,6 +13,7 @@ class BMessage; class Playlist; +struct entry_ref; class ImportPLItemsCommand : public Command { public: Modified: haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.h 2007-06-04 16:04:05 UTC (rev 21322) +++ haiku/trunk/src/apps/mediaplayer/playlist/MovePLItemsCommand.h 2007-06-04 18:21:44 UTC (rev 21323) @@ -12,6 +12,7 @@ #include "Command.h" class Playlist; +struct entry_ref; class MovePLItemsCommand : public Command { public: Modified: haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h 2007-06-04 16:04:05 UTC (rev 21322) +++ haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h 2007-06-04 18:21:44 UTC (rev 21323) @@ -25,6 +25,8 @@ #include #include +class BMessage; + class Playlist : public BLocker { public: class Listener { Modified: haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.h 2007-06-04 16:04:05 UTC (rev 21322) +++ haiku/trunk/src/apps/mediaplayer/playlist/RemovePLItemsCommand.h 2007-06-04 18:21:44 UTC (rev 21323) @@ -12,6 +12,7 @@ #include "Command.h" class Playlist; +struct entry_ref; class RemovePLItemsCommand : public Command { public: From axeld at mail.berlios.de Tue Jun 5 00:31:25 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 5 Jun 2007 00:31:25 +0200 Subject: [Haiku-commits] r21324 - haiku/trunk/src/system/kernel/debug Message-ID: <200706042231.l54MVPom017658@sheep.berlios.de> Author: axeld Date: 2007-06-05 00:31:24 +0200 (Tue, 05 Jun 2007) New Revision: 21324 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21324&view=rev Modified: haiku/trunk/src/system/kernel/debug/debug.c Log: * Now replaces the first argument with the actual function name as find_command() also works for partial matches (which for example broke "running" and "ready" when you only entered a part of it). * Renamed the global args pointer to sArguments. Modified: haiku/trunk/src/system/kernel/debug/debug.c =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.c 2007-06-04 18:21:44 UTC (rev 21323) +++ haiku/trunk/src/system/kernel/debug/debug.c 2007-06-04 22:31:24 UTC (rev 21324) @@ -82,7 +82,7 @@ static char sLineBuffer[HISTORY_SIZE][LINE_BUFFER_SIZE] = { "", }; static char sParseLine[LINE_BUFFER_SIZE]; static int32 sCurrentLine = 0; -static char *args[MAX_ARGS] = { NULL, }; +static char *sArguments[MAX_ARGS] = { NULL, }; #define distance(a, b) ((a) < (b) ? (b) - (a) : (a) - (b)) @@ -321,6 +321,7 @@ return *_argc = index; } + /*! This function is a safe gate through which debugger commands are invoked. It sets a fault handler before invoking the command, so that an invalid memory access will not result in another KDL session on top of this one @@ -328,15 +329,18 @@ the stack after catching a fault. */ static int -invoke_command(int (*command)(int, char **), int argc, char** argv) +invoke_command(struct debugger_command *command, int argc, char** argv) { struct thread* thread = thread_get_current_thread(); addr_t oldFaultHandler = thread->fault_handler; + // replace argv[0] with the actual command name + argv[0] = (char *)command->name; + // Invoking the command directly might be useful when debugging debugger // commands. if (sInvokeCommandDirectly) - return command(argc, argv); + return command->func(argc, argv); if (setjmp(sInvokeCommandEnv) == 0) { int result; @@ -346,7 +350,7 @@ if (!thread) goto error; - result = command(argc, argv); + result = command->func(argc, argv); thread->fault_handler = oldFaultHandler; return result; @@ -377,7 +381,7 @@ kprintf("kdebug> "); read_line(sLineBuffer[sCurrentLine], LINE_BUFFER_SIZE); - parse_line(sLineBuffer[sCurrentLine], args, &argc, MAX_ARGS); + parse_line(sLineBuffer[sCurrentLine], sArguments, &argc, MAX_ARGS); // We support calling last executed command again if // B_KDEDUG_CONT was returned last time, so cmd != NULL @@ -387,12 +391,12 @@ sDebuggerOnCPU = smp_get_current_cpu(); if (argc > 0) - cmd = find_command(args[0], true); + cmd = find_command(sArguments[0], true); if (cmd == NULL) kprintf("unknown command, enter \"help\" to get a list of all supported commands\n"); else { - int rc = invoke_command(cmd->func, argc, args); + int rc = invoke_command(cmd, argc, sArguments); if (rc == B_KDEBUG_QUIT) break; // okay, exit now. From stefano.ceccherini at gmail.com Tue Jun 5 08:36:21 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Tue, 5 Jun 2007 08:36:21 +0200 Subject: [Haiku-commits] r21305 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <19757782934-BeMail@kirilla> References: <19757782934-BeMail@kirilla> Message-ID: <894b9700706042336rf6d0be3ucecf75fe02585d2c@mail.gmail.com> 2007/6/4, Jonas Sundstr?m : > I admitt that it is elitist, but nobody benefits from an OS with > conflicting ideas and mechanisms. It wouldn't be good for users, > or 3'rd party developers. Yes, but only developers benefit from an OS where developers don't listen to users feedback and think they are doing "The Right Thing", "The Right Way", "The Good Way", etc. etc. For example: Which is the "Right Way" to handle emails on beos ? "Oh, we use Tracker to handle everything, just place a query with ..." etc. etc. But many people don't like it this way (me included), and prefer the good old three pane views mail reader (Beam, for example). So let's not always do things "The Be Way" because it's not always the best choice. From stippi at mail.berlios.de Tue Jun 5 11:50:21 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 5 Jun 2007 11:50:21 +0200 Subject: [Haiku-commits] r21325 - haiku/trunk/build/jam Message-ID: <200706050950.l559oL8B009547@sheep.berlios.de> Author: stippi Date: 2007-06-05 11:50:21 +0200 (Tue, 05 Jun 2007) New Revision: 21325 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21325&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: * moved Pulse from Apps to Demos Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2007-06-04 22:31:24 UTC (rev 21324) +++ haiku/trunk/build/jam/HaikuImage 2007-06-05 09:50:21 UTC (rev 21325) @@ -43,7 +43,7 @@ zipcloak zipgrep zipnote zipsplit zmore znew ; -BEOS_APPS = Terminal Expander People ShowImage Pulse ProcessController +BEOS_APPS = Terminal Expander People ShowImage ProcessController SoundRecorder Magnify DiskProbe AboutSystem StyledEdit Installer Workspaces $(X86_ONLY)Cortex MediaPlayer DeskCalc MidiPlayer Icon-O-Matic Mail CDPlayer NetworkStatus TV @@ -52,8 +52,8 @@ Fonts Media Menu Mouse Keyboard Keymap Printers Screen ScreenSaver Sounds Time VirtualMemory ; -BEOS_DEMOS = BitmapDrawing Chart Clock FontDemo $(X86_ONLY)GLTeapot PictureTest - Playground Mandelbrot $(X86_ONLY)GLDirectMode +BEOS_DEMOS = BitmapDrawing Chart Clock FontDemo $(X86_ONLY)GLDirectMode + $(X86_ONLY)GLTeapot Mandelbrot PictureTest Playground Pulse ; BEOS_SYSTEM_LIB = libbe.so $(HAIKU_LIBSTDC++) libmedia.so libtracker.so libtranslation.so libnetwork.so libdebug.so libbsd.so libmail.so From jackburton at mail.berlios.de Tue Jun 5 12:20:06 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 5 Jun 2007 12:20:06 +0200 Subject: [Haiku-commits] r21326 - in haiku/trunk: headers/private/interface src/kits/interface Message-ID: <200706051020.l55AK6gT013531@sheep.berlios.de> Author: jackburton Date: 2007-06-05 12:20:06 +0200 (Tue, 05 Jun 2007) New Revision: 21326 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21326&view=rev Modified: haiku/trunk/headers/private/interface/MenuWindow.h haiku/trunk/src/kits/interface/MenuWindow.cpp Log: Changed the interaction between BMenuFrame, BMenuScroller and BMenuWindow. BMenuScroller now is just the scroller button, and it's a child of BMenuWindow. This simplifies attaching/detaching the scrollers, and it's also a bit cleaner. The lower scroller wasn't shown anymore for some reason, and this commit also fixes this problem. A drawing bug shows up now, though: when scrolling the menu UP, some spurious lines are drawn over the menu. I wonder if this is an app_server bug or what. Modified: haiku/trunk/headers/private/interface/MenuWindow.h =================================================================== --- haiku/trunk/headers/private/interface/MenuWindow.h 2007-06-05 09:50:21 UTC (rev 21325) +++ haiku/trunk/headers/private/interface/MenuWindow.h 2007-06-05 10:20:06 UTC (rev 21326) @@ -35,8 +35,15 @@ bool CheckForScrolling(BPoint cursor); private: - BMenuScroller *fScroller; + BMenu *fMenu; BMenuFrame *fMenuFrame; + BMenuScroller *fUpperScroller; + BMenuScroller *fLowerScroller; + + float fValue; + float fLimit; + + bool _Scroll(BPoint cursor); }; } // namespace BPrivate Modified: haiku/trunk/src/kits/interface/MenuWindow.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuWindow.cpp 2007-06-05 09:50:21 UTC (rev 21325) +++ haiku/trunk/src/kits/interface/MenuWindow.cpp 2007-06-05 10:20:06 UTC (rev 21326) @@ -20,44 +20,45 @@ class BMenuScroller : public BView { public: - BMenuScroller(BRect frame, BMenu *menu); - virtual ~BMenuScroller(); - - virtual void Draw(BRect updateRect); - bool Scroll(BPoint cursor); - + BMenuScroller(BRect frame); + + bool IsEnabled() const; + void SetEnabled(const bool &enabled); private: - BMenu *fMenu; - BRect fUpperButton; - BRect fLowerButton; + bool fEnabled; +}; - float fValue; - float fLimit; - bool fUpperEnabled; - bool fLowerEnabled; - - uint32 fButton; - BPoint fPosition; -}; - class BMenuFrame : public BView { public: BMenuFrame(BMenu *menu); - virtual ~BMenuFrame(); - + virtual void AttachedToWindow(); virtual void DetachedFromWindow(); virtual void Draw(BRect updateRect); - - private: + + private: friend class BMenuWindow; BMenu *fMenu; }; + +class UpperScroller : public BMenuScroller { +public: + UpperScroller(BRect frame); + virtual void Draw(BRect updateRect); +}; + +class LowerScroller : public BMenuScroller { +public: + LowerScroller(BRect frame); + virtual void Draw(BRect updateRect); +}; + } // namespace BPrivate + using namespace BPrivate; @@ -65,113 +66,89 @@ const int kScrollStep = 19; -BMenuScroller::BMenuScroller(BRect frame, BMenu *menu) +BMenuScroller::BMenuScroller(BRect frame) : BView(frame, "menu scroller", 0, B_WILL_DRAW | B_FRAME_EVENTS), - fMenu(menu), - fUpperButton(0, 0, frame.right, kScrollerHeight), - fLowerButton(0, frame.bottom - kScrollerHeight, frame.right, frame.bottom), - fValue(0), - fUpperEnabled(false), - fLowerEnabled(true) + fEnabled(false) { - if (!menu) - debugger("BMenuScroller(): Scroller not attached to a menu!"); - SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR)); - - fLimit = menu->Bounds().Height() - (frame.Height() - 2 * kScrollerHeight); + SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR)); } -BMenuScroller::~BMenuScroller() +bool +BMenuScroller::IsEnabled() const { + return fEnabled; } -bool -BMenuScroller::Scroll(BPoint cursor) +void +BMenuScroller::SetEnabled(const bool &enabled) { - ConvertFromScreen(&cursor); + fEnabled = enabled; +} - if (fLowerEnabled && fLowerButton.Contains(cursor)) { - if (fValue == 0) { - fUpperEnabled = true; - - Invalidate(fUpperButton); - } - if (fValue + kScrollStep >= fLimit) { - // If we reached the limit, we don't want to scroll a whole - // 'step' if not needed. - fMenu->ScrollBy(0, fLimit - fValue); - fValue = fLimit; - fLowerEnabled = false; - Invalidate(fLowerButton); +// #pragma mark - - } else { - fMenu->ScrollBy(0, kScrollStep); - fValue += kScrollStep; - } - } else if (fUpperEnabled && fUpperButton.Contains(cursor)) { - if (fValue == fLimit) { - fLowerEnabled = true; - Invalidate(fLowerButton); - } - if (fValue - kScrollStep <= 0) { - fMenu->ScrollBy(0, -fValue); - fValue = 0; - fUpperEnabled = false; - Invalidate(fUpperButton); - - } else { - fMenu->ScrollBy(0, -kScrollStep); - fValue -= kScrollStep; - } - } else { - return false; - } - - snooze(10000); - - return true; +UpperScroller::UpperScroller(BRect frame) + : + BMenuScroller(frame) +{ } void -BMenuScroller::Draw(BRect updateRect) +UpperScroller::Draw(BRect updateRect) { SetLowColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_1_TINT)); float middle = Bounds().right / 2; // Draw the upper arrow. - if (updateRect.Intersects(fUpperButton)) { - if (fUpperEnabled) - SetHighColor(0, 0, 0); - else - SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), - B_DARKEN_2_TINT)); + if (IsEnabled()) + SetHighColor(0, 0, 0); + else + SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), + B_DARKEN_2_TINT)); - FillRect(fUpperButton, B_SOLID_LOW); + FillRect(Bounds(), B_SOLID_LOW); - FillTriangle(BPoint(middle, (kScrollerHeight / 2) - 3), - BPoint(middle + 5, (kScrollerHeight / 2) + 2), - BPoint(middle - 5, (kScrollerHeight / 2) + 2)); - } + FillTriangle(BPoint(middle, (kScrollerHeight / 2) - 3), + BPoint(middle + 5, (kScrollerHeight / 2) + 2), + BPoint(middle - 5, (kScrollerHeight / 2) + 2)); +} + +// #pragma mark - + + +LowerScroller::LowerScroller(BRect frame) + : + BMenuScroller(frame) +{ +} + + +void +LowerScroller::Draw(BRect updateRect) +{ + SetLowColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_1_TINT)); + + BRect frame = Bounds(); // Draw the lower arrow. - if (updateRect.Intersects(fLowerButton)) { - if (fLowerEnabled) - SetHighColor(0, 0, 0); - else - SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), - B_DARKEN_2_TINT)); + if (IsEnabled()) + SetHighColor(0, 0, 0); + else + SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), + B_DARKEN_2_TINT)); - FillRect(fLowerButton, B_SOLID_LOW); + FillRect(Bounds(), B_SOLID_LOW); - FillTriangle(BPoint(middle, fLowerButton.bottom - (kScrollerHeight / 2) + 3), - BPoint(middle + 5, fLowerButton.bottom - (kScrollerHeight / 2) - 2), - BPoint(middle - 5, fLowerButton.bottom - (kScrollerHeight / 2) - 2)); - } + float middle = Bounds().right / 2; + + FillTriangle(BPoint(middle, frame.bottom - (kScrollerHeight / 2) + 3), + BPoint(middle + 5, frame.bottom - (kScrollerHeight / 2) - 2), + BPoint(middle - 5, frame.bottom - (kScrollerHeight / 2) - 2)); } @@ -185,11 +162,6 @@ } -BMenuFrame::~BMenuFrame() -{ -} - - void BMenuFrame::AttachedToWindow() { @@ -246,6 +218,7 @@ } + // #pragma mark - @@ -253,8 +226,10 @@ // The window will be resized by BMenu, so just pass a dummy rect : BWindow(BRect(0, 0, 0, 0), name, B_BORDERED_WINDOW_LOOK, kMenuWindowFeel, B_NOT_ZOOMABLE | B_AVOID_FOCUS), - fScroller(NULL), - fMenuFrame(NULL) + fMenu(NULL), + fMenuFrame(NULL), + fUpperScroller(NULL), + fLowerScroller(NULL) { } @@ -273,6 +248,7 @@ fMenuFrame = new BMenuFrame(menu); AddChild(fMenuFrame); menu->MakeFocus(true); + fMenu = menu; } } @@ -280,14 +256,12 @@ void BMenuWindow::DetachMenu() { + DetachScrollers(); if (fMenuFrame) { - if (fScroller) { - DetachScrollers(); - } else { - RemoveChild(fMenuFrame); - } + RemoveChild(fMenuFrame); delete fMenuFrame; fMenuFrame = NULL; + fMenu = NULL; } } @@ -297,45 +271,112 @@ { // We want to attach a scroller only if there's a menu frame already // existing. - if (fScroller || !fMenuFrame) + if (!fMenu || !fMenuFrame) return; + + fMenu->MakeFocus(true); - RemoveChild(fMenuFrame); - fScroller = new BMenuScroller(Bounds(), fMenuFrame->fMenu); - fScroller->AddChild(fMenuFrame); - AddChild(fScroller); + BRect frame = Bounds(); + fUpperScroller = new UpperScroller(BRect(0, 0, frame.right, kScrollerHeight)); + AddChild(fUpperScroller); + fLowerScroller = new LowerScroller(BRect(0, frame.bottom - kScrollerHeight, frame.right, frame.bottom)); + AddChild(fLowerScroller); + + fUpperScroller->SetEnabled(false); + fLowerScroller->SetEnabled(true); - fMenuFrame->fMenu->MakeFocus(true); - fMenuFrame->ResizeBy(0, -2 * kScrollerHeight); fMenuFrame->MoveBy(0, kScrollerHeight); + + fMenuFrame->Bounds().PrintToStream(); + fValue = 0; + fLimit = fMenu->Bounds().Height() - (frame.Height() - 2 * kScrollerHeight); } void BMenuWindow::DetachScrollers() { - if(!fScroller || !fMenuFrame) - return; - // BeOS doesn't remember the position where the last scrolling ended, // so we just scroll back to the beginning. - fMenuFrame->fMenu->ScrollTo(0, 0); + fMenu->ScrollTo(0, 0); - fScroller->RemoveChild(fMenuFrame); - RemoveChild(fScroller); + if (fLowerScroller) { + RemoveChild(fLowerScroller); + delete fLowerScroller; + fLowerScroller = NULL; + } - delete fScroller; - fScroller = NULL; + if (fUpperScroller) { + RemoveChild(fUpperScroller); + delete fUpperScroller; + fUpperScroller = NULL; + } } bool BMenuWindow::CheckForScrolling(BPoint cursor) { - if (!fScroller) + if (!fMenuFrame) return false; - return fScroller->Scroll(cursor); + return _Scroll(cursor); } + +bool +BMenuWindow::_Scroll(BPoint cursor) +{ + ConvertFromScreen(&cursor); + + BRect lowerFrame; + BRect upperFrame; + if (fLowerScroller) + lowerFrame = fLowerScroller->Frame(); + if (fUpperScroller) + upperFrame = fUpperScroller->Frame(); + + if (fLowerScroller && fLowerScroller->IsEnabled() && lowerFrame.Contains(cursor)) { + if (fValue == 0) { + fUpperScroller->SetEnabled(true); + fUpperScroller->Invalidate(); + } + + if (fValue + kScrollStep >= fLimit) { + // If we reached the limit, we don't want to scroll a whole + // 'step' if not needed. + fMenu->ScrollBy(0, fLimit - fValue); + fValue = fLimit; + fLowerScroller->SetEnabled(false); + fLowerScroller->Invalidate(); + + } else { + fMenu->ScrollBy(0, kScrollStep); + fValue += kScrollStep; + } + } else if (fUpperScroller && fUpperScroller->IsEnabled() && upperFrame.Contains(cursor)) { + if (fValue == fLimit) { + fLowerScroller->SetEnabled(true); + fLowerScroller->Invalidate(); + } + + if (fValue - kScrollStep <= 0) { + fMenu->ScrollBy(0, -fValue); + fValue = 0; + fUpperScroller->SetEnabled(false); + fUpperScroller->Invalidate(); + + } else { + fMenu->ScrollBy(0, -kScrollStep); + fValue -= kScrollStep; + } + } else { + return false; + } + + snooze(10000); + + return true; +} + From stefano.ceccherini at gmail.com Tue Jun 5 12:24:31 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Tue, 5 Jun 2007 12:24:31 +0200 Subject: [Haiku-commits] r21326 - in haiku/trunk: headers/private/interface src/kits/interface In-Reply-To: <200706051020.l55AK6gT013531@sheep.berlios.de> References: <200706051020.l55AK6gT013531@sheep.berlios.de> Message-ID: <894b9700706050324m1e95be66g7403dbd2852e886b@mail.gmail.com> 2007/6/5, jackburton at BerliOS : > A drawing bug shows up now, though: when scrolling the menu UP, some > spurious lines are drawn over the menu. I wonder if this is an > app_server bug or what. Sorry, I meant when scrolling the menu DOWN. From axeld at pinc-software.de Tue Jun 5 12:30:41 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 05 Jun 2007 12:30:41 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r21326_-_in_haiku/trunk=3A_header?= =?iso-8859-15?q?s/private/interface_src/kits/interface?= In-Reply-To: <894b9700706050324m1e95be66g7403dbd2852e886b@mail.gmail.com> Message-ID: <11545093737-BeMail@zon> "Stefano Ceccherini" wrote: > 2007/6/5, jackburton at BerliOS : > > A drawing bug shows up now, though: when scrolling the menu UP, > > some > > spurious lines are drawn over the menu. I wonder if this is an > > app_server bug or what. > Sorry, I meant when scrolling the menu DOWN. Ah, okay, naturally ;-) Anyway, I guess this is an app_server bug indeed - maybe some kind of floating point conversion off-by-one kind of error somewhere. Bye, Axel. From superstippi at gmx.de Tue Jun 5 12:34:16 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 05 Jun 2007 12:34:16 +0200 Subject: [Haiku-commits] r21326 - in haiku/trunk: headers/private/interface src/kits/interface In-Reply-To: <11545093737-BeMail@zon> References: <11545093737-BeMail@zon> Message-ID: <20070605123416.954.3@stippis.WG> Axel D?rfler wrote (2007-06-05, 12:30:41 [+0200]): > "Stefano Ceccherini" wrote: > > 2007/6/5, jackburton at BerliOS : > > > A drawing bug shows up now, though: when scrolling the menu UP, > > > some > > > spurious lines are drawn over the menu. I wonder if this is an > > > app_server bug or what. > > Sorry, I meant when scrolling the menu DOWN. > > Ah, okay, naturally ;-) > Anyway, I guess this is an app_server bug indeed - maybe some kind of > floating point conversion off-by-one kind of error somewhere. Either that or your views overlap by one line. This is not the case, is it? Best regards, -Stephan From stefano.ceccherini at gmail.com Tue Jun 5 13:45:17 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Tue, 5 Jun 2007 13:45:17 +0200 Subject: [Haiku-commits] r21326 - in haiku/trunk: headers/private/interface src/kits/interface In-Reply-To: <20070605123416.954.3@stippis.WG> References: <11545093737-BeMail@zon> <20070605123416.954.3@stippis.WG> Message-ID: <894b9700706050445q10cf704bia92b240b4c15d334@mail.gmail.com> 2007/6/5, Stephan Assmus : > > Either that or your views overlap by one line. This is not the case, is it? That could also be the case, althought I didn't think it could lead to this weird bug. I'll double-check. Thanks. From jackburton at mail.berlios.de Tue Jun 5 13:50:15 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 5 Jun 2007 13:50:15 +0200 Subject: [Haiku-commits] r21327 - haiku/trunk/src/kits/interface Message-ID: <200706051150.l55BoF53002829@sheep.berlios.de> Author: jackburton Date: 2007-06-05 13:50:15 +0200 (Tue, 05 Jun 2007) New Revision: 21327 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21327&view=rev Modified: haiku/trunk/src/kits/interface/MenuWindow.cpp Log: BMenuFrame overlapped partially with a BMenuScroller. This fixes the spurious lines drawn over the menu. Thanks to Stephan for making me notice this! Modified: haiku/trunk/src/kits/interface/MenuWindow.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuWindow.cpp 2007-06-05 10:20:06 UTC (rev 21326) +++ haiku/trunk/src/kits/interface/MenuWindow.cpp 2007-06-05 11:50:15 UTC (rev 21327) @@ -285,10 +285,9 @@ fUpperScroller->SetEnabled(false); fLowerScroller->SetEnabled(true); - fMenuFrame->ResizeBy(0, -2 * kScrollerHeight); + fMenuFrame->ResizeBy(0, -2 * kScrollerHeight - 1); fMenuFrame->MoveBy(0, kScrollerHeight); - fMenuFrame->Bounds().PrintToStream(); fValue = 0; fLimit = fMenu->Bounds().Height() - (frame.Height() - 2 * kScrollerHeight); } From stefano.ceccherini at gmail.com Tue Jun 5 13:50:32 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Tue, 5 Jun 2007 13:50:32 +0200 Subject: [Haiku-commits] r21326 - in haiku/trunk: headers/private/interface src/kits/interface In-Reply-To: <894b9700706050445q10cf704bia92b240b4c15d334@mail.gmail.com> References: <11545093737-BeMail@zon> <20070605123416.954.3@stippis.WG> <894b9700706050445q10cf704bia92b240b4c15d334@mail.gmail.com> Message-ID: <894b9700706050450m632e0e2eu1a6e13750f1b4444@mail.gmail.com> 2007/6/5, Stefano Ceccherini : > 2007/6/5, Stephan Assmus : > > > > > Either that or your views overlap by one line. This is not the case, is it? > > That could also be the case, althought I didn't think it could lead to > this weird bug. I'll double-check. Thanks. That was indeed the case. Thank you! From kirilla at mail.berlios.de Tue Jun 5 14:09:44 2007 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Tue, 5 Jun 2007 14:09:44 +0200 Subject: [Haiku-commits] r21328 - haiku/trunk/src/kits/tracker Message-ID: <200706051209.l55C9ig7006127@sheep.berlios.de> Author: kirilla Date: 2007-06-05 14:09:44 +0200 (Tue, 05 Jun 2007) New Revision: 21328 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21328&view=rev Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp Log: The menubar icon at the top-right of Tracker folder windows now uses the view color of its parent view. This fixes bug #551. Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp =================================================================== --- haiku/trunk/src/kits/tracker/ContainerWindow.cpp 2007-06-05 11:50:15 UTC (rev 21327) +++ haiku/trunk/src/kits/tracker/ContainerWindow.cpp 2007-06-05 12:09:44 UTC (rev 21328) @@ -333,7 +333,7 @@ void DraggableContainerIcon::AttachedToWindow() { - SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR)); + SetViewColor(Parent()->ViewColor()); FrameMoved(BPoint(0, 0)); // this decides whether to hide the icon or not } @@ -503,7 +503,12 @@ return; // Draw the icon, straddling the border +#ifdef __HAIKU__ + SetDrawingMode(B_OP_ALPHA); + SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); +#else SetDrawingMode(B_OP_OVER); +#endif float iconOffset = (Bounds().Width() - B_MINI_ICON) / 2; IconCache::sIconCache->Draw(window->TargetModel(), this, BPoint(iconOffset, iconOffset), kNormalIcon, B_MINI_ICON, true); From jackburton at mail.berlios.de Tue Jun 5 14:10:46 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 5 Jun 2007 14:10:46 +0200 Subject: [Haiku-commits] r21329 - haiku/trunk/src/kits/interface Message-ID: <200706051210.l55CAkhX006395@sheep.berlios.de> Author: jackburton Date: 2007-06-05 14:10:44 +0200 (Tue, 05 Jun 2007) New Revision: 21329 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21329&view=rev Modified: haiku/trunk/src/kits/interface/MenuWindow.cpp Log: Some other changes, make sure we delete all resources on destruction Modified: haiku/trunk/src/kits/interface/MenuWindow.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuWindow.cpp 2007-06-05 12:09:44 UTC (rev 21328) +++ haiku/trunk/src/kits/interface/MenuWindow.cpp 2007-06-05 12:10:44 UTC (rev 21329) @@ -1,14 +1,15 @@ /* - * Copyright 2001-2006, Haiku, Inc. + * Copyright 2001-2007, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: * Marc Flerackers (mflerackers at androme.be) - * Stefano Ceccherini (burton666 at libero.it) + * Stefano Ceccherini (stefano.ceccherini at gmail.com) */ //! BMenuWindow is a custom BWindow for BMenus. +#include #include #include @@ -50,12 +51,14 @@ virtual void Draw(BRect updateRect); }; + class LowerScroller : public BMenuScroller { public: LowerScroller(BRect frame); virtual void Draw(BRect updateRect); }; + } // namespace BPrivate @@ -142,7 +145,7 @@ SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT)); - FillRect(Bounds(), B_SOLID_LOW); + FillRect(frame, B_SOLID_LOW); float middle = Bounds().right / 2; @@ -236,6 +239,7 @@ BMenuWindow::~BMenuWindow() { + DetachMenu(); } @@ -274,6 +278,9 @@ if (!fMenu || !fMenuFrame) return; + if (fUpperScroller || fLowerScroller) + debugger("Scrollers are already attached!"); + fMenu->MakeFocus(true); BRect frame = Bounds(); @@ -298,7 +305,8 @@ { // BeOS doesn't remember the position where the last scrolling ended, // so we just scroll back to the beginning. - fMenu->ScrollTo(0, 0); + if (fMenu) + fMenu->ScrollTo(0, 0); if (fLowerScroller) { RemoveChild(fLowerScroller); @@ -317,7 +325,7 @@ bool BMenuWindow::CheckForScrolling(BPoint cursor) { - if (!fMenuFrame) + if (!fMenuFrame || !fUpperScroller || !fLowerScroller) return false; return _Scroll(cursor); @@ -327,16 +335,15 @@ bool BMenuWindow::_Scroll(BPoint cursor) { + ASSERT((fLowerScroller != NULL)); + ASSERT((fUpperScroller != NULL)); + ConvertFromScreen(&cursor); - BRect lowerFrame; - BRect upperFrame; - if (fLowerScroller) - lowerFrame = fLowerScroller->Frame(); - if (fUpperScroller) - upperFrame = fUpperScroller->Frame(); + BRect lowerFrame = fLowerScroller->Frame(); + BRect upperFrame = fUpperScroller->Frame(); - if (fLowerScroller && fLowerScroller->IsEnabled() && lowerFrame.Contains(cursor)) { + if (fLowerScroller->IsEnabled() && lowerFrame.Contains(cursor)) { if (fValue == 0) { fUpperScroller->SetEnabled(true); fUpperScroller->Invalidate(); @@ -354,7 +361,7 @@ fMenu->ScrollBy(0, kScrollStep); fValue += kScrollStep; } - } else if (fUpperScroller && fUpperScroller->IsEnabled() && upperFrame.Contains(cursor)) { + } else if (fUpperScroller->IsEnabled() && upperFrame.Contains(cursor)) { if (fValue == fLimit) { fLowerScroller->SetEnabled(true); fLowerScroller->Invalidate(); @@ -370,9 +377,8 @@ fMenu->ScrollBy(0, -kScrollStep); fValue -= kScrollStep; } - } else { + } else return false; - } snooze(10000); From superstippi at gmx.de Tue Jun 5 14:14:50 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 05 Jun 2007 14:14:50 +0200 Subject: [Haiku-commits] r21327 - haiku/trunk/src/kits/interface In-Reply-To: <200706051150.l55BoF53002829@sheep.berlios.de> References: <200706051150.l55BoF53002829@sheep.berlios.de> Message-ID: <20070605141450.7152.9@stippis.WG> jackburton at BerliOS wrote (2007-06-05, 13:50:15 [+0200]): > Author: jackburton > Date: 2007-06-05 13:50:15 +0200 (Tue, 05 Jun 2007) > New Revision: 21327 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21327&view=rev > > Modified: > haiku/trunk/src/kits/interface/MenuWindow.cpp > Log: > BMenuFrame overlapped partially with a BMenuScroller. This fixes the > spurious lines drawn over the menu. Thanks to Stephan for making me > notice this! See? app_server is NEVER to blame... haha, just kidding of course... :-) Best regards, -Stephan From axeld at pinc-software.de Tue Jun 5 14:48:48 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 05 Jun 2007 14:48:48 +0200 CEST Subject: [Haiku-commits] r21328 - haiku/trunk/src/kits/tracker In-Reply-To: <200706051209.l55C9ig7006127@sheep.berlios.de> Message-ID: <19832458868-BeMail@zon> kirilla at BerliOS wrote: > Log: > The menubar icon at the top-right of Tracker folder windows now uses > the view > color of its parent view. This fixes bug #551. Thanks! Bye, Axel. From jackburton at mail.berlios.de Tue Jun 5 15:05:16 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 5 Jun 2007 15:05:16 +0200 Subject: [Haiku-commits] r21330 - haiku/trunk/src/kits/interface Message-ID: <200706051305.l55D5GP0015288@sheep.berlios.de> Author: jackburton Date: 2007-06-05 15:05:14 +0200 (Tue, 05 Jun 2007) New Revision: 21330 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21330&view=rev Modified: haiku/trunk/src/kits/interface/MenuBar.cpp Log: Added some code to fix bug #953. If the mouse moves a bit while the buttons are down, the popup menu won't become sticky. Modified: haiku/trunk/src/kits/interface/MenuBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuBar.cpp 2007-06-05 12:10:44 UTC (rev 21329) +++ haiku/trunk/src/kits/interface/MenuBar.cpp 2007-06-05 13:05:14 UTC (rev 21330) @@ -7,6 +7,7 @@ * Stefano Ceccherini (burton666 at libero.it) */ +#include #include @@ -407,6 +408,17 @@ } +// Note: since sqrt is slow, we don't use it and return the square of the distance +// TODO: Move this to some common place, could be used in BMenu too. +#define square(x) ((x) * (x)) +static float +point_distance(const BPoint &pointA, const BPoint &pointB) +{ + return square(pointA.x - pointB.x) + square(pointA.y - pointB.y); +} +#undef square + + BMenuItem * BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu) { @@ -482,8 +494,24 @@ buttons = 1; // buttons must have been pressed in the meantime + // This code is needed to make menus + // that are children of BMenuFields "sticky" (see ticket #953) if (localAction == MENU_STATE_CLOSED) { - if (fExtraRect != NULL && fExtraRect->Contains(where)) { + // The mouse could have meen moved since the last time we + // checked its position. Unfortunately our child menus don't tell + // us the new position. + // TODO: Maybe have a shared struct between all menus + // where to store the current mouse position ? + BPoint newWhere; + ulong newButtons; + if (window->Lock()) { + GetMouse(&newWhere, &newButtons); + window->Unlock(); + } + + if (fExtraRect != NULL && fExtraRect->Contains(where) + // 9 = 3 pixels ^ 2 (since point_distance() returns the square of the distance) + && point_distance(newWhere, where) < 9) { SetStickyMode(true); fExtraRect = NULL; } else @@ -491,7 +519,7 @@ } } else if (menuItem == NULL && fSelected != NULL - && !IsStickyMode() /*&& Bounds().Contains(where)*/ && fState != MENU_STATE_TRACKING_SUBMENU) { + && !IsStickyMode() && fState != MENU_STATE_TRACKING_SUBMENU) { _SelectItem(NULL); fState = MENU_STATE_TRACKING; } From jackburton at mail.berlios.de Tue Jun 5 15:15:46 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 5 Jun 2007 15:15:46 +0200 Subject: [Haiku-commits] r21331 - haiku/trunk/src/kits/app Message-ID: <200706051315.l55DFkjb016899@sheep.berlios.de> Author: jackburton Date: 2007-06-05 15:15:45 +0200 (Tue, 05 Jun 2007) New Revision: 21331 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21331&view=rev Modified: haiku/trunk/src/kits/app/Handler.cpp Log: Changed the loops in BHandler::_SendNotices() and ::_ValidateHandlers(). See also r20183. Modified: haiku/trunk/src/kits/app/Handler.cpp =================================================================== --- haiku/trunk/src/kits/app/Handler.cpp 2007-06-05 13:05:14 UTC (rev 21330) +++ haiku/trunk/src/kits/app/Handler.cpp 2007-06-05 13:15:45 UTC (rev 21331) @@ -682,14 +682,15 @@ vector& handlers = fHandlerMap[what]; vector::iterator iterator = handlers.begin(); - for (; iterator != handlers.end(); iterator++) { + while (iterator != handlers.end()) { BMessenger target(*iterator); - if (!target.IsValid()) + if (!target.IsValid()) { + iterator++; continue; + } - handlers.erase(iterator); - iterator--; Add(target, what); + handlers.erase(iterator); } } @@ -704,13 +705,14 @@ vector& messengers = fMessengerMap[what]; vector::iterator iterator = messengers.begin(); - for (; iterator != messengers.end(); iterator++) { + while (iterator != messengers.end()) { if (!(*iterator).IsValid()) { messengers.erase(iterator); continue; } (*iterator).SendMessage(message); + iterator++; } } From umccullough at gmail.com Tue Jun 5 17:31:46 2007 From: umccullough at gmail.com (Urias McCullough) Date: Tue, 5 Jun 2007 08:31:46 -0700 Subject: [Haiku-commits] r21325 - haiku/trunk/build/jam In-Reply-To: <200706050950.l559oL8B009547@sheep.berlios.de> References: <200706050950.l559oL8B009547@sheep.berlios.de> Message-ID: <1e80d8750706050831p31ecda53uc33f46983fe0bbf0@mail.gmail.com> On 6/5/07, stippi at BerliOS wrote: > Author: stippi > Date: 2007-06-05 11:50:21 +0200 (Tue, 05 Jun 2007) > New Revision: 21325 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21325&view=rev > > Modified: > haiku/trunk/build/jam/HaikuImage > Log: > * moved Pulse from Apps to Demos Is it truly a demo? I realize with ProcessController it's not of much value, but isn't it still the only GUI app that can be used to disable individual processors? (assuming that's something that anyone would really want to do anyway) From superstippi at gmx.de Tue Jun 5 17:50:47 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 05 Jun 2007 17:50:47 +0200 Subject: [Haiku-commits] r21325 - haiku/trunk/build/jam In-Reply-To: <1e80d8750706050831p31ecda53uc33f46983fe0bbf0@mail.gmail.com> References: <200706050950.l559oL8B009547@sheep.berlios.de> <1e80d8750706050831p31ecda53uc33f46983fe0bbf0@mail.gmail.com> Message-ID: <20070605175047.13921.17@stippis.WG> Urias McCullough wrote (2007-06-05, 17:31:46 [+0200]): > On 6/5/07, stippi at BerliOS wrote: > > Author: stippi > > Date: 2007-06-05 11:50:21 +0200 (Tue, 05 Jun 2007) > > New Revision: 21325 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21325&view=rev > > > > Modified: > > haiku/trunk/build/jam/HaikuImage > > Log: > > * moved Pulse from Apps to Demos > > Is it truly a demo? > > I realize with ProcessController it's not of much value, but isn't it > still the only GUI app that can be used to disable individual > processors? (assuming that's something that anyone would really want > to do anyway) No, with ProcessController you can disable CPUs as well (wait a second - could - someone disabled that). We discussed that quite a while back, and some people (including me) were in favor of removing Pulse altogether. But then some other people pointed out that it is nice to have it running during demos, and to keep it for nostalgic reasons. Hence we all agreed to keep it, but move it in Demos. To have it in "Applications", alongsides ProcessController, is against our "one app per purpose" philosophy. And while I am at it, I might point out that we are currently discussing a cleanup in the Leaf menu. :-) Best regards, -Stephan From leavengood at gmail.com Tue Jun 5 18:12:57 2007 From: leavengood at gmail.com (Ryan Leavengood) Date: Tue, 5 Jun 2007 12:12:57 -0400 Subject: [Haiku-commits] r21325 - haiku/trunk/build/jam In-Reply-To: <20070605175047.13921.17@stippis.WG> References: <200706050950.l559oL8B009547@sheep.berlios.de> <1e80d8750706050831p31ecda53uc33f46983fe0bbf0@mail.gmail.com> <20070605175047.13921.17@stippis.WG> Message-ID: On 6/5/07, Stephan Assmus wrote: > > And while I am at it, I might point out that we are currently discussing a > cleanup in the Leaf menu. :-) On that note, maybe it is time for our Master Icon Artist (aka you Stephan) to create a nice new vector icon for the leaf menu. :-D Ryan From axeld at pinc-software.de Tue Jun 5 18:27:46 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 05 Jun 2007 18:27:46 +0200 CEST Subject: [Haiku-commits] r21325 - haiku/trunk/build/jam In-Reply-To: Message-ID: <32970594259-BeMail@zon> "Ryan Leavengood" wrote: > On 6/5/07, Stephan Assmus wrote: > > And while I am at it, I might point out that we are currently > > discussing a > > cleanup in the Leaf menu. :-) > On that note, maybe it is time for our Master Icon Artist (aka you > Stephan) to create a nice new vector icon for the leaf menu. :-D He already created the leaf we have now, and at least I would like to keep it as is; though it would probably not hurt to make a vector version from it. BTW why does AboutSystem has this maple leaf icon instead of the usual leaf? Bye, Axel. From axeld at pinc-software.de Tue Jun 5 18:52:40 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 05 Jun 2007 18:52:40 +0200 CEST Subject: [Haiku-commits] r21331 - haiku/trunk/src/kits/app In-Reply-To: <200706051315.l55DFkjb016899@sheep.berlios.de> Message-ID: <34464225717-BeMail@zon> jackburton at BerliOS wrote: > Log: > Changed the loops in BHandler::_SendNotices() and > ::_ValidateHandlers(). > See also r20183. Have you tested this? AFAICT the code was broken and still is broken; erase() renders the iterator invalid - which means ++/-- won't work on it anymore. I think the code would need to look like this: [...] vector::iterator invalid = iterator++; handlers.erase(invalid); Bye, Axel. From stefano.ceccherini at gmail.com Tue Jun 5 19:01:19 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Tue, 5 Jun 2007 19:01:19 +0200 Subject: [Haiku-commits] r21331 - haiku/trunk/src/kits/app In-Reply-To: <34464225717-BeMail@zon> References: <200706051315.l55DFkjb016899@sheep.berlios.de> <34464225717-BeMail@zon> Message-ID: <894b9700706051001k1705f53fpd46b72fc1072d550@mail.gmail.com> 2007/6/5, Axel D?rfler : > jackburton at BerliOS wrote: > > Log: > > Changed the loops in BHandler::_SendNotices() and > > ::_ValidateHandlers(). > > See also r20183. > > Have you tested this? AFAICT the code was broken and still is broken; > erase() renders the iterator invalid - which means ++/-- won't work on > it anymore. > I think the code would need to look like this: > > [...] > vector::iterator invalid = iterator++; > handlers.erase(invalid); > r20183 fixed the problem I was having with the Time preflet. And this change didn't break it. But I see what you mean. From axeld at pinc-software.de Tue Jun 5 19:29:29 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 05 Jun 2007 19:29:29 +0200 CEST Subject: [Haiku-commits] r21331 - haiku/trunk/src/kits/app In-Reply-To: <894b9700706051001k1705f53fpd46b72fc1072d550@mail.gmail.com> Message-ID: <36673091621-BeMail@zon> "Stefano Ceccherini" wrote: > 2007/6/5, Axel D?rfler : > > jackburton at BerliOS wrote: > > > Log: > > > Changed the loops in BHandler::_SendNotices() and > > > ::_ValidateHandlers(). > > > See also r20183. > > > > Have you tested this? AFAICT the code was broken and still is > > broken; > > erase() renders the iterator invalid - which means ++/-- won't work > > on > > it anymore. > > I think the code would need to look like this: > > > > [...] > > vector::iterator invalid = > > iterator++; > > handlers.erase(invalid); > r20183 fixed the problem I was having with the Time preflet. And this > change didn't break it. > But I see what you mean. I just checked again, and you generally shouldn't do it this way; although it might work for vectors. For lists and vectors you would usually do: iterator = list.erase(iterator); which automatically bumps iterator to the next item in the list/vector. For maps, however, you have to do what I proposed above - I even wrote a small test application, and it'll crash or hang when using a different approach. I've scanned the code for more problems like these (because I obviously used it in the wrong way before), and identified several problems I'm currently fixing. Thanks for the hint! Bye, Axel. From axeld at mail.berlios.de Tue Jun 5 19:45:03 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 5 Jun 2007 19:45:03 +0200 Subject: [Haiku-commits] r21332 - in haiku/trunk/src/kits: app storage translation Message-ID: <200706051745.l55Hj3WS007336@sheep.berlios.de> Author: axeld Date: 2007-06-05 19:45:02 +0200 (Tue, 05 Jun 2007) New Revision: 21332 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21332&view=rev Modified: haiku/trunk/src/kits/app/Handler.cpp haiku/trunk/src/kits/app/RegistrarThreadManager.cpp haiku/trunk/src/kits/storage/PathMonitor.cpp haiku/trunk/src/kits/translation/TranslatorRoster.cpp Log: Fixed various incorrect uses of the erase() method of several STL containers I introduced before. Thanks to Stefano for the hint! Modified: haiku/trunk/src/kits/app/Handler.cpp =================================================================== --- haiku/trunk/src/kits/app/Handler.cpp 2007-06-05 13:15:45 UTC (rev 21331) +++ haiku/trunk/src/kits/app/Handler.cpp 2007-06-05 17:45:02 UTC (rev 21332) @@ -690,7 +690,7 @@ } Add(target, what); - handlers.erase(iterator); + iterator = handlers.erase(iterator); } } @@ -707,7 +707,7 @@ while (iterator != messengers.end()) { if (!(*iterator).IsValid()) { - messengers.erase(iterator); + iterator = messengers.erase(iterator); continue; } @@ -793,10 +793,10 @@ vector &handlers = fHandlerMap[what]; - vector::iterator iter; - iter = find(handlers.begin(), handlers.end(), handler); - if (iter != handlers.end()) { - handlers.erase(iter); + vector::iterator iterator = find(handlers.begin(), + handlers.end(), handler); + if (iterator != handlers.end()) { + handlers.erase(iterator); if (handlers.empty()) fHandlerMap.erase(what); @@ -812,10 +812,10 @@ { vector &messengers = fMessengerMap[what]; - vector::iterator iter; - iter = find(messengers.begin(), messengers.end(), messenger); - if (iter != messengers.end()) { - messengers.erase(iter); + vector::iterator iterator = find(messengers.begin(), + messengers.end(), messenger); + if (iterator != messengers.end()) { + messengers.erase(iterator); if (messengers.empty()) fMessengerMap.erase(what); Modified: haiku/trunk/src/kits/app/RegistrarThreadManager.cpp =================================================================== --- haiku/trunk/src/kits/app/RegistrarThreadManager.cpp 2007-06-05 13:15:45 UTC (rev 21331) +++ haiku/trunk/src/kits/app/RegistrarThreadManager.cpp 2007-06-05 17:45:02 UTC (rev 21332) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2005, Haiku. + * Copyright 2001-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -132,7 +132,7 @@ } else { OUT("WARNING: RegistrarThreadManager::CleanupThreads(): NULL mime_update_thread_shared_data " "pointer found in and removed from RegistrarThreadManager::fThreads list\n"); - i = fThreads.erase(i); + fThreads.erase(i); } i = next; @@ -168,7 +168,7 @@ } else { OUT("WARNING: RegistrarThreadManager::ShutdownThreads(): NULL mime_update_thread_shared_data " "pointer found in and removed from RegistrarThreadManager::fThreads list\n"); - i = fThreads.erase(i); + fThreads.erase(i); } i = next; Modified: haiku/trunk/src/kits/storage/PathMonitor.cpp =================================================================== --- haiku/trunk/src/kits/storage/PathMonitor.cpp 2007-06-05 13:15:45 UTC (rev 21331) +++ haiku/trunk/src/kits/storage/PathMonitor.cpp 2007-06-05 17:45:02 UTC (rev 21332) @@ -813,11 +813,11 @@ return B_BAD_VALUE; struct watcher* watcher = iterator->second; - HandlerMap::iterator i = watcher->handlers.begin(); - for (; i != watcher->handlers.end(); i++) { + while (!watcher->handlers.empty()) { + HandlerMap::iterator i = watcher->handlers.begin(); PathHandler* handler = i->second; watcher->handlers.erase(i); - + if (handler->LockLooper()) handler->Quit(); } Modified: haiku/trunk/src/kits/translation/TranslatorRoster.cpp =================================================================== --- haiku/trunk/src/kits/translation/TranslatorRoster.cpp 2007-06-05 13:15:45 UTC (rev 21331) +++ haiku/trunk/src/kits/translation/TranslatorRoster.cpp 2007-06-05 17:45:02 UTC (rev 21332) @@ -838,14 +838,12 @@ void BTranslatorRoster::Private::_RescanChanged() { - EntryRefSet::iterator iterator = fRescanEntries.begin(); - - while (iterator != fRescanEntries.end()) { + while (!fRescanEntries.empty()) { + EntryRefSet::iterator iterator = fRescanEntries.begin(); int32 count; CreateTranslators(*iterator, count); fRescanEntries.erase(iterator); - iterator++; } } @@ -1002,7 +1000,8 @@ void -BTranslatorRoster::Private::_RemoveTranslators(const node_ref* nodeRef, const entry_ref* ref) +BTranslatorRoster::Private::_RemoveTranslators(const node_ref* nodeRef, + const entry_ref* ref) { if (ref == NULL && nodeRef == NULL) return; @@ -1012,6 +1011,9 @@ image_id image = -1; while (iterator != fTranslators.end()) { + TranslatorMap::iterator next = iterator; + next++; + const translator_item& item = iterator->second; if ((ref != NULL && item.ref == *ref) || (nodeRef != NULL && item.ref.device == nodeRef->device @@ -1026,7 +1028,7 @@ fTranslators.erase(iterator); } - iterator++; + iterator = next; } // Unload image from the removed translator From axeld at mail.berlios.de Tue Jun 5 19:54:47 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 5 Jun 2007 19:54:47 +0200 Subject: [Haiku-commits] r21333 - haiku/trunk/src/kits/tracker Message-ID: <200706051754.l55HslAK008391@sheep.berlios.de> Author: axeld Date: 2007-06-05 19:54:47 +0200 (Tue, 05 Jun 2007) New Revision: 21333 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21333&view=rev Modified: haiku/trunk/src/kits/tracker/TrashWatcher.cpp Log: Fixed a warning when compiling Tracker for BeOS. Modified: haiku/trunk/src/kits/tracker/TrashWatcher.cpp =================================================================== --- haiku/trunk/src/kits/tracker/TrashWatcher.cpp 2007-06-05 17:45:02 UTC (rev 21332) +++ haiku/trunk/src/kits/tracker/TrashWatcher.cpp 2007-06-05 17:54:47 UTC (rev 21333) @@ -162,7 +162,6 @@ // apply them onto the trash directory node size_t largeSize = 0; size_t smallSize = 0; - size_t vectorSize = 0; const void *largeData = GetTrackerResources()->LoadResource('ICON', fTrashFull ? kResTrashFullIcon : kResTrashIcon, &largeSize); @@ -170,6 +169,7 @@ fTrashFull ? kResTrashFullIcon : kResTrashIcon, &smallSize); #ifdef HAIKU_TARGET_PLATFORM_HAIKU + size_t vectorSize = 0; const void *vectorData = GetTrackerResources()->LoadResource( B_VECTOR_ICON_TYPE, fTrashFull ? kResTrashFullIcon : kResTrashIcon, &vectorSize); From korli at mail.berlios.de Tue Jun 5 21:24:28 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 5 Jun 2007 21:24:28 +0200 Subject: [Haiku-commits] r21334 - haiku/trunk/src/preferences/print Message-ID: <200706051924.l55JOSPT021767@sheep.berlios.de> Author: korli Date: 2007-06-05 21:24:28 +0200 (Tue, 05 Jun 2007) New Revision: 21334 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21334&view=rev Modified: haiku/trunk/src/preferences/print/Printers.h Log: fixed app signature Modified: haiku/trunk/src/preferences/print/Printers.h =================================================================== --- haiku/trunk/src/preferences/print/Printers.h 2007-06-05 17:54:47 UTC (rev 21333) +++ haiku/trunk/src/preferences/print/Printers.h 2007-06-05 19:24:28 UTC (rev 21334) @@ -33,7 +33,7 @@ #include -#define PRINTERS_SIGNATURE "application/x-vnd.Be-PRNT2" +#define PRINTERS_SIGNATURE "application/x-vnd.Be-PRNT" class PrintersApp : public BApplication { From stippi at mail.berlios.de Wed Jun 6 01:23:45 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 6 Jun 2007 01:23:45 +0200 Subject: [Haiku-commits] r21335 - in haiku/trunk/src/apps/mediaplayer: . supplier Message-ID: <200706052323.l55NNjGT023416@sheep.berlios.de> Author: stippi Date: 2007-06-06 01:23:44 +0200 (Wed, 06 Jun 2007) New Revision: 21335 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21335&view=rev Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp haiku/trunk/src/apps/mediaplayer/Controller.h haiku/trunk/src/apps/mediaplayer/InfoWin.cpp haiku/trunk/src/apps/mediaplayer/InfoWin.h haiku/trunk/src/apps/mediaplayer/MainWin.cpp haiku/trunk/src/apps/mediaplayer/supplier/AudioSupplier.h haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackAudioSupplier.cpp haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackAudioSupplier.h haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp haiku/trunk/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.h haiku/trunk/src/apps/mediaplayer/supplier/VideoSupplier.h Log: * re-enabled the InfoWin Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/Controller.cpp 2007-06-05 19:24:28 UTC (rev 21334) +++ haiku/trunk/src/apps/mediaplayer/Controller.cpp 2007-06-05 23:23:44 UTC (rev 21335) @@ -29,6 +29,7 @@ #include #include #include +#include #include "ControllerView.h" #include "PlaybackState.h" @@ -81,17 +82,12 @@ Controller::Controller() : fVideoView(NULL) - , fName() , fPaused(false) , fStopped(true) , fVolume(1.0) , fRef() , fMediaFile(0) -// TODO: remove, InfoWin depends on it but should be fixed -,fAudioTrack(0) -,fVideoTrack(0) -// , fDataLock("controller data lock") , fVideoSupplier(NULL) @@ -225,7 +221,6 @@ fPauseAtEndOfStream = false; fSeekToStartAfterPause = false; fDuration = 0; - fName = ref.name; _UpdatePosition(0); @@ -292,19 +287,16 @@ void Controller::GetSize(int *width, int *height) { - // you need to hole the data lock + BAutolock _(fVideoSupplierLock); - media_format format; - format.type = B_MEDIA_RAW_VIDEO; - format.u.raw_video = media_raw_video_format::wildcard; - format.u.raw_video.display.format = IsOverlayActive() ? B_YCbCr422 : B_RGB32; - - if (!fVideoTrack || B_OK != fVideoTrack->DecodedFormat(&format)) { + if (fVideoSupplier) { + media_format format = fVideoSupplier->Format(); + // TODO: take aspect ratio into account! + *height = format.u.raw_video.display.line_count; + *width = format.u.raw_video.display.line_width; + } else { *height = 480; *width = 640; - } else { - *height = format.u.raw_video.display.line_count; - *width = format.u.raw_video.display.line_width; } } @@ -312,7 +304,8 @@ int Controller::AudioTrackCount() { - // you need to hole the data lock + BAutolock _(fDataLock); + return fAudioTrackList->CountItems(); } @@ -320,7 +313,8 @@ int Controller::VideoTrackCount() { - // you need to hole the data lock + BAutolock _(fDataLock); + return fVideoTrackList->CountItems(); } @@ -334,7 +328,6 @@ if (!track) return B_ERROR; -fAudioTrack = track; delete fAudioSupplier; fAudioSupplier = new MediaTrackAudioSupplier(track); @@ -356,7 +349,6 @@ if (!track) return B_ERROR; -fVideoTrack = track; delete fVideoSupplier; fVideoSupplier = new MediaTrackVideoSupplier(track, IsOverlayActive() ? B_YCbCr422 : B_RGB32); @@ -374,43 +366,6 @@ void -Controller::SetVolume(float value) -{ - printf("Controller::SetVolume %.4f\n", value); - if (Lock()) { - fVolume = value; - if (fSoundOutput) - fSoundOutput->SetVolume(fVolume); - Unlock(); - } -} - - -float -Controller::Volume() const -{ - BAutolock _(fDataLock); - - return fVolume; -} - - -void -Controller::SetPosition(float value) -{ - printf("Controller::SetPosition %.4f\n", value); - - BAutolock _(fDataLock); - - fSeekPosition = bigtime_t(value * Duration()); - fSeekAudio = true; - fSeekVideo = true; - - fSeekToStartAfterPause = false; -} - - -void Controller::Stop() { printf("Controller::Stop\n"); @@ -532,9 +487,145 @@ } +void +Controller::SetVolume(float value) +{ + printf("Controller::SetVolume %.4f\n", value); + if (Lock()) { + fVolume = value; + if (fSoundOutput) + fSoundOutput->SetVolume(fVolume); + Unlock(); + } +} + + +float +Controller::Volume() const +{ + BAutolock _(fDataLock); + + return fVolume; +} + + +void +Controller::SetPosition(float value) +{ + printf("Controller::SetPosition %.4f\n", value); + + BAutolock _(fDataLock); + + fSeekPosition = bigtime_t(value * Duration()); + fSeekAudio = true; + fSeekVideo = true; + + fSeekToStartAfterPause = false; +} + + // #pragma mark - +bool +Controller::HasFile() +{ + // you need to hold the data lock + return fMediaFile != NULL; +} + + +status_t +Controller::GetFileFormatInfo(media_file_format* fileFormat) +{ + // you need to hold the data lock + if (!fMediaFile) + return B_NO_INIT; + return fMediaFile->GetFileFormatInfo(fileFormat); +} + + +status_t +Controller::GetCopyright(BString* copyright) +{ + // you need to hold the data lock + if (!fMediaFile) + return B_NO_INIT; + *copyright = fMediaFile->Copyright(); + return B_OK; +} + + +status_t +Controller::GetLocation(BString* location) +{ + // you need to hold the data lock + if (!fMediaFile) + return B_NO_INIT; + BPath path(&fRef); + status_t ret = path.InitCheck(); + if (ret < B_OK) + return ret; + *location = ""; + *location << "file://" << path.Path(); + return B_OK; +} + + +status_t +Controller::GetName(BString* name) +{ + // you need to hold the data lock + if (!fMediaFile) + return B_NO_INIT; + *name = fRef.name; + return B_OK; +} + + +status_t +Controller::GetEncodedVideoFormat(media_format* format) +{ + // you need to hold the data lock + if (fVideoSupplier) + return fVideoSupplier->GetEncodedFormat(format); + return B_NO_INIT; +} + + +status_t +Controller::GetVideoCodecInfo(media_codec_info* info) +{ + // you need to hold the data lock + if (fVideoSupplier) + return fVideoSupplier->GetCodecInfo(info); + return B_NO_INIT; +} + + +status_t +Controller::GetEncodedAudioFormat(media_format* format) +{ + // you need to hold the data lock + if (fAudioSupplier) + return fAudioSupplier->GetEncodedFormat(format); + return B_NO_INIT; +} + + +status_t +Controller::GetAudioCodecInfo(media_codec_info* info) +{ + // you need to hold the data lock + if (fAudioSupplier) + return fAudioSupplier->GetCodecInfo(info); + return B_NO_INIT; +} + + +// #pragma mark - + + void Controller::SetVideoView(VideoView *view) { @@ -735,7 +826,7 @@ if (!fSoundOutput || !(fSoundOutput->Format() == buffer->mediaFormat.u.raw_audio)) { delete fSoundOutput; - fSoundOutput = new (nothrow) SoundOutput(fName.String(), + fSoundOutput = new (nothrow) SoundOutput(fRef.name, buffer->mediaFormat.u.raw_audio); fSoundOutput->SetVolume(fVolume); bufferDuration = bigtime_t(1000000.0 Modified: haiku/trunk/src/apps/mediaplayer/Controller.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/Controller.h 2007-06-05 19:24:28 UTC (rev 21334) +++ haiku/trunk/src/apps/mediaplayer/Controller.h 2007-06-05 23:23:44 UTC (rev 21335) @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -89,6 +90,16 @@ void SetVolume(float value); float Volume() const; void SetPosition(float value); + + bool HasFile(); + status_t GetFileFormatInfo(media_file_format* fileFormat); + status_t GetCopyright(BString* copyright); + status_t GetLocation(BString* location); + status_t GetName(BString* name); + status_t GetEncodedVideoFormat(media_format* format); + status_t GetVideoCodecInfo(media_codec_info* info); + status_t GetEncodedAudioFormat(media_format* format); + status_t GetAudioCodecInfo(media_codec_info* info); // video view void SetVideoView(VideoView *view); @@ -155,15 +166,12 @@ }; VideoView * fVideoView; - BString fName; volatile bool fPaused; volatile bool fStopped; float fVolume; entry_ref fRef; BMediaFile * fMediaFile; -BMediaTrack * fAudioTrack; -BMediaTrack * fVideoTrack; mutable BLocker fDataLock; VideoSupplier* fVideoSupplier; Modified: haiku/trunk/src/apps/mediaplayer/InfoWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/InfoWin.cpp 2007-06-05 19:24:28 UTC (rev 21334) +++ haiku/trunk/src/apps/mediaplayer/InfoWin.cpp 2007-06-05 23:23:44 UTC (rev 21335) @@ -19,22 +19,24 @@ */ #include "InfoWin.h" -#include +#include #include #include -#include + #include #include -#include -#include +#include +#include #include -#include -#include "MainWin.h" +#include "Controller.h" +#include "ControllerObserver.h" + + #define NAME "File Info" #define MIN_WIDTH 350 -#define BASE_HEIGHT (32+32) +#define BASE_HEIGHT (32 + 32) //const rgb_color kGreen = { 152, 203, 152, 255 }; const rgb_color kRed = { 203, 152, 152, 255 }; @@ -47,7 +49,8 @@ class InfoView : public BView { public: InfoView(BRect frame, const char *name, float divider) - : BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE) + : BView(frame, name, B_FOLLOW_ALL, + B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE) , fDivider(divider) { } virtual ~InfoView() @@ -70,27 +73,31 @@ } +// #pragma mark - + + InfoWin::InfoWin(BPoint leftTop, Controller* controller) : BWindow(BRect(leftTop.x, leftTop.y, leftTop.x + MIN_WIDTH - 1, leftTop.y + 250), NAME, B_TITLED_WINDOW, - B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE), - fController(controller) + B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE) + , fController(controller) + , fControllerObserver(new ControllerObserver(this, + OBSERVE_FILE_CHANGES | OBSERVE_TRACK_CHANGES | OBSERVE_STAT_CHANGES)) { BRect rect = Bounds(); // accomodate for big fonts - float div; - div = MAX(2*32, be_plain_font->StringWidth("Container") + 5); + float div = max_c(2 * 32, be_plain_font->StringWidth("Container") + 5); fInfoView = new InfoView(rect, "background", div); fInfoView->SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR)); AddChild(fInfoView); BFont bigFont(be_plain_font); - bigFont.SetSize(bigFont.Size()+6); + bigFont.SetSize(bigFont.Size() + 6); font_height fh; bigFont.GetHeight(&fh); - fFilenameView = new BStringView(BRect(div+10, 20, + fFilenameView = new BStringView(BRect(div + 10, 20, rect.right - 10, 20 + fh.ascent + 5), "filename", ""); @@ -110,13 +117,13 @@ lr.right = div - 1; cr.left = div + 1; BRect tr; - tr = lr.OffsetToCopy(0,0).InsetByCopy(1,1); + tr = lr.OffsetToCopy(0, 0).InsetByCopy(5, 1); fLabelsView = new BTextView(lr, "labels", tr, B_FOLLOW_BOTTOM); fLabelsView->SetViewColor(kGreen); fLabelsView->SetAlignment(B_ALIGN_RIGHT); fLabelsView->SetWordWrap(false); AddChild(fLabelsView); - tr = cr.OffsetToCopy(0,0).InsetByCopy(1,1); + tr = cr.OffsetToCopy(0, 0).InsetByCopy(10, 1); fContentsView = new BTextView(cr, "contents", tr, B_FOLLOW_BOTTOM); fContentsView->SetWordWrap(false); AddChild(fContentsView); @@ -124,6 +131,8 @@ fLabelsView->MakeSelectable(); fContentsView->MakeSelectable(); + fController->AddListener(fControllerObserver); + Update(); Show(); } @@ -131,188 +140,46 @@ InfoWin::~InfoWin() { - printf("InfoWin::~InfoWin\n"); + fController->RemoveListener(fControllerObserver); + delete fControllerObserver; + //fInfoListView->MakeEmpty(); //delete [] fInfoItems; } +// #pragma mark - + + void -InfoWin::ResizeToPreferred() +InfoWin::FrameResized(float new_width, float new_height) { -#if 0 - int i; - float height = BASE_HEIGHT; - BListItem *li; - for (i = 0; (li = fInfoListView->ItemAt(i)); i++) { - height += li->Height(); - } - ResizeTo(Bounds().Width(), height); -#endif } void -InfoWin::Update(uint32 which) +InfoWin::MessageReceived(BMessage *msg) { -// status_t err; -// //char buf[256]; -// printf("InfoWin::Update(0x%08lx)\n", which); -// rgb_color vFgCol = ui_color(B_DOCUMENT_TEXT_COLOR); -// -// fLabelsView->SelectAll(); -// fContentsView->SelectAll(); -// fLabelsView->Clear(); -// fContentsView->Clear(); -// fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kBlue); -// fLabelsView->Insert("File Info\n"); -// fContentsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &vFgCol); -// fContentsView->Insert("\n"); -// -// fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kRed); -// //fContentsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &vFgCol); -// -// // lock the Main Window as we must access some fields there... -// if (fMainWin->LockWithTimeout(500000) < B_OK) -// return; // XXX: resend msg to ourselves ? -// -// Controller *c = fMainWin->fController; -// BMediaFile *mf = c->fMediaFile; -// -// if (which & INFO_VIDEO && c->VideoTrackCount() > 0) { -// fLabelsView->Insert("Video\n\n"); -// BString s; -// media_format fmt; -// media_raw_video_format vfmt; -// float fps; -// err = c->fVideoTrack->EncodedFormat(&fmt); -// //string_for_format(fmt, buf, sizeof(buf)); -// //printf("%s\n", buf); -// if (err < 0) { -// s << "(" << strerror(err) << ")"; -// } else if (fmt.type == B_MEDIA_ENCODED_VIDEO) { -// vfmt = fmt.u.encoded_video.output; -// media_codec_info mci; -// err = c->fVideoTrack->GetCodecInfo(&mci); -// if (err < 0) -// s << "(" << strerror(err) << ")"; -// else -// s << mci.pretty_name; //<< "(" << mci.short_name << ")"; -// } else if (fmt.type == B_MEDIA_RAW_VIDEO) { -// vfmt = fmt.u.raw_video; -// s << "raw video"; -// } else -// s << "unknown format"; -// s << "\n"; -// s << fmt.Width() << " x " << fmt.Height(); -// // encoded has output as 1st field... -// fps = vfmt.field_rate; -// s << ", " << fps << " fps"; -// s << "\n"; -// fContentsView->Insert(s.String()); -// } -// if (which & INFO_AUDIO && c->AudioTrackCount() > 0) { -// fLabelsView->Insert("Sound\n\n"); -// BString s; -// media_format fmt; -// media_raw_audio_format afmt; -// err = c->fAudioTrack->EncodedFormat(&fmt); -// //string_for_format(fmt, buf, sizeof(buf)); -// //printf("%s\n", buf); -// if (err < 0) { -// s << "(" << strerror(err) << ")"; -// } else if (fmt.type == B_MEDIA_ENCODED_AUDIO) { -// afmt = fmt.u.encoded_audio.output; -// media_codec_info mci; -// err = c->fAudioTrack->GetCodecInfo(&mci); -// if (err < 0) -// s << "(" << strerror(err) << ")"; -// else -// s << mci.pretty_name; //<< "(" << mci.short_name << ")"; -// } else if (fmt.type == B_MEDIA_RAW_AUDIO) { -// afmt = fmt.u.raw_audio; -// s << "raw audio"; -// } else -// s << "unknown format"; -// s << "\n"; -// uint32 bitps = 8 * (afmt.format & media_raw_audio_format::B_AUDIO_SIZE_MASK); -// uint32 chans = afmt.channel_count; -// float sr = afmt.frame_rate; -// -// if (bitps) -// s << bitps << " Bit "; -// if (chans == 1) -// s << "Mono"; -// else if (chans == 2) -// s << "Stereo"; -// else -// s << chans << "Channels"; -// s << ", "; -// if (sr) -// s << sr/1000; -// else -// s << "?"; -// s<< " kHz"; -// s << "\n"; -// fContentsView->Insert(s.String()); -// } -// if (which & INFO_STATS && fMainWin->fHasFile) { -// // TODO: check for live streams (no duration) -// fLabelsView->Insert("Duration\n"); -// BString s; -// bigtime_t d = c->Duration(); -// bigtime_t v; -// -// //s << d << "?s; "; -// -// d /= 1000; -// -// v = d / (3600 * 1000); -// d = d % (3600 * 1000); -// if (v) -// s << v << ":"; -// v = d / (60 * 1000); -// d = d % (60 * 1000); -// s << v << ":"; -// v = d / 1000; -// d = d % 1000; -// s << v; -// if (d) -// s << "." << d / 10; -// s << "\n"; -// fContentsView->Insert(s.String()); -// // TODO: demux/video/audio/... perfs (Kb/s) -// } -// if (which & INFO_TRANSPORT) { -// } -// if ((which & INFO_FILE) && fMainWin->fHasFile) { -// media_file_format ff; -// if (mf && (mf->GetFileFormatInfo(&ff) == B_OK)) { -// fLabelsView->Insert("Container\n"); -// BString s; -// s << ff.pretty_name; -// s << "\n"; -// fContentsView->Insert(s.String()); -// } -// fLabelsView->Insert("Location\n"); -// // TODO: make Controller save the entry_ref (url actually). -// fContentsView->Insert("file://\n"); -// fFilenameView->SetText(c->fName.String()); -// } -// if (which & INFO_COPYRIGHT && mf && mf->Copyright()) { -// -// fLabelsView->Insert("Copyright\n\n"); -// BString s; -// s << mf->Copyright(); -// s << "\n\n"; -// fContentsView->Insert(s.String()); -// } -// -// // we can unlock the main window now and let it work -// fMainWin->Unlock(); -// -// // now resize the window to the list view size... -// ResizeToPreferred(); + switch (msg->what) { + case MSG_CONTROLLER_FILE_FINISHED: + break; + case MSG_CONTROLLER_FILE_CHANGED: + Update(INFO_ALL); + break; + case MSG_CONTROLLER_VIDEO_TRACK_CHANGED: + Update(/*INFO_VIDEO | INFO_STATS*/INFO_ALL); + break; + case MSG_CONTROLLER_AUDIO_TRACK_CHANGED: + Update(/*INFO_AUDIO | INFO_STATS*/INFO_ALL); + break; + case MSG_CONTROLLER_VIDEO_STATS_CHANGED: + case MSG_CONTROLLER_AUDIO_STATS_CHANGED: + Update(/*INFO_STATS*/INFO_ALL); + break; + default: + BWindow::MessageReceived(msg); + break; + } } @@ -332,77 +199,188 @@ Update(INFO_STATS); } + +// #pragma mark - + + void -InfoWin::FrameResized(float new_width, float new_height) +InfoWin::ResizeToPreferred() { #if 0 - if (new_width != Bounds().Width() || new_height != Bounds().Height()) { - debugger("size wrong\n"); + float height = BASE_HEIGHT; + for (int i = 0; BListItem *li = fInfoListView->ItemAt(i); i++) { + height += li->Height(); } - - bool no_menu = fNoMenu || fIsFullscreen; - bool no_controls = fNoControls || fIsFullscreen; - - printf("FrameResized enter: new_width %.0f, new_height %.0f\n", new_width, new_height); - - int max_video_width = int(new_width) + 1; - int max_video_height = int(new_height) + 1 - (no_menu ? 0 : fMenuBarHeight) - (no_controls ? 0 : fControlsHeight); - - ASSERT(max_video_height >= 0); - - int y = 0; - - if (no_menu) { - if (!fMenuBar->IsHidden()) - fMenuBar->Hide(); - } else { -// fMenuBar->MoveTo(0, y); - fMenuBar->ResizeTo(new_width, fMenuBarHeight - 1); - if (fMenuBar->IsHidden()) - fMenuBar->Show(); - y += fMenuBarHeight; - } - - if (max_video_height == 0) { - if (!fVideoView->IsHidden()) - fVideoView->Hide(); - } else { -// fVideoView->MoveTo(0, y); -// fVideoView->ResizeTo(max_video_width - 1, max_video_height - 1); - ResizeVideoView(0, y, max_video_width, max_video_height); - if (fVideoView->IsHidden()) - fVideoView->Show(); - y += max_video_height; - } - - if (no_controls) { - if (!fControls->IsHidden()) - fControls->Hide(); - } else { - fControls->MoveTo(0, y); - fControls->ResizeTo(new_width, fControlsHeight - 1); - if (fControls->IsHidden()) - fControls->Show(); -// y += fControlsHeight; - } + ResizeTo(Bounds().Width(), height); #endif - - printf("FrameResized leave\n"); } void -InfoWin::MessageReceived(BMessage *msg) +InfoWin::Update(uint32 which) { - uint32 which; - switch (msg->what) { - case M_UPDATE_INFO: - if (msg->FindInt32("which", (int32 *)&which) < B_OK) - which = INFO_ALL; - Update(which); - break; - default: - BWindow::MessageReceived(msg); - break; +printf("InfoWin::Update(0x%08lx)\n", which); + fLabelsView->SetText(""); + fContentsView->SetText(""); + fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kBlue); + fLabelsView->Insert("\n"); + fContentsView->SetFontAndColor(be_plain_font, B_FONT_ALL); + fContentsView->Insert("\n"); + + fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kRed); + + status_t err; + // video track format information + if ((which & INFO_VIDEO) && fController->VideoTrackCount() > 0) { + fLabelsView->Insert("Video\n\n\n"); + BString s; + media_format format; + media_raw_video_format videoFormat; + err = fController->GetEncodedVideoFormat(&format); + if (err < B_OK) { + s << "(" << strerror(err) << ")"; + } else if (format.type == B_MEDIA_ENCODED_VIDEO) { + videoFormat = format.u.encoded_video.output; + media_codec_info mci; + err = fController->GetVideoCodecInfo(&mci); + if (err < B_OK) + s << "(" << strerror(err) << ")"; + else + s << mci.pretty_name; //<< "(" << mci.short_name << ")"; + } else if (format.type == B_MEDIA_RAW_VIDEO) { + videoFormat = format.u.raw_video; + s << "raw video"; + } else + s << "unknown format"; + s << "\n"; + s << format.Width() << " x " << format.Height(); + // encoded has output as 1st field... + s << ", " << videoFormat.field_rate << " fps"; + s << "\n\n"; + fContentsView->Insert(s.String()); } + + // audio track format information + if ((which & INFO_AUDIO) && fController->AudioTrackCount() > 0) { + fLabelsView->Insert("Audio\n\n\n"); + BString s; + media_format format; + media_raw_audio_format audioFormat; + err = fController->GetEncodedAudioFormat(&format); + //string_for_format(format, buf, sizeof(buf)); + //printf("%s\n", buf); + if (err < 0) { + s << "(" << strerror(err) << ")"; + } else if (format.type == B_MEDIA_ENCODED_AUDIO) { + audioFormat = format.u.encoded_audio.output; + media_codec_info mci; + err = fController->GetAudioCodecInfo(&mci); + if (err < 0) + s << "(" << strerror(err) << ")"; + else + s << mci.pretty_name; //<< "(" << mci.short_name << ")"; + } else if (format.type == B_MEDIA_RAW_AUDIO) { + audioFormat = format.u.raw_audio; + s << "raw audio"; + } else + s << "unknown format"; + s << "\n"; + uint32 bitsPerSample = 8 * (audioFormat.format + & media_raw_audio_format::B_AUDIO_SIZE_MASK); + uint32 channelCount = audioFormat.channel_count; + float sr = audioFormat.frame_rate; + + if (bitsPerSample > 0) + s << bitsPerSample << " Bit "; + if (channelCount == 1) + s << "Mono"; + else if (channelCount == 2) + s << "Stereo"; + else + s << channelCount << "Channels"; + s << ", "; + if (sr > 0.0) + s << sr / 1000; + else + s << "??"; + s<< " kHz"; + s << "\n\n"; + fContentsView->Insert(s.String()); + } + + // statistics + if ((which & INFO_STATS) && fController->HasFile()) { + fLabelsView->Insert("Duration\n\n"); + BString s; + bigtime_t d = fController->Duration(); + bigtime_t v; + + //s << d << "?s; "; + + d /= 1000; + + v = d / (3600 * 1000); + d = d % (3600 * 1000); + bool hours = v > 0; + if (hours) + s << v << ":"; + v = d / (60 * 1000); + d = d % (60 * 1000); + s << v << ":"; + v = d / 1000; + s << v; + if (hours) + s << " h"; + else + s << " min"; + s << "\n\n"; + fContentsView->Insert(s.String()); + // TODO: demux/video/audio/... perfs (Kb/s) + } + + if (which & INFO_TRANSPORT) { + // what is "Transport"? + } + + if (which & INFO_FILE) { + if (fController->HasFile()) { + media_file_format ff; + BString s; + if (fController->GetFileFormatInfo(&ff) == B_OK) { + fLabelsView->Insert("Container\n\n"); + s << ff.pretty_name; + s << "\n\n"; + fContentsView->Insert(s.String()); + } else + fContentsView->Insert("\n\n"); + fLabelsView->Insert("Location\n"); + if (fController->GetLocation(&s) < B_OK) + s = ""; + s << "\n"; + fContentsView->Insert(s.String()); + if (fController->GetName(&s) < B_OK) + s = ""; + fFilenameView->SetText(s.String()); + } else { + fFilenameView->SetText(""); + } + } + + if ((which & INFO_COPYRIGHT) && fController->HasFile()) { + + BString s; + if (fController->GetCopyright(&s) == B_OK && s.Length() > 0) { + fLabelsView->Insert("Copyright\n\n"); + s << "\n\n"; + fContentsView->Insert(s.String()); + } + } + + fController->Unlock(); + + ResizeToPreferred(); } + + + + Modified: haiku/trunk/src/apps/mediaplayer/InfoWin.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/InfoWin.h 2007-06-05 19:24:28 UTC (rev 21334) +++ haiku/trunk/src/apps/mediaplayer/InfoWin.h 2007-06-05 23:23:44 UTC (rev 21335) @@ -21,16 +21,12 @@ #define __FILE_INFO_WIN_H #include -#include -#include -class MainWin; class Controller; +class ControllerObserver; class InfoView; -#define M_UPDATE_INFO 'upda' - #define INFO_STATS 0x00000001 #define INFO_TRANSPORT 0x00000002 #define INFO_FILE 0x00000004 @@ -53,16 +49,16 @@ virtual void Pulse(); void ResizeToPreferred(); - void Update(uint32 which=INFO_ALL); // threadsafe + void Update(uint32 which = INFO_ALL); private: Controller* fController; + ControllerObserver* fControllerObserver; InfoView* fInfoView; BStringView* fFilenameView; BTextView* fLabelsView; BTextView* fContentsView; - }; #endif // __FILE_INFO_WIN_H Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2007-06-05 19:24:28 UTC (rev 21334) +++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2007-06-05 23:23:44 UTC (rev 21335) @@ -680,12 +680,6 @@ fInfoWin->Activate(); fInfoWin->Unlock(); } - - BMessenger msgr(fInfoWin); - BMessage m(M_UPDATE_INFO); - m.AddInt32("which", INFO_ALL); - msgr.SendMessage(&m); - msgr.SendMessage(B_WINDOW_ACTIVATED); } Modified: haiku/trunk/src/apps/mediaplayer/supplier/AudioSupplier.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/supplier/AudioSupplier.h 2007-06-05 19:24:28 UTC (rev 21334) +++ haiku/trunk/src/apps/mediaplayer/supplier/AudioSupplier.h 2007-06-05 23:23:44 UTC (rev 21335) @@ -8,7 +8,9 @@ #ifndef AUDIO_SUPPLIER_H #define AUDIO_SUPPLIER_H + #include +#include class AudioSupplier { public: @@ -16,6 +18,10 @@ [... truncated: 141 lines follow ...] From axeld at mail.berlios.de Wed Jun 6 01:58:22 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 6 Jun 2007 01:58:22 +0200 Subject: [Haiku-commits] r21336 - haiku/trunk/src/kits/interface Message-ID: <200706052358.l55NwM4l025433@sheep.berlios.de> Author: axeld Date: 2007-06-06 01:58:21 +0200 (Wed, 06 Jun 2007) New Revision: 21336 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21336&view=rev Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp haiku/trunk/src/kits/interface/View.cpp Log: * Applied Stefano's patch to fix bug #1241; BScrollBar::SetValue() did not work correctly for out of bounds values. * BView::ScrollBy() now limits itself to what eventually attached scroll bars allow; this fixes the problem Stefano was observing after having applied his patch. * Reenabled the limit check in BScrollBar::SetProportion(); after the above fix, I could not see any misbehaviour of Tracker anymore; IOW Tracker did not rely on this before, it was just hiding another bug :) * Minor cleanup in ScrollBar.cpp Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/ScrollBar.cpp 2007-06-05 23:23:44 UTC (rev 21335) +++ haiku/trunk/src/kits/interface/ScrollBar.cpp 2007-06-05 23:58:21 UTC (rev 21336) @@ -9,16 +9,17 @@ * Stephan A?mus */ -#include -#include -#include +#include + #include #include #include #include -#include +#include +#include +#include //#define TEST_MODE @@ -163,9 +164,13 @@ } +// #pragma mark - + + BScrollBar::BScrollBar(BRect frame, const char* name, BView *target, - float min, float max, orientation direction) - : BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS), + float min, float max, orientation direction) + : BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE + | B_FRAME_EVENTS), fMin(min), fMax(max), fSmallStep(1), @@ -177,18 +182,17 @@ fTargetName(NULL) { SetViewColor(B_TRANSPARENT_COLOR); - + fPrivateData = new BScrollBar::Private(this); SetTarget(target); _UpdateThumbFrame(); _UpdateArrowButtons(); - - SetResizingMode((direction == B_VERTICAL) ? - B_FOLLOW_TOP_BOTTOM | B_FOLLOW_RIGHT : - B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM ); - + + SetResizingMode(direction == B_VERTICAL + ? B_FOLLOW_TOP_BOTTOM | B_FOLLOW_RIGHT + : B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM); } @@ -223,29 +227,29 @@ status_t BScrollBar::Archive(BMessage *data, bool deep) const { - status_t err = BView::Archive(data,deep); + status_t err = BView::Archive(data, deep); if (err != B_OK) return err; - err = data->AddFloat("_range",fMin); + err = data->AddFloat("_range", fMin); if (err != B_OK) return err; - err = data->AddFloat("_range",fMax); + err = data->AddFloat("_range", fMax); if (err != B_OK) return err; - err = data->AddFloat("_steps",fSmallStep); + err = data->AddFloat("_steps", fSmallStep); if (err != B_OK) return err; - err = data->AddFloat("_steps",fLargeStep); + err = data->AddFloat("_steps", fLargeStep); if (err != B_OK) return err; - err = data->AddFloat("_val",fValue); + err = data->AddFloat("_val", fValue); if (err != B_OK) return err; - err = data->AddInt32("_orient",(int32)fOrientation); + err = data->AddInt32("_orient", (int32)fOrientation); if (err != B_OK) return err; - err = data->AddInt32("_prop",(int32)fProportion); - + err = data->AddInt32("_prop", (int32)fProportion); + return err; } @@ -253,7 +257,6 @@ void BScrollBar::AttachedToWindow() { - // R5's SB contacts the server if fValue!=0. I *think* we don't need to do anything here... } /* @@ -291,16 +294,18 @@ void BScrollBar::SetValue(float value) { - if (value == fValue) - return; - if (value > fMax) value = fMax; - if (value < fMin) + else if (value < fMin) value = fMin; - fValue = roundf(value); + value = roundf(value); + if (value == fValue) + return; + + fValue = value; + _UpdateThumbFrame(); _UpdateArrowButtons(); @@ -338,20 +343,19 @@ void BScrollBar::SetProportion(float value) { - // NOTE: The Tracker depends on the broken - // behaviour to allow a proportion less than - // 0 or greater than 1 -/* if (value < 0.0) + if (value < 0.0) value = 0.0; if (value > 1.0) - value = 1.0;*/ + value = 1.0; if (value != fProportion) { - bool oldEnabled = fPrivateData->fEnabled && fMin < fMax && fProportion < 1.0 && fProportion >= 0.0; + bool oldEnabled = fPrivateData->fEnabled && fMin < fMax + && fProportion < 1.0 && fProportion >= 0.0; fProportion = value; - bool newEnabled = fPrivateData->fEnabled && fMin < fMax && fProportion < 1.0 && fProportion >= 0.0; + bool newEnabled = fPrivateData->fEnabled && fMin < fMax + && fProportion < 1.0 && fProportion >= 0.0; _UpdateThumbFrame(); @@ -641,7 +645,8 @@ StrokeRect(bounds); bounds.InsetBy(1.0, 1.0); - bool enabled = fPrivateData->fEnabled && fMin < fMax && fProportion < 1.0 && fProportion >= 0.0; + bool enabled = fPrivateData->fEnabled && fMin < fMax + && fProportion < 1.0 && fProportion >= 0.0; rgb_color light, light1, dark, dark1, dark2, dark4; if (enabled) { @@ -1032,10 +1037,13 @@ // if there is not enough room, switch to single arrows even though // double arrows is specified - if (fOrientation == B_HORIZONTAL) - return Bounds().Width() > (Bounds().Height() + 1) * 4 + fPrivateData->fScrollBarInfo.min_knob_size * 2; - else - return Bounds().Height() > (Bounds().Width() + 1) * 4 + fPrivateData->fScrollBarInfo.min_knob_size * 2; + if (fOrientation == B_HORIZONTAL) { + return Bounds().Width() > (Bounds().Height() + 1) * 4 + + fPrivateData->fScrollBarInfo.min_knob_size * 2; + } else { + return Bounds().Height() > (Bounds().Width() + 1) * 4 + + fPrivateData->fScrollBarInfo.min_knob_size * 2; + } } // _UpdateThumbFrame @@ -1099,7 +1107,8 @@ } if (Window()) { - BRect invalid = oldFrame.IsValid() ? oldFrame | fPrivateData->fThumbFrame : fPrivateData->fThumbFrame; + BRect invalid = oldFrame.IsValid() ? oldFrame | fPrivateData->fThumbFrame + : fPrivateData->fThumbFrame; // account for those two dark lines if (fOrientation == B_HORIZONTAL) invalid.InsetBy(-2.0, 0.0); Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2007-06-05 23:23:44 UTC (rev 21335) +++ haiku/trunk/src/kits/interface/View.cpp 2007-06-05 23:58:21 UTC (rev 21336) @@ -1499,31 +1499,51 @@ void -BView::ScrollBy(float dh, float dv) +BView::ScrollBy(float deltaX, float deltaY) { - // scrolling by fractional values is not supported, is it? - dh = roundf(dh); - dv = roundf(dv); + // scrolling by fractional values is not supported + deltaX = roundf(deltaX); + deltaY = roundf(deltaY); // no reason to process this further if no scroll is intended. - if (dh == 0 && dv == 0) + if (deltaX == 0 && deltaY == 0) return; + // make sure scrolling is within valid bounds + if (fHorScroller) { + float min, max; + fHorScroller->GetRange(&min, &max); + + if (deltaX + fBounds.left < min) + deltaX = min - fBounds.left; + else if (deltaX + fBounds.left > max) + deltaX = max - fBounds.left; + } + if (fVerScroller) { + float min, max; + fVerScroller->GetRange(&min, &max); + + if (deltaY + fBounds.top < min) + deltaY = min - fBounds.top; + else if (deltaY + fBounds.top > max) + deltaY = max - fBounds.top; + } + check_lock(); // if we're attached to a window tell app_server about this change if (fOwner) { fOwner->fLink->StartMessage(AS_LAYER_SCROLL); - fOwner->fLink->Attach(dh); - fOwner->fLink->Attach(dv); + fOwner->fLink->Attach(deltaX); + fOwner->fLink->Attach(deltaY); fOwner->fLink->Flush(); fState->valid_flags &= ~(B_VIEW_FRAME_BIT | B_VIEW_ORIGIN_BIT); } - // we modify our bounds rectangle by dh/dv coord units hor/ver. - fBounds.OffsetBy(dh, dv); + // we modify our bounds rectangle by deltaX/deltaY coord units hor/ver. + fBounds.OffsetBy(deltaX, deltaY); // then set the new values of the scrollbars if (fHorScroller) From kirilla at mail.berlios.de Wed Jun 6 03:12:19 2007 From: kirilla at mail.berlios.de (kirilla at BerliOS) Date: Wed, 6 Jun 2007 03:12:19 +0200 Subject: [Haiku-commits] r21337 - haiku/trunk/src/apps/deskbar Message-ID: <200706060112.l561CJ5x031763@sheep.berlios.de> Author: kirilla Date: 2007-06-06 03:12:19 +0200 (Wed, 06 Jun 2007) New Revision: 21337 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21337&view=rev Modified: haiku/trunk/src/apps/deskbar/Switcher.cpp Log: Makes Switcher icons draw with alpha transparency from the start as well. Modified: haiku/trunk/src/apps/deskbar/Switcher.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/Switcher.cpp 2007-06-05 23:58:21 UTC (rev 21336) +++ haiku/trunk/src/apps/deskbar/Switcher.cpp 2007-06-06 01:12:19 UTC (rev 21337) @@ -1947,8 +1947,12 @@ continue; if (rect.Intersects(update) && teamGroup) { +#ifdef __HAIKU__ + SetDrawingMode(B_OP_ALPHA); + SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); +#else SetDrawingMode(B_OP_OVER); - +#endif teamGroup->Draw(this, rect, !fAutoScrolling && (i == mainIndex)); if (i == mainIndex) From jackburton at mail.berlios.de Wed Jun 6 15:20:51 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Wed, 6 Jun 2007 15:20:51 +0200 Subject: [Haiku-commits] r21338 - haiku/trunk/src/kits/tracker Message-ID: <200706061320.l56DKpUS011814@sheep.berlios.de> Author: jackburton Date: 2007-06-06 15:20:50 +0200 (Wed, 06 Jun 2007) New Revision: 21338 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21338&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp haiku/trunk/src/kits/tracker/PoseView.h Log: some forgotten fVariable -> sVariable renaming Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2007-06-06 01:12:19 UTC (rev 21337) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2007-06-06 13:20:50 UTC (rev 21338) @@ -288,7 +288,7 @@ PinPointToValidRange(origin); // init things related to laying out items - fListElemHeight = ceilf(fFontHeight < 20 ? 20 : fFontHeight + 6); + fListElemHeight = ceilf(sFontHeight < 20 ? 20 : sFontHeight + 6); SetIconPoseHeight(); GetLayoutInfo(ViewMode(), &fGrid, &fOffset); ResetPosePlacementHint(); @@ -650,7 +650,7 @@ float BPoseView::StringWidth(const char *str) const { - return fWidthBuf->StringWidth(str, 0, (int32)strlen(str), &fCurrentFont); + return sWidthBuffer->StringWidth(str, 0, (int32)strlen(str), &sCurrentFont); } @@ -658,7 +658,7 @@ BPoseView::StringWidth(const char *str, int32 len) const { ASSERT(strlen(str) == (uint32)len); - return fWidthBuf->StringWidth(str, 0, len, &fCurrentFont); + return sWidthBuffer->StringWidth(str, 0, len, &sCurrentFont); } @@ -877,12 +877,12 @@ BFont font(be_plain_font); font.SetSpacing(B_BITMAP_SPACING); SetFont(&font); - GetFont(&fCurrentFont); + GetFont(&sCurrentFont); // static - init just once - if (fFontHeight == -1) { - font.GetHeight(&fFontInfo); - fFontHeight = fFontInfo.ascent + fFontInfo.descent + fFontInfo.leading; + if (sFontHeight == -1) { + font.GetHeight(&sFontInfo); + sFontHeight = sFontInfo.ascent + sFontInfo.descent + sFontInfo.leading; } if (TTracker *app = dynamic_cast(be_app)) { @@ -906,17 +906,17 @@ switch (ViewMode()) { case kIconMode: fViewState->SetIconSize(B_LARGE_ICON); - fIconPoseHeight = ceilf(IconSizeInt() + fFontHeight + 1); + fIconPoseHeight = ceilf(IconSizeInt() + sFontHeight + 1); break; case kMiniIconMode: fViewState->SetIconSize(B_MINI_ICON); - fIconPoseHeight = ceilf(fFontHeight < IconSizeInt() ? IconSizeInt() : fFontHeight + 1); + fIconPoseHeight = ceilf(sFontHeight < IconSizeInt() ? IconSizeInt() : sFontHeight + 1); break; case kScaleIconMode: // IconSize should allready be set in MessageReceived() - fIconPoseHeight = ceilf(IconSizeInt() + fFontHeight + 1); + fIconPoseHeight = ceilf(IconSizeInt() + sFontHeight + 1); break; default: @@ -2270,9 +2270,9 @@ { bigtime_t doubleClickSpeed; get_click_speed(&doubleClickSpeed); - if (system_time() - fLastKeyTime > (doubleClickSpeed * 2)) { - strcpy(fMatchString, ""); - fCountView->SetTypeAhead(fMatchString); + if (system_time() - sLastKeyTime > (doubleClickSpeed * 2)) { + strcpy(sMatchString, ""); + fCountView->SetTypeAhead(sMatchString); delete fKeyRunner; fKeyRunner = NULL; } @@ -5878,11 +5878,11 @@ _inherited::KeyDown(bytes, count); else { if (fSelectionList->IsEmpty()) - fMatchString[0] = '\0'; + sMatchString[0] = '\0'; else { BPose *pose = fSelectionList->FirstItem(); - strncpy(fMatchString, pose->TargetModel()->Name(), B_FILE_NAME_LENGTH - 1); - fMatchString[B_FILE_NAME_LENGTH - 1] = '\0'; + strncpy(sMatchString, pose->TargetModel()->Name(), B_FILE_NAME_LENGTH - 1); + sMatchString[B_FILE_NAME_LENGTH - 1] = '\0'; } bool reverse = (Window()->CurrentMessage()->FindInt32("modifiers") @@ -5891,10 +5891,10 @@ BPose *pose = FindNextMatch(&index, reverse); if (!pose) { // wrap around if (reverse) { - fMatchString[0] = (char)0xff; - fMatchString[1] = '\0'; + sMatchString[0] = (char)0xff; + sMatchString[1] = '\0'; } else - fMatchString[0] = '\0'; + sMatchString[0] = '\0'; pose = FindNextMatch(&index, reverse); } @@ -5922,18 +5922,18 @@ case B_BACKSPACE: // remove last char from the typeahead buffer - if (strcmp(fMatchString, "") != 0) { - fMatchString[strlen(fMatchString) - 1] = '\0'; + if (strcmp(sMatchString, "") != 0) { + sMatchString[strlen(sMatchString) - 1] = '\0'; - fLastKeyTime = system_time(); + sLastKeyTime = system_time(); - fCountView->SetTypeAhead(fMatchString); + fCountView->SetTypeAhead(sMatchString); // select our new string int32 index; BPose *pose = FindBestMatch(&index); if (!pose) { // wrap around - fMatchString[0] = '\0'; + sMatchString[0] = '\0'; pose = FindBestMatch(&index); } SelectPose(pose, index); @@ -5966,21 +5966,21 @@ // add char to existing matchString or start new match string // make sure we don't overfill matchstring - if (eventTime - fLastKeyTime < (doubleClickSpeed * 2)) { - uint32 nchars = B_FILE_NAME_LENGTH - strlen(fMatchString); - strncat(fMatchString, searchChar, nchars); + if (eventTime - sLastKeyTime < (doubleClickSpeed * 2)) { + uint32 nchars = B_FILE_NAME_LENGTH - strlen(sMatchString); + strncat(sMatchString, searchChar, nchars); } else { - strncpy(fMatchString, searchChar, B_FILE_NAME_LENGTH - 1); + strncpy(sMatchString, searchChar, B_FILE_NAME_LENGTH - 1); } - fMatchString[B_FILE_NAME_LENGTH - 1] = '\0'; - fLastKeyTime = eventTime; + sMatchString[B_FILE_NAME_LENGTH - 1] = '\0'; + sLastKeyTime = eventTime; - fCountView->SetTypeAhead(fMatchString); + fCountView->SetTypeAhead(sMatchString); int32 index; BPose *pose = FindBestMatch(&index); if (!pose) { // wrap around - fMatchString[0] = '\0'; + sMatchString[0] = '\0'; pose = FindBestMatch(&index); } SelectPose(pose, index); @@ -6002,14 +6002,14 @@ BPose *pose = fPoseList->ItemAt(index); if (reverse) { - if (strcasecmp(pose->TargetModel()->Name(), fMatchString) < 0) + if (strcasecmp(pose->TargetModel()->Name(), sMatchString) < 0) if (strcasecmp(pose->TargetModel()->Name(), bestSoFar) >= 0 || !bestSoFar[0]) { strcpy(bestSoFar, pose->TargetModel()->Name()); poseToSelect = pose; *matchingIndex = index; } - } else if (strcasecmp(pose->TargetModel()->Name(), fMatchString) > 0) + } else if (strcasecmp(pose->TargetModel()->Name(), sMatchString) > 0) if (strcasecmp(pose->TargetModel()->Name(), bestSoFar) <= 0 || !bestSoFar[0]) { strcpy(bestSoFar, pose->TargetModel()->Name()); @@ -6047,7 +6047,7 @@ text = pose->TargetModel()->Name(); } - if (strcasecmp(text, fMatchString) >= 0) + if (strcasecmp(text, sMatchString) >= 0) if (strcasecmp(text, bestSoFar) <= 0 || !bestSoFar[0]) { strcpy(bestSoFar, text); poseToSelect = pose; @@ -7564,7 +7564,7 @@ ResetOrigin(); ResetPosePlacementHint(); - fLastKeyTime = 0; + sLastKeyTime = 0; } @@ -8217,8 +8217,8 @@ BPoint loc(0, startIndex * fListElemHeight); BRect srcRect = fPoseList->ItemAt(0)->CalcRect(BPoint(0, 0), this, false); srcRect.right += 1024; // need this to erase correctly - fOffscreen->BeginUsing(srcRect); - BView *offscreenView = fOffscreen->View(); + sOffscreen->BeginUsing(srcRect); + BView *offscreenView = sOffscreen->View(); BRegion updateRegion; updateRegion.Set(updateRect); @@ -8240,12 +8240,12 @@ offscreenView->Sync(); SetDrawingMode(B_OP_COPY); - DrawBitmap(fOffscreen->Bitmap(), srcRect, dstRect); + DrawBitmap(sOffscreen->Bitmap(), srcRect, dstRect); loc.y += fListElemHeight; if (loc.y > updateRect.bottom) break; } - fOffscreen->DoneUsing(); + sOffscreen->DoneUsing(); ConstrainClippingRegion(0); } @@ -9327,11 +9327,11 @@ // static member initializations -float BPoseView::fFontHeight = -1; -font_height BPoseView::fFontInfo = { 0, 0, 0 }; -bigtime_t BPoseView::fLastKeyTime = 0; -_BWidthBuffer_* BPoseView::fWidthBuf = new _BWidthBuffer_; -BFont BPoseView::fCurrentFont; -OffscreenBitmap *BPoseView::fOffscreen = new OffscreenBitmap; -char BPoseView::fMatchString[] = ""; +float BPoseView::sFontHeight = -1; +font_height BPoseView::sFontInfo = { 0, 0, 0 }; +bigtime_t BPoseView::sLastKeyTime = 0; +_BWidthBuffer_* BPoseView::sWidthBuffer = new _BWidthBuffer_; +BFont BPoseView::sCurrentFont; +OffscreenBitmap *BPoseView::sOffscreen = new OffscreenBitmap; +char BPoseView::sMatchString[] = ""; Modified: haiku/trunk/src/kits/tracker/PoseView.h =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.h 2007-06-06 01:12:19 UTC (rev 21337) +++ haiku/trunk/src/kits/tracker/PoseView.h 2007-06-06 13:20:50 UTC (rev 21338) @@ -653,17 +653,17 @@ BRect fStartFrame; BRect fSelectionRect; - static float fFontHeight; - static font_height fFontInfo; - static BFont fCurrentFont; - static bigtime_t fLastKeyTime; - static char fMatchString[B_FILE_NAME_LENGTH]; + static float sFontHeight; + static font_height sFontInfo; + static BFont sCurrentFont; + static bigtime_t sLastKeyTime; + static char sMatchString[B_FILE_NAME_LENGTH]; // used for typeahead - should be replaced by a typeahead state // TODO: Get rid of this. - static _BWidthBuffer_ *fWidthBuf; + static _BWidthBuffer_ *sWidthBuffer; - static OffscreenBitmap *fOffscreen; + static OffscreenBitmap *sOffscreen; typedef BView _inherited; }; @@ -778,13 +778,13 @@ inline font_height BPoseView::FontInfo() const { - return fFontInfo; + return sFontInfo; } inline float BPoseView::FontHeight() const { - return fFontHeight; + return sFontHeight; } inline BPose * From bonefish at mail.berlios.de Wed Jun 6 21:24:21 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 6 Jun 2007 21:24:21 +0200 Subject: [Haiku-commits] r21339 - haiku/trunk/src/servers/app/drawing Message-ID: <200706061924.l56JOLXb026402@sheep.berlios.de> Author: bonefish Date: 2007-06-06 21:24:20 +0200 (Wed, 06 Jun 2007) New Revision: 21339 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21339&view=rev Modified: haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp Log: Also include where _kern_get_safemode_option() is declared. Modified: haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp 2007-06-06 13:20:50 UTC (rev 21338) +++ haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp 2007-06-06 19:24:20 UTC (rev 21339) @@ -22,7 +22,8 @@ #include "ServerProtocol.h" #include "SystemPalette.h" -#include "safemode.h" +#include +#include #include #include From bonefish at mail.berlios.de Wed Jun 6 21:29:42 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 6 Jun 2007 21:29:42 +0200 Subject: [Haiku-commits] r21340 - in haiku/trunk: headers/build/private/kernel src/build/libhaikucompat src/tests/servers/app Message-ID: <200706061929.l56JTgb9027520@sheep.berlios.de> Author: bonefish Date: 2007-06-06 21:29:41 +0200 (Wed, 06 Jun 2007) New Revision: 21340 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21340&view=rev Added: haiku/trunk/headers/build/private/kernel/safemode.h Modified: haiku/trunk/src/build/libhaikucompat/syscalls.cpp haiku/trunk/src/tests/servers/app/Jamfile Log: Fixed libbe_test build of app server: * Added headers. * Added a failing _kern_get_safemode_option() to libhaikucompat.a. Copied: haiku/trunk/headers/build/private/kernel/safemode.h (from rev 21338, haiku/trunk/headers/private/kernel/safemode.h) Modified: haiku/trunk/src/build/libhaikucompat/syscalls.cpp =================================================================== --- haiku/trunk/src/build/libhaikucompat/syscalls.cpp 2007-06-06 19:24:20 UTC (rev 21339) +++ haiku/trunk/src/build/libhaikucompat/syscalls.cpp 2007-06-06 19:29:41 UTC (rev 21340) @@ -434,3 +434,11 @@ return B_ERROR; } +// #pragma mark - other syscalls + +status_t +_kern_get_safemode_option(const char *parameter, char *buffer, + size_t *_bufferSize) +{ + return B_ERROR; +} Modified: haiku/trunk/src/tests/servers/app/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/app/Jamfile 2007-06-06 19:24:20 UTC (rev 21339) +++ haiku/trunk/src/tests/servers/app/Jamfile 2007-06-06 19:29:41 UTC (rev 21340) @@ -6,8 +6,13 @@ if $(TARGET_PLATFORM) = libbe_test { UseLibraryHeaders agg png zlib ; -UsePrivateHeaders app graphics input interface kernel shared storage ; +UsePrivateHeaders app graphics input interface shared storage ; +# headers/build/private/kernel is needed for safemode.h and syscalls.h. +# headers/private/kernel for the util/* stuff. +UseHeaders [ FDirName $(HAIKU_TOP) headers build private kernel ] : true ; +UsePrivateHeaders kernel ; + local appServerDir = [ FDirName $(HAIKU_TOP) src servers app ] ; UseHeaders [ FDirName $(appServerDir) drawing ] ; From bonefish at mail.berlios.de Thu Jun 7 03:39:00 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 7 Jun 2007 03:39:00 +0200 Subject: [Haiku-commits] r21341 - haiku/trunk/src/servers/app/drawing Message-ID: <200706070139.l571d0ax005017@sheep.berlios.de> Author: bonefish Date: 2007-06-07 03:38:58 +0200 (Thu, 07 Jun 2007) New Revision: 21341 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21341&view=rev Modified: haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp Log: Fix the build. IMHO it's really ugly to use syscalls without even including . Modified: haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp 2007-06-06 19:29:41 UTC (rev 21340) +++ haiku/trunk/src/servers/app/drawing/AccelerantHWInterface.cpp 2007-06-07 01:38:58 UTC (rev 21341) @@ -23,7 +23,6 @@ #include "SystemPalette.h" #include -#include #include #include @@ -50,7 +49,6 @@ #endif -#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST // This call updates the frame buffer used by the on-screen KDL extern "C" status_t _kern_frame_buffer_update(void *baseAddress, int32 width, int32 height, int32 depth, int32 bytesPerRow); @@ -58,7 +56,6 @@ // This call retrieves the system's safemode options extern "C" status_t _kern_get_safemode_option(const char* parameter, char* buffer, size_t* _size); -#endif const int32 kDefaultParamsCount = 64; From bonefish at mail.berlios.de Thu Jun 7 03:50:51 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 7 Jun 2007 03:50:51 +0200 Subject: [Haiku-commits] r21342 - haiku/trunk/src/servers/app/drawing Message-ID: <200706070150.l571op58005605@sheep.berlios.de> Author: bonefish Date: 2007-06-07 03:50:50 +0200 (Thu, 07 Jun 2007) New Revision: 21342 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21342&view=rev Modified: haiku/trunk/src/servers/app/drawing/Jamfile Log: libasdrawing.a was including a plethora of libraries. Not sure, what ar made of this. Modified: haiku/trunk/src/servers/app/drawing/Jamfile =================================================================== --- haiku/trunk/src/servers/app/drawing/Jamfile 2007-06-07 01:38:58 UTC (rev 21341) +++ haiku/trunk/src/servers/app/drawing/Jamfile 2007-06-07 01:50:50 UTC (rev 21342) @@ -23,12 +23,6 @@ BitmapHWInterface.cpp BBitmapBuffer.cpp HWInterface.cpp - - # libraries - : - libtranslation.so libz.so libpng.so libbe.so - libpainter.a libagg.a libfreetype.so - libtextencoding.so ; SubInclude HAIKU_TOP src servers app drawing Painter ; From bonefish at mail.berlios.de Thu Jun 7 06:11:19 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 7 Jun 2007 06:11:19 +0200 Subject: [Haiku-commits] r21343 - haiku/trunk/src/tests/kits/interface/layout/widget_layout_test Message-ID: <200706070411.l574BJHI013662@sheep.berlios.de> Author: bonefish Date: 2007-06-07 06:11:17 +0200 (Thu, 07 Jun 2007) New Revision: 21343 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21343&view=rev Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/AbstractButton.cpp haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/AbstractButton.h haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/RadioButton.cpp haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/RadioButton.h Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBox.cpp haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBox.h haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile Log: * Pulled generic button code out of CheckBox into a new base class AbstractButton. * Added RadioButton and RadioButtonGroup. * In the BBox test the border style can be switched now. Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/AbstractButton.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/AbstractButton.cpp 2007-06-07 01:50:50 UTC (rev 21342) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/AbstractButton.cpp 2007-06-07 04:11:17 UTC (rev 21343) @@ -0,0 +1,201 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#include "AbstractButton.h" + +#include + + +// #pragma mark - AbstractButton + + +AbstractButton::AbstractButton(button_policy policy, BMessage* message, + BMessenger target) + : View(BRect(0, 0, 0, 0)), + BInvoker(message, target), + fPolicy(policy), + fSelected(false), + fPressed(false), + fPressedInBounds(false) +{ +} + + +void +AbstractButton::SetPolicy(button_policy policy) +{ + fPolicy = policy; +} + + +button_policy +AbstractButton::Policy() const +{ + return fPolicy; +} + + +void +AbstractButton::SetSelected(bool selected) +{ + if (selected != fSelected) { + fSelected = selected; + Invalidate(); + + // check whether to notify the listeners depending on the button policy + bool notify = false; + switch (fPolicy) { + case BUTTON_POLICY_TOGGLE_ON_RELEASE: + case BUTTON_POLICY_SELECT_ON_RELEASE: + // always notify on selection changes + notify = true; + break; + case BUTTON_POLICY_INVOKE_ON_RELEASE: + // only notify when the user interaction has been finished + notify = !fPressed; + break; + } + + if (notify) { + // notify synchronous listeners + _NotifyListeners(); + + // send the message + if (Message()) { + BMessage message(*Message()); + message.AddBool("selected", IsSelected()); + InvokeNotify(&message); + } + } + } +} + + +bool +AbstractButton::IsSelected() const +{ + return fSelected; +} + + +void +AbstractButton::MouseDown(BPoint where, uint32 buttons, int32 modifiers) +{ + if (fPressed) + return; + + fPressed = true; + _PressedUpdate(where); +} + + +void +AbstractButton::MouseUp(BPoint where, uint32 buttons, int32 modifiers) +{ + if (!fPressed || (buttons & B_PRIMARY_MOUSE_BUTTON)) + return; + + _PressedUpdate(where); + fPressed = false; + if (fPressedInBounds) { + fPressedInBounds = false; + + // update selected state according to policy + bool selected = fSelected; + switch (fPolicy) { + case BUTTON_POLICY_TOGGLE_ON_RELEASE: + selected = !fSelected; + break; + case BUTTON_POLICY_SELECT_ON_RELEASE: + selected = true; + break; + case BUTTON_POLICY_INVOKE_ON_RELEASE: + selected = false; + break; + } + + SetSelected(selected); + } + Invalidate(); +} + + +void +AbstractButton::MouseMoved(BPoint where, uint32 buttons, int32 modifiers) +{ + if (!fPressed) + return; + + _PressedUpdate(where); +} + + +void +AbstractButton::AddListener(Listener* listener) +{ + if (listener && !fListeners.HasItem(listener)) + fListeners.AddItem(listener); +} + + +void +AbstractButton::RemoveListener(Listener* listener) +{ + if (listener) + fListeners.RemoveItem(listener); +} + + +bool +AbstractButton::IsPressed() const +{ + return (fPressed && fPressedInBounds); +} + + +void +AbstractButton::_PressedUpdate(BPoint where) +{ + bool pressedInBounds = Bounds().Contains(where); + if (pressedInBounds == fPressedInBounds) + return; + + fPressedInBounds = pressedInBounds; + + // update the selected state according to the button policy + switch (fPolicy) { + case BUTTON_POLICY_TOGGLE_ON_RELEASE: + case BUTTON_POLICY_SELECT_ON_RELEASE: + // nothing to do + break; + case BUTTON_POLICY_INVOKE_ON_RELEASE: + SetSelected(fPressedInBounds); + break; + } + + Invalidate(); +} + + +void +AbstractButton::_NotifyListeners() +{ + if (!fListeners.IsEmpty()) { + BList listeners(fListeners); + for (int32 i = 0; Listener* listener = (Listener*)listeners.ItemAt(i); + i++) { + listener->SelectionChanged(this); + } + } +} + + +// #pragma mark - AbstractButton::Listener + + +AbstractButton::Listener::~Listener() +{ +} + Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/AbstractButton.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/AbstractButton.h 2007-06-07 01:50:50 UTC (rev 21342) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/AbstractButton.h 2007-06-07 04:11:17 UTC (rev 21343) @@ -0,0 +1,74 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef WIDGET_LAYOUT_TEST_ABSTRACT_BUTTON_H +#define WIDGET_LAYOUT_TEST_ABSTRACT_BUTTON_H + + +#include +#include + +#include "View.h" + + +// button behavior policy +enum button_policy { + BUTTON_POLICY_TOGGLE_ON_RELEASE, // check box + BUTTON_POLICY_SELECT_ON_RELEASE, // radio button + BUTTON_POLICY_INVOKE_ON_RELEASE // button +}; + + +// AbstractButton +class AbstractButton : public View, public BInvoker { +public: + AbstractButton(button_policy policy, + BMessage* message = NULL, + BMessenger target = BMessenger()); + + void SetPolicy(button_policy policy); + button_policy Policy() const; + + void SetSelected(bool selected); + bool IsSelected() const; + + virtual void MouseDown(BPoint where, uint32 buttons, + int32 modifiers); + virtual void MouseUp(BPoint where, uint32 buttons, + int32 modifiers); + virtual void MouseMoved(BPoint where, uint32 buttons, + int32 modifiers); + +public: + class Listener; + + void AddListener(Listener* listener); + void RemoveListener(Listener* listener); + +protected: + bool IsPressed() const; + +private: + void _PressedUpdate(BPoint where); + void _NotifyListeners(); + +private: + button_policy fPolicy; + bool fSelected; + bool fPressed; + bool fPressedInBounds; + BList fListeners; +}; + + +// synchronous listener interface +class AbstractButton::Listener { +public: + virtual ~Listener(); + + virtual void SelectionChanged(AbstractButton* button) = 0; +}; + + +#endif // WIDGET_LAYOUT_TEST_ABSTRACT_BUTTON_H Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp 2007-06-07 01:50:50 UTC (rev 21342) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp 2007-06-07 04:11:17 UTC (rev 21343) @@ -10,11 +10,34 @@ #include #include +#include "GroupView.h" +#include "RadioButton.h" + +// messages +enum { + MSG_BORDER_STYLE_CHANGED = 'bstc', +}; + + +// BorderStyleRadioButton +class BoxTest::BorderStyleRadioButton : public LabeledRadioButton { +public: + BorderStyleRadioButton(const char* label, border_style style) + : LabeledRadioButton(label), + fBorderStyle(style) + { + } + + border_style fBorderStyle; +}; + + // constructor BoxTest::BoxTest() : Test("Box", NULL), - fBox(new BBox(BRect(0, 0, 9, 9), "test box", B_FOLLOW_NONE)) + fBox(new BBox(BRect(0, 0, 9, 9), "test box", B_FOLLOW_NONE)), + fBorderStyleRadioGroup(NULL) // TODO: Layout-friendly constructor { SetView(fBox); @@ -24,6 +47,7 @@ // destructor BoxTest::~BoxTest() { + delete fBorderStyleRadioGroup; } @@ -31,26 +55,41 @@ void BoxTest::ActivateTest(View* controls) { -/* GroupView* group = new GroupView(B_VERTICAL); + // BBox sets its background color to that of its parent in + // AttachedToWindow(). Override. + rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR); + fBox->SetViewColor(background); + fBox->SetLowColor(background); + + GroupView* group = new GroupView(B_VERTICAL); group->SetFrame(controls->Bounds()); group->SetSpacing(0, 8); controls->AddChild(group); - // long button text - fLongTextCheckBox = new LabeledCheckBox("Long Button Text", - new BMessage(MSG_CHANGE_BUTTON_TEXT), this); - group->AddChild(fLongTextCheckBox); + // the radio button group for selecting the border style + fBorderStyleRadioGroup = new RadioButtonGroup( + new BMessage(MSG_BORDER_STYLE_CHANGED), this); - // big font - fBigFontCheckBox = new LabeledCheckBox("Big Button Font", - new BMessage(MSG_CHANGE_BUTTON_FONT), this); - group->AddChild(fBigFontCheckBox); + // no border + LabeledRadioButton* button = new BorderStyleRadioButton("no border", + B_NO_BORDER); + group->AddChild(button); + fBorderStyleRadioGroup->AddButton(button->GetRadioButton()); + // plain border + button = new BorderStyleRadioButton("plain border", B_PLAIN_BORDER); + group->AddChild(button); + fBorderStyleRadioGroup->AddButton(button->GetRadioButton()); + + // fancy border + button = new BorderStyleRadioButton("fancy border", B_FANCY_BORDER); + group->AddChild(button); + fBorderStyleRadioGroup->AddButton(button->GetRadioButton()); + + // default to no border + fBorderStyleRadioGroup->SelectButton(0L); + group->AddChild(new Glue()); - - _SetButtonText(false); - _SetButtonFont(false); -*/ } @@ -59,3 +98,37 @@ BoxTest::DectivateTest() { } + + +// MessageReceived +void +BoxTest::MessageReceived(BMessage* message) +{ + switch (message->what) { + case MSG_BORDER_STYLE_CHANGED: + _UpdateBorderStyle(); + break; + default: + Test::MessageReceived(message); + break; + } +} + + +// _UpdateBorderStyle +void +BoxTest::_UpdateBorderStyle() +{ + if (fBorderStyleRadioGroup) { + // We need to get the parent of the actually selected button, since + // that is the labeled radio button we've derived our + // BorderStyleRadioButton from. + AbstractButton* selectedButton + = fBorderStyleRadioGroup->SelectedButton(); + View* parent = (selectedButton ? selectedButton->Parent() : NULL); + BorderStyleRadioButton* button = dynamic_cast( + parent); + if (button) + fBox->SetBorder(button->fBorderStyle); + } +} Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h 2007-06-07 01:50:50 UTC (rev 21342) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h 2007-06-07 04:11:17 UTC (rev 21343) @@ -10,7 +10,7 @@ class BBox; -class View; +class RadioButtonGroup; class BoxTest : public Test { @@ -21,8 +21,16 @@ virtual void ActivateTest(View* controls); virtual void DectivateTest(); + virtual void MessageReceived(BMessage* message); + private: + void _UpdateBorderStyle(); + +private: + class BorderStyleRadioButton; + BBox* fBox; + RadioButtonGroup* fBorderStyleRadioGroup; }; Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBox.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBox.cpp 2007-06-07 01:50:50 UTC (rev 21342) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBox.cpp 2007-06-07 04:11:17 UTC (rev 21343) @@ -14,39 +14,12 @@ CheckBox::CheckBox(BMessage* message, BMessenger target) - : View(BRect(0, 0, 12, 12)), - BInvoker(message, target), - fSelected(false), - fPressed(false) + : AbstractButton(BUTTON_POLICY_TOGGLE_ON_RELEASE, message, target) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); } -void -CheckBox::SetSelected(bool selected) -{ - if (selected != fSelected) { - fSelected = selected; - Invalidate(); - - // send the message - if (Message()) { - BMessage message(*Message()); - message.AddBool("selected", IsSelected()); - InvokeNotify(&message); - } - } -} - - -bool -CheckBox::IsSelected() const -{ - return fSelected; -} - - BSize CheckBox::MinSize() { @@ -66,14 +39,14 @@ { BRect rect(Bounds()); - if (fPressed) + if (IsPressed()) container->SetHighColor((rgb_color){ 120, 0, 0, 255 }); else container->SetHighColor((rgb_color){ 0, 0, 0, 255 }); container->StrokeRect(rect); - if (fPressed ? fPressedSelected : fSelected) { + if (IsSelected()) { rect.InsetBy(2, 2); container->StrokeLine(rect.LeftTop(), rect.RightBottom()); container->StrokeLine(rect.RightTop(), rect.LeftBottom()); @@ -81,52 +54,6 @@ } -void -CheckBox::MouseDown(BPoint where, uint32 buttons, int32 modifiers) -{ - if (fPressed) - return; - - fPressed = true; - fPressedSelected = fSelected; - _PressedUpdate(where); -} - - -void -CheckBox::MouseUp(BPoint where, uint32 buttons, int32 modifiers) -{ - if (!fPressed || (buttons & B_PRIMARY_MOUSE_BUTTON)) - return; - - _PressedUpdate(where); - fPressed = false; - SetSelected(fPressedSelected); - Invalidate(); -} - - -void -CheckBox::MouseMoved(BPoint where, uint32 buttons, int32 modifiers) -{ - if (!fPressed) - return; - - _PressedUpdate(where); -} - - -void -CheckBox::_PressedUpdate(BPoint where) -{ - bool pressedSelected = Bounds().Contains(where) ^ fSelected; - if (pressedSelected != fPressedSelected) { - fPressedSelected = pressedSelected; - Invalidate(); - } -} - - // #pragma mark - LabeledCheckBox Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBox.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBox.h 2007-06-07 01:50:50 UTC (rev 21342) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBox.h 2007-06-07 04:11:17 UTC (rev 21343) @@ -8,37 +8,20 @@ #include +#include "AbstractButton.h" #include "GroupView.h" // CheckBox -class CheckBox : public View, public BInvoker { +class CheckBox : public AbstractButton { public: CheckBox(BMessage* message = NULL, BMessenger target = BMessenger()); - void SetSelected(bool selected); - bool IsSelected() const; - virtual BSize MinSize(); virtual BSize MaxSize(); virtual void Draw(BView* container, BRect updateRect); - - virtual void MouseDown(BPoint where, uint32 buttons, - int32 modifiers); - virtual void MouseUp(BPoint where, uint32 buttons, - int32 modifiers); - virtual void MouseMoved(BPoint where, uint32 buttons, - int32 modifiers); - -private: - void _PressedUpdate(BPoint where); - -private: - bool fSelected; - bool fPressed; - bool fPressedSelected; }; Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile 2007-06-07 01:50:50 UTC (rev 21342) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile 2007-06-07 04:11:17 UTC (rev 21343) @@ -5,10 +5,12 @@ SimpleTest WidgetLayoutTest : WidgetLayoutTest.cpp + AbstractButton.cpp BoxTest.cpp ButtonTest.cpp CheckBox.cpp GroupView.cpp + RadioButton.cpp StringView.cpp Test.cpp TwoDimensionalSliderView.cpp Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/RadioButton.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/RadioButton.cpp 2007-06-07 01:50:50 UTC (rev 21342) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/RadioButton.cpp 2007-06-07 04:11:17 UTC (rev 21343) @@ -0,0 +1,246 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#include "RadioButton.h" + +#include + +#include "StringView.h" + + +// #pragma mark - RadioButton + + +RadioButton::RadioButton(BMessage* message, BMessenger target) + : AbstractButton(BUTTON_POLICY_SELECT_ON_RELEASE, message, target) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); +} + + +BSize +RadioButton::MinSize() +{ + return BSize(12, 12); +} + + +BSize +RadioButton::MaxSize() +{ + return MinSize(); +} + + +void +RadioButton::Draw(BView* container, BRect updateRect) +{ + BRect rect(Bounds()); + + if (IsPressed()) + container->SetHighColor((rgb_color){ 120, 0, 0, 255 }); + else + container->SetHighColor((rgb_color){ 0, 0, 0, 255 }); + + container->StrokeRect(rect); + + if (IsSelected()) { + rect.InsetBy(4, 4); + container->FillRect(rect); + } +} + + +// #pragma mark - LabeledRadioButton + + +LabeledRadioButton::LabeledRadioButton(const char* label, BMessage* message, + BMessenger target) + : GroupView(B_HORIZONTAL), + fRadioButton(new RadioButton(message, target)) +{ + SetSpacing(8, 0); + + AddChild(fRadioButton); + if (label) + AddChild(new StringView(label)); +} + + +void +LabeledRadioButton::SetTarget(BMessenger messenger) +{ + fRadioButton->SetTarget(messenger); +} + + +void +LabeledRadioButton::SetSelected(bool selected) +{ + fRadioButton->SetSelected(selected); +} + + +bool +LabeledRadioButton::IsSelected() const +{ + return fRadioButton->IsSelected(); +} + + +// #pragma mark - RadioButtonGroup + + +RadioButtonGroup::RadioButtonGroup(BMessage* message, BMessenger target) + : BInvoker(message, target), + fButtons(10), + fSelected(NULL) +{ +} + + +RadioButtonGroup::~RadioButtonGroup() +{ + // remove as listener from buttons + for (int32 i = 0; AbstractButton* button = ButtonAt(i); i++) + button->RemoveListener(this); +} + + +void +RadioButtonGroup::AddButton(AbstractButton* button) +{ + if (!button || fButtons.HasItem(button)) + return; + + // force radio button policy + button->SetPolicy(BUTTON_POLICY_SELECT_ON_RELEASE); + + // deselect the button, if we do already have a selected one + if (fSelected) + button->SetSelected(false); + + // add ourselves as listener + button->AddListener(this); + + // add the button to our list + fButtons.AddItem(button); +} + + +bool +RadioButtonGroup::RemoveButton(AbstractButton* button) +{ + return RemoveButton(IndexOfButton(button)); +} + + +AbstractButton* +RadioButtonGroup::RemoveButton(int32 index) +{ + // remove the button from our list + AbstractButton* button = (AbstractButton*)fButtons.RemoveItem(index); + if (!button) + return NULL; + + // remove ourselves as listener + button->RemoveListener(this); + + // if it was the selected one, we don't have a selection anymore + if (button == fSelected) { + fSelected = NULL; + _SelectionChanged(); + } + + return button; +} + + +int32 +RadioButtonGroup::CountButtons() const +{ + return fButtons.CountItems(); +} + + +AbstractButton* +RadioButtonGroup::ButtonAt(int32 index) const +{ + return (AbstractButton*)fButtons.ItemAt(index); +} + + +int32 +RadioButtonGroup::IndexOfButton(AbstractButton* button) const +{ + return fButtons.IndexOf(button); +} + + +void +RadioButtonGroup::SelectButton(AbstractButton* button) +{ + if (button && fButtons.HasItem(button)) + button->SetSelected(true); +} + + +void +RadioButtonGroup::SelectButton(int32 index) +{ + if (AbstractButton* button = ButtonAt(index)) + button->SetSelected(true); +} + + +AbstractButton* +RadioButtonGroup::SelectedButton() const +{ + return fSelected; +} + + +int32 +RadioButtonGroup::SelectedIndex() const +{ + return (fSelected ? IndexOfButton(fSelected) : -1); +} + + +void +RadioButtonGroup::SelectionChanged(AbstractButton* button) +{ + // We're only interested in a notification when one of our buttons that + // has not been selected one before has become selected. + if (!button || !fButtons.HasItem(button) || !button->IsSelected() + || button == fSelected) { + return; + } + + // set the new selection + AbstractButton* oldSelected = fSelected; + fSelected = button; + + // deselect the old selected button + if (oldSelected) + oldSelected->SetSelected(false); + + // send out notifications + _SelectionChanged(); +} + + +void +RadioButtonGroup::_SelectionChanged() +{ + // send the message + if (Message()) { + BMessage message(*Message()); + message.AddPointer("button group", this); + message.AddPointer("selected button", fSelected); + message.AddInt32("selected index", SelectedIndex()); + InvokeNotify(&message); + } +} Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/RadioButton.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/RadioButton.h 2007-06-07 01:50:50 UTC (rev 21342) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/RadioButton.h 2007-06-07 04:11:17 UTC (rev 21343) @@ -0,0 +1,79 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef WIDGET_LAYOUT_TEST_CHECK_BOX_H +#define WIDGET_LAYOUT_TEST_CHECK_BOX_H + + +#include +#include + +#include "AbstractButton.h" +#include "GroupView.h" + + +// RadioButton +class RadioButton : public AbstractButton { +public: + RadioButton(BMessage* message = NULL, + BMessenger target = BMessenger()); + + virtual BSize MinSize(); + virtual BSize MaxSize(); + + virtual void Draw(BView* container, BRect updateRect); +}; + + +// LabeledRadioButton +class LabeledRadioButton : public GroupView { +public: + LabeledRadioButton(const char* label, + BMessage* message = NULL, + BMessenger target = BMessenger()); + + RadioButton* GetRadioButton() const { return fRadioButton; } + + void SetTarget(BMessenger messenger); + + void SetSelected(bool selected); + bool IsSelected() const; + +private: + RadioButton* fRadioButton; +}; + + +// RadioButtonGroup +class RadioButtonGroup : public BInvoker, private AbstractButton::Listener { +public: + RadioButtonGroup(BMessage* message = NULL, + BMessenger target = BMessenger()); + virtual ~RadioButtonGroup(); + + void AddButton(AbstractButton* button); + bool RemoveButton(AbstractButton* button); + AbstractButton* RemoveButton(int32 index); + + int32 CountButtons() const; + AbstractButton* ButtonAt(int32 index) const; + int32 IndexOfButton(AbstractButton* button) const; + + void SelectButton(AbstractButton* button); + void SelectButton(int32 index); + AbstractButton* SelectedButton() const; + int32 SelectedIndex() const; + +private: + virtual void SelectionChanged(AbstractButton* button); + + void _SelectionChanged(); + +private: + BList fButtons; + AbstractButton* fSelected; +}; + + +#endif // WIDGET_LAYOUT_TEST_CHECK_BOX_H From revol at free.fr Thu Jun 7 10:28:16 2007 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 07 Jun 2007 10:28:16 +0200 CEST Subject: [Haiku-commits] r21325 - haiku/trunk/build/jam In-Reply-To: <20070605175047.13921.17@stippis.WG> Message-ID: <2346642984-BeMail@laptop> > And while I am at it, I might point out that we are currently > discussing a > cleanup in the Leaf menu. :-) I once tried to replace the Application menu in Zeta with queries on an indexed string attribute named APP:group, like: '(APP:group=="*[Dd]evelopment*")' '(APP:group=="*[Ee]mulator*")' Someone wanting to keep a single Applications menu could use something like: '(APP:group!="*[De]mo*"&&APP:group!="*[Pp]reference*")' This would suppress the need to add the symlinks in the app installer, which usually always end up at the wrong place. Of course it's not as flexible for those who want only specific things in the menu, but one could always have his own symlinks alongside in another folder. Also needs to be limited to the boot volume somehow, don't want to end up with 10 times Terminal in it... But the query files use a flattened BMessage with the volume sig for now for target volume, which isn't known at build time. Fran?ois. From superstippi at gmx.de Thu Jun 7 11:39:37 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Thu, 07 Jun 2007 11:39:37 +0200 Subject: [Haiku-commits] r21325 - haiku/trunk/build/jam In-Reply-To: <2346642984-BeMail@laptop> References: <2346642984-BeMail@laptop> Message-ID: <20070607113937.681.8@stippis.WG> Fran?ois Revol wrote (2007-06-07, 10:28:16 [+0200]): > > And while I am at it, I might point out that we are currently > > discussing a cleanup in the Leaf menu. :-) > > I once tried to replace the Application menu in Zeta with queries on an > indexed string attribute named APP:group, like: > '(APP:group=="*[Dd]evelopment*")' > '(APP:group=="*[Ee]mulator*")' > > Someone wanting to keep a single Applications menu could use something > like: > '(APP:group!="*[De]mo*"&&APP:group!="*[Pp]reference*")' > > This would suppress the need to add the symlinks in the app installer, > which usually always end up at the wrong place. > > Of course it's not as flexible for those who want only specific things > in the menu, but one could always have his own symlinks alongside in > another folder. > > Also needs to be limited to the boot volume somehow, don't want to end > up with 10 times Terminal in it... But the query files use a flattened > BMessage with the volume sig for now for target volume, which isn't > known at build time. Yes, we also thought about queries, but not as concrete as your input. But after discussing this a bit, we decided to keep it simple, because we don't have enough apps at the moment to justify fine grained categories. This is of course open for change at a later point, it depends also on what we want to include in R1 and how much we want to dictate a layout. But for now, we want to have the frequently used apps in one folder, without apps among them that you would only start at system boot (if at all). We also removed apps, which you only start by double clicking documents (ShowImage, Expander), so these are now hidden from the Leaf menu. Additionally to that, we want to include a simple application launcher, so that apps are made more readily available for drag&drop. I will commit these changes soon, we have just a few last questions to solve. Best regards, -Stephan From axeld at pinc-software.de Thu Jun 7 12:37:52 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 07 Jun 2007 12:37:52 +0200 CEST Subject: [Haiku-commits] r21341 - haiku/trunk/src/servers/app/drawing In-Reply-To: <200706070139.l571d0ax005017@sheep.berlios.de> Message-ID: <919756244-BeMail@zon> bonefish at BerliOS wrote: > Log: > Fix the build. IMHO it's really ugly to use syscalls without even > including > . True enough, feel free to change it ;-) Bye, Axel. From mmu_man at mail.berlios.de Thu Jun 7 14:46:21 2007 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 7 Jun 2007 14:46:21 +0200 Subject: [Haiku-commits] r21344 - haiku/trunk/src/system/kernel/fs Message-ID: <200706071246.l57CkLD6016023@sheep.berlios.de> Author: mmu_man Date: 2007-06-07 14:46:20 +0200 (Thu, 07 Jun 2007) New Revision: 21344 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21344&view=rev Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp Log: handle api_version exported from driver. Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/devfs.cpp 2007-06-07 04:11:17 UTC (rev 21343) +++ haiku/trunk/src/system/kernel/fs/devfs.cpp 2007-06-07 12:46:20 UTC (rev 21344) @@ -134,7 +134,7 @@ static void get_device_name(struct devfs_vnode *vnode, char *buffer, size_t size); static status_t publish_device(struct devfs *fs, const char *path, device_node_info *deviceNode, pnp_devfs_driver_info *info, - driver_entry *driver, device_hooks *ops); + driver_entry *driver, device_hooks *ops, int32 apiVersion); /* the one and only allowed devfs instance */ @@ -193,8 +193,27 @@ // For a valid device driver the following exports are required - uint32 *api_version; - if (get_image_symbol(image, "api_version", B_SYMBOL_TYPE_DATA, (void **)&api_version) != B_OK) + int32 defaultApiVersion = 1; + int32 *apiVersion = &defaultApiVersion; + if (get_image_symbol(image, "api_version", B_SYMBOL_TYPE_DATA, (void **)&apiVersion) == B_OK) { + // According to Be newsletter, vol II, issue 36, + // version 2 added readv/writev, which we don't support, but also select/deselect. + // So we must make sure not to use invalid pointers in publish_device. +#if B_CUR_DRIVER_API_VERSION != 2 + // just in case someone decides to bump up the api version +#error Add checks here for new vs old api version! +#endif + if (*apiVersion > B_CUR_DRIVER_API_VERSION) { + dprintf("%s: api_version %ld not handled\n", name, *apiVersion); + status = B_BAD_VALUE; + goto error1; + } + if (*apiVersion < 1) { + dprintf("%s: api_version invalid\n", name); + status = B_BAD_VALUE; + goto error1; + } + } else dprintf("%s: api_version missing\n", name); device_hooks *(*find_device)(const char *); @@ -243,7 +262,7 @@ if (hooks != NULL && publish_device(sDeviceFileSystem, devicePaths[0], - NULL, NULL, driver, hooks) == B_OK) + NULL, NULL, driver, hooks, *apiVersion) == B_OK) exported++; } @@ -594,7 +613,7 @@ static pnp_devfs_driver_info * -create_new_driver_info(device_hooks *ops) +create_new_driver_info(device_hooks *ops, int32 version) { pnp_devfs_driver_info *info = (pnp_devfs_driver_info *)malloc(sizeof(pnp_devfs_driver_info)); if (info == NULL) @@ -607,14 +626,24 @@ info->close = ops->close; info->free = ops->free; info->control = ops->control; - info->select = ops->select; - info->deselect = ops->deselect; info->read = ops->read; info->write = ops->write; + // depends on api_version + info->select = NULL; + info->deselect = NULL; info->read_pages = NULL; info->write_pages = NULL; - // old devices can't know to do physical page access + // old devices can't know how to do physical page access + + if (version >= 2) { + info->select = ops->select; + info->deselect = ops->deselect; + + // ops->readv; + // ops->writev; + // we don't implement scatter-gather atm, so ignore those. + } return info; } @@ -817,10 +846,10 @@ static status_t publish_device(struct devfs *fs, const char *path, device_node_info *deviceNode, - pnp_devfs_driver_info *info, driver_entry *driver, device_hooks *ops) + pnp_devfs_driver_info *info, driver_entry *driver, device_hooks *ops, int32 apiVersion) { - TRACE(("publish_device(path = \"%s\", node = %p, info = %p, hooks = %p)\n", - path, deviceNode, info, ops)); + TRACE(("publish_device(path = \"%s\", node = %p, info = %p, hooks = %p, apiVersion = %d)\n", + path, deviceNode, info, ops, apiVersion)); if (sDeviceFileSystem == NULL) { panic("publish_device() called before devfs mounted\n"); @@ -858,7 +887,7 @@ if (deviceNode != NULL) node->stream.u.dev.info = info; else - node->stream.u.dev.info = create_new_driver_info(ops); + node->stream.u.dev.info = create_new_driver_info(ops, apiVersion); node->stream.u.dev.node = deviceNode; node->stream.u.dev.driver = driver; @@ -2016,7 +2045,7 @@ goto err2; //add_device(device); - status = publish_device(sDeviceFileSystem, filename, node, info, NULL, NULL); + status = publish_device(sDeviceFileSystem, filename, node, info, NULL, NULL, 0); if (status != B_OK) goto err3; //nudge(); @@ -2267,7 +2296,8 @@ extern "C" status_t devfs_publish_device(const char *path, void *obsolete, device_hooks *ops) { - return publish_device(sDeviceFileSystem, path, NULL, NULL, NULL, ops); + // post R5: assume version 2 + return publish_device(sDeviceFileSystem, path, NULL, NULL, NULL, ops, 2); } From marcusoverhagen at mail.berlios.de Thu Jun 7 22:15:34 2007 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Thu, 7 Jun 2007 22:15:34 +0200 Subject: [Haiku-commits] r21345 - haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML Message-ID: <200706072015.l57KFYLN011212@sheep.berlios.de> Author: marcusoverhagen Date: 2007-06-07 22:15:34 +0200 (Thu, 07 Jun 2007) New Revision: 21345 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21345&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h Log: code cleanup: replaced bool results with status_t Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp 2007-06-07 12:46:20 UTC (rev 21344) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp 2007-06-07 20:15:34 UTC (rev 21345) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Marcus Overhagen + * Copyright (c) 2004-2007, Marcus Overhagen * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -90,11 +90,11 @@ status_t OpenDMLFile::SetTo(BPositionIO *source) { + fSource = source; delete fParser; - fSource = source; - fParser = new OpenDMLParser; + fParser = new OpenDMLParser(fSource); - if (!fParser->Parse(source)) { + if (fParser->Parse() < B_OK) { ERROR("OpenDMLFile::SetTo: warning, file parsing failed\n"); } @@ -322,8 +322,8 @@ data->index_chunk_entry_pos++; - printf("OpenDMLFile::GetNextChunkInfo: stream %d: start %15Ld, size %6ld%s\n", - stream_index, *start, *size, *keyframe ? ", keyframe" : ""); +// TRACE("OpenDMLFile::OdmlGetNextChunkInfo: stream %d: start %15Ld, size %6ld%s\n", +// stream_index, *start, *size, *keyframe ? ", keyframe" : ""); return true; } @@ -340,8 +340,8 @@ data->index_chunk_entry_pos = 0; uint32 start = data->index_entry_start + data->index_entry_pos * data->index_entry_size; int size = data->index_chunk_entry_count * data->index_entry_size; - TRACE("OpenDMLFile::AviGetNextChunkInfo: stream %d, index_chunk_entry_count %d, size %d, start %lu\n", - stream_index, data->index_chunk_entry_count, size, start); +// TRACE("OpenDMLFile::AviGetNextChunkInfo: stream %d, index_chunk_entry_count %d, size %d, start %lu\n", +// stream_index, data->index_chunk_entry_count, size, start); if (size != fSource->ReadAt(start, data->index_chunk, size)) { ERROR("OpenDMLFile::AviGetNextChunkInfo: read error\n"); return false; @@ -362,8 +362,8 @@ if (real_stream_index == stream_index) { - TRACE("OpenDMLFile::AviGetNextChunkInfo: stream %d, chunk_id "FOURCC_FORMAT" (0x%08x), flags 0x%08x, offset %lu, length %lu\n", - stream_index, FOURCC_PARAM(entry->chunk_id), entry->chunk_id, entry->flags, entry->chunk_offset, entry->chunk_length); +// TRACE("OpenDMLFile::AviGetNextChunkInfo: stream %d, chunk_id "FOURCC_FORMAT" (0x%08x), flags 0x%08x, offset %lu, length %lu\n", +// stream_index, FOURCC_PARAM(entry->chunk_id), entry->chunk_id, entry->flags, entry->chunk_offset, entry->chunk_length); *keyframe = entry->flags & AVIIF_KEYFRAME; *start = data->index_base_offset + entry->chunk_offset + 8; // skip 8 bytes (chunk id + chunk size) Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h 2007-06-07 12:46:20 UTC (rev 21344) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h 2007-06-07 20:15:34 UTC (rev 21345) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Marcus Overhagen + * Copyright (c) 2004-2007, Marcus Overhagen * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp 2007-06-07 12:46:20 UTC (rev 21344) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp 2007-06-07 20:15:34 UTC (rev 21345) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Marcus Overhagen + * Copyright (c) 2004-2007, Marcus Overhagen * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -48,9 +48,9 @@ uint32 size; }; -OpenDMLParser::OpenDMLParser() - : fSource(0), - fSize(0), +OpenDMLParser::OpenDMLParser(BPositionIO *source) + : fSource(source), + fSize(source->Seek(0, SEEK_END)), fMovieListStart(0), fStandardIndexStart(0), fStandardIndexSize(0), @@ -78,7 +78,7 @@ OpenDMLParser::StreamInfo(int index) { if (index < 0 || index >= fStreamCount) - return 0; + return NULL; stream_info *info = fStreams; while (index--) @@ -141,19 +141,18 @@ fCurrentStream = info; } -// this function returns false to indicate that an error occured, -// but the object is correctly initialized anyway. -bool -OpenDMLParser::Parse(BPositionIO *source) +status_t +OpenDMLParser::Parse() { TRACE("OpenDMLParser::Parse\n"); - - fSource = source; - fSize = source->Seek(0, SEEK_END); - + + if (!fSource) { + ERROR("OpenDMLParser::Parse: no source\n"); + return B_ERROR; + } if (fSize < 32) { ERROR("OpenDMLParser::Parse: file to small\n"); - return false; + return B_ERROR; } uint64 pos = 0; @@ -168,12 +167,12 @@ if (maxsize < 13) { ERROR("OpenDMLParser::Parse: remaining size too small for RIFF AVI chunk data at pos %lld\n", pos); - return false; + return B_ERROR; } if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) { ERROR("OpenDMLParser::Parse: read error at pos %llu\n", pos); - return false; + return B_ERROR; } pos += 4; maxsize -= 4; @@ -181,7 +180,7 @@ if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) { ERROR("OpenDMLParser::Parse: read error at pos %llu\n", pos); - return false; + return B_ERROR; } pos += 4; maxsize -= 4; @@ -191,7 +190,7 @@ if (size == 0) { ERROR("OpenDMLParser::Parse: Error: chunk of size 0 found\n"); - return false; + return B_ERROR; } if (size > maxsize) { @@ -208,7 +207,7 @@ if (fourcc != FOURCC('R','I','F','F')) { if (riff_chunk_number == 0) { ERROR("OpenDMLParser::Parse: not a RIFF file\n"); - return false; + return B_ERROR; } else { TRACE("OpenDMLParser::Parse: unknown chunk '"FOURCC_FORMAT"' (expected 'RIFF'), size = %lu ignored\n", FOURCC_PARAM(fourcc), size); goto cont; @@ -220,31 +219,32 @@ if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) { ERROR("OpenDMLParser::Parse: read error at pos %llu\n", pos); - return false; + return B_ERROR; } fourcc = AVI_UINT32(temp); if (riff_chunk_number == 0 && fourcc != FOURCC('A','V','I',' ')) { ERROR("OpenDMLParser::Parse: not a AVI file\n"); - return false; + return B_ERROR; } if (fourcc != FOURCC('A','V','I',' ') && fourcc != FOURCC('A','V','I','X')) { - TRACE("OpenDMLParser::Parse: unknown RIFF subchunk '"FOURCC_FORMAT"' , size = %lu ignored, filepos %Ld, filesize %Ld\n", FOURCC_PARAM(fourcc), size, pos - 8, fSize); + TRACE("OpenDMLParser::Parse: unknown RIFF subchunk '"FOURCC_FORMAT"' , size = %lu ignored, filepos %Ld, filesize %Ld\n", + FOURCC_PARAM(fourcc), size, pos - 8, fSize); goto cont; } - if (!ParseChunk_AVI(riff_chunk_number, pos + 4, size - 4)) - return false; + if (ParseChunk_AVI(riff_chunk_number, pos + 4, size - 4) < B_OK) + return B_ERROR; cont: pos += (size) + (size & 1); riff_chunk_number++; } - return true; + return B_OK; } -bool +status_t OpenDMLParser::ParseChunk_AVI(int number, uint64 start, uint32 size) { TRACE("OpenDMLParser::ParseChunk_AVI\n"); @@ -253,7 +253,7 @@ if (size < 9) { ERROR("OpenDMLParser::ParseChunk_AVI: chunk is to small at pos %llu\n", start); - return false; + return B_ERROR; } while (pos < end) { @@ -263,14 +263,14 @@ if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) { ERROR("OpenDMLParser::ParseChunk_AVI: read error at pos %llu\n",pos); - return false; + return B_ERROR; } pos += 4; Chunkfcc = AVI_UINT32(temp); if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) { ERROR("OpenDMLParser::ParseChunk_AVI: read error at pos %llu\n",pos); - return false; + return B_ERROR; } pos += 4; Chunksize = AVI_UINT32(temp); @@ -281,7 +281,7 @@ if (Chunksize == 0) { ERROR("OpenDMLParser::ParseChunk_AVI: chunk '"FOURCC_FORMAT"' has size 0\n", FOURCC_PARAM(Chunkfcc)); - return false; + return B_ERROR; } if (Chunksize > maxsize) { @@ -290,11 +290,11 @@ } if (Chunkfcc == FOURCC('L','I','S','T')) { - if (!ParseChunk_LIST(pos, Chunksize)) - return false; + if (ParseChunk_LIST(pos, Chunksize) < B_OK) + return B_ERROR; } else if (Chunkfcc == FOURCC('i','d','x','1')) { - if (!ParseChunk_idx1(pos, Chunksize)) - return false; + if (ParseChunk_idx1(pos, Chunksize) < B_OK) + return B_ERROR; } else if (Chunkfcc == FOURCC('J','U','N','K')) { ; // do nothing } else { @@ -304,10 +304,10 @@ pos += (Chunksize) + (Chunksize & 1); } - return true; + return B_OK; } -bool +status_t OpenDMLParser::ParseChunk_LIST(uint64 start, uint32 size) { TRACE("OpenDMLParser::ParseChunk_LIST\n"); @@ -316,63 +316,58 @@ if (size < 5) { ERROR("OpenDMLParser::ParseChunk_LIST: chunk is to small at pos %llu\n", start); - return false; + return B_ERROR; } if (sizeof(temp) != fSource->ReadAt(start, &temp, sizeof(temp))) { ERROR("OpenDMLParser::ParseChunk_LIST: read error at pos %llu\n", start); - return false; + return B_ERROR; } fourcc = AVI_UINT32(temp); TRACE("OpenDMLParser::ParseChunk_LIST: type '"FOURCC_FORMAT"'\n", FOURCC_PARAM(fourcc)); if (fourcc == FOURCC('m','o','v','i')) { - if (!ParseList_movi(start + 4, size - 4)) - return false; + return ParseList_movi(start + 4, size - 4); } else if (fourcc == FOURCC('r','e','c',' ')) { - if (!ParseList_movi(start + 4, size - 4)) //XXX parse rec simliar to movi??? - return false; + // XXX parse rec simliar to movi? + return ParseList_movi(start + 4, size - 4); } else if (fourcc == FOURCC('h','d','r','l')) { - if (!ParseList_generic(start + 4, size - 4)) - return false; + return ParseList_generic(start + 4, size - 4); } else if (fourcc == FOURCC('s','t','r','l')) { - if (!ParseList_strl(start + 4, size - 4)) - return false; + return ParseList_strl(start + 4, size - 4); } else if (fourcc == FOURCC('o','d','m','l')) { - if (!ParseList_generic(start + 4, size - 4)) - return false; + return ParseList_generic(start + 4, size - 4); } else { TRACE("OpenDMLParser::ParseChunk_LIST: unknown list type ignored\n"); + return B_OK; } - - return true; } -bool +status_t OpenDMLParser::ParseChunk_idx1(uint64 start, uint32 size) { TRACE("OpenDMLParser::ParseChunk_idx1\n"); if (fStandardIndexSize != 0) { TRACE("OpenDMLParser::ParseChunk_idx1: found a second chunk\n"); - return true; // just ignore, no error + return B_OK; // just ignore, no error } fStandardIndexStart = start; fStandardIndexSize = size; - return true; + return B_OK; } -bool +status_t OpenDMLParser::ParseChunk_avih(uint64 start, uint32 size) { TRACE("OpenDMLParser::ParseChunk_avih\n"); if (fAviMainHeaderValid) { TRACE("OpenDMLParser::ParseChunk_avih: found a second chunk\n"); - return true; // just ignore, no error + return B_OK; // just ignore, no error } if (size < sizeof(fAviMainHeader)) { @@ -383,7 +378,7 @@ size = min_c(size, sizeof(fAviMainHeader)); if ((ssize_t)size != fSource->ReadAt(start, &fAviMainHeader, size)) { ERROR("OpenDMLParser::ParseChunk_avih: read error at pos %llu\n", start); - return false; + return B_ERROR; } #if B_HOST_IS_BENDIAN @@ -413,22 +408,22 @@ TRACE("width = %lu\n", fAviMainHeader.width); TRACE("height = %lu\n", fAviMainHeader.height); - return true; + return B_OK; } -bool +status_t OpenDMLParser::ParseChunk_strh(uint64 start, uint32 size) { TRACE("OpenDMLParser::ParseChunk_strh\n"); if (fCurrentStream == 0) { ERROR("OpenDMLParser::ParseChunk_strh: error, no Stream info\n"); - return false; + return B_ERROR; } if (fCurrentStream->stream_header_valid) { TRACE("OpenDMLParser::ParseChunk_strh: error, already have stream header\n"); - return true; // just ignore, no error + return B_OK; // just ignore, no error } if (size < sizeof(fCurrentStream->stream_header)) { @@ -440,7 +435,7 @@ size = min_c(size, sizeof(fCurrentStream->stream_header)); if ((ssize_t)size != fSource->ReadAt(start, &fCurrentStream->stream_header, size)) { ERROR("OpenDMLParser::ParseChunk_strh: read error at pos %llu\n", start); - return false; + return B_ERROR; } #if B_HOST_IS_BENDIAN @@ -487,24 +482,24 @@ TRACE("rect_right = %d\n", fCurrentStream->stream_header.rect_right ); TRACE("rect_bottom = %d\n", fCurrentStream->stream_header.rect_bottom); - return true; + return B_OK; } -bool +status_t OpenDMLParser::ParseChunk_strf(uint64 start, uint32 size) { TRACE("OpenDMLParser::ParseChunk_strf, size %lu\n", size); if (fCurrentStream == 0) { ERROR("OpenDMLParser::ParseChunk_strf: error, no Stream info\n"); - return false; + return B_ERROR; } if (fCurrentStream->is_audio) { if (fCurrentStream->audio_format) { TRACE("OpenDMLParser::ParseChunk_strf: error, already have audio format header\n"); - return true; // just ignore, no error + return B_OK; // just ignore, no error } // if (size < sizeof(fCurrentStream->audio_format)) { @@ -522,7 +517,7 @@ delete [] fCurrentStream->audio_format; fCurrentStream->audio_format_size = 0; fCurrentStream->audio_format = 0; - return false; + return B_ERROR; } #if B_HOST_IS_BENDIAN @@ -550,7 +545,7 @@ if (fCurrentStream->video_format_valid) { TRACE("OpenDMLParser::ParseChunk_strf: error, already have video format header\n"); - return true; // just ignore, no error + return B_OK; // just ignore, no error } // if (size < sizeof(fCurrentStream->video_format)) { @@ -562,7 +557,7 @@ size = min_c(size, sizeof(fCurrentStream->video_format)); if ((ssize_t)size != fSource->ReadAt(start, &fCurrentStream->video_format, size)) { ERROR("OpenDMLParser::ParseChunk_strf: read error at pos %llu\n", start); - return false; + return B_ERROR; } #if B_HOST_IS_BENDIAN @@ -598,33 +593,33 @@ ERROR("OpenDMLParser::ParseChunk_strf: error, unknown Stream type\n"); } - return true; + return B_OK; } -bool +status_t OpenDMLParser::ParseChunk_indx(uint64 start, uint32 size) { TRACE("OpenDMLParser::ParseChunk_indx\n"); if (fCurrentStream == 0) { ERROR("OpenDMLParser::ParseChunk_indx: error, no stream info\n"); - return false; + return B_ERROR; } // XXX fCurrentStream->odml_index_start = start; fCurrentStream->odml_index_size = size; - return true; + return B_OK; } -bool +status_t OpenDMLParser::ParseChunk_dmlh(uint64 start, uint32 size) { TRACE("OpenDMLParser::ParseChunk_dmlh\n"); if (fOdmlExtendedHeaderValid) { TRACE("OpenDMLParser::ParseChunk_dmlh: found a second chunk\n"); - return true; // just ignore it, no error + return B_OK; // just ignore it, no error } if (size < sizeof(fOdmlExtendedHeader)) { @@ -635,7 +630,7 @@ size = min_c(size, sizeof(fOdmlExtendedHeader)); if ((ssize_t)size != fSource->ReadAt(start, &fOdmlExtendedHeader, size)) { ERROR("OpenDMLParser::ParseChunk_dmlh: read error at pos %llu\n", start); - return false; + return B_ERROR; } #if B_HOST_IS_BENDIAN @@ -647,10 +642,10 @@ TRACE("fOdmlExtendedHeader:\n"); TRACE("total_frames = %lu\n", fOdmlExtendedHeader.total_frames); - return true; + return B_OK; } -bool +status_t OpenDMLParser::ParseList_strl(uint64 start, uint32 size) { TRACE("OpenDMLParser::ParseList_strl\n"); @@ -661,7 +656,7 @@ return ParseList_generic(start, size); } -bool +status_t OpenDMLParser::ParseList_generic(uint64 start, uint32 size) { TRACE("OpenDMLParser::ParseList_generic\n"); @@ -670,7 +665,7 @@ if (size < 9) { ERROR("OpenDMLParser::ParseList_generic: list too small at pos %llu\n",pos); - return false; + return B_ERROR; } while (pos < end) { @@ -680,14 +675,14 @@ if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) { ERROR("OpenDMLParser::ParseList_generic: read error at pos %llu\n",pos); - return false; + return B_ERROR; } pos += 4; Chunkfcc = AVI_UINT32(temp); if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) { ERROR("OpenDMLParser::ParseList_generic: read error at pos %llu\n",pos); - return false; + return B_ERROR; } pos += 4; Chunksize = AVI_UINT32(temp); @@ -698,7 +693,7 @@ if (Chunksize == 0) { ERROR("OpenDMLParser::ParseList_generic: chunk '"FOURCC_FORMAT"' has size 0\n", FOURCC_PARAM(Chunkfcc)); - return false; + return B_ERROR; } if (Chunksize > maxsize) { @@ -707,35 +702,35 @@ } if (Chunkfcc == FOURCC('a','v','i','h')) { - if (!ParseChunk_avih(pos, Chunksize)) - return false; + if (ParseChunk_avih(pos, Chunksize) < B_OK) + return B_ERROR; } else if (Chunkfcc == FOURCC('L','I','S','T')) { - if (!ParseChunk_LIST(pos, Chunksize)) - return false; + if (ParseChunk_LIST(pos, Chunksize) < B_OK) + return B_ERROR; } else if (Chunkfcc == FOURCC('s','t','r','h')) { - if (!ParseChunk_strh(pos, Chunksize)) - return false; + if (ParseChunk_strh(pos, Chunksize) < B_OK) + return B_ERROR; } else if (Chunkfcc == FOURCC('s','t','r','f')) { - if (!ParseChunk_strf(pos, Chunksize)) - return false; + if (ParseChunk_strf(pos, Chunksize) < B_OK) + return B_ERROR; } else if (Chunkfcc == FOURCC('i','n','d','x')) { - if (!ParseChunk_indx(pos, Chunksize)) - return false; + if (ParseChunk_indx(pos, Chunksize) < B_OK) + return B_ERROR; } else if (Chunkfcc == FOURCC('d','m','l','h')) { - if (!ParseChunk_dmlh(pos, Chunksize)) - return false; + if (ParseChunk_dmlh(pos, Chunksize) < B_OK) + return B_ERROR; } else if (Chunkfcc == FOURCC('J','U','N','K')) { ; // do nothing } else { TRACE("OpenDMLParser::ParseList_generic: unknown chunk ignored\n"); } - pos += (Chunksize) + (Chunksize & 1); + pos += Chunksize + (Chunksize & 1); } - return true; + return B_OK; } -bool +status_t OpenDMLParser::ParseList_movi(uint64 start, uint32 size) { TRACE("OpenDMLParser::ParseList_movi\n"); @@ -744,6 +739,6 @@ fMovieListStart = start; fMovieChunkCount++; - return true; + return B_OK; } Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h 2007-06-07 12:46:20 UTC (rev 21344) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h 2007-06-07 20:15:34 UTC (rev 21345) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Marcus Overhagen + * Copyright (c) 2004-2007, Marcus Overhagen * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -46,9 +46,10 @@ class OpenDMLParser { public: - OpenDMLParser(); + OpenDMLParser(BPositionIO *source); ~OpenDMLParser(); - bool Parse(BPositionIO *source); + + status_t Parse(); int StreamCount(); @@ -63,17 +64,17 @@ const odml_extended_header * OdmlExtendedHeader(); private: - bool ParseChunk_AVI(int number, uint64 start, uint32 size); - bool ParseChunk_LIST(uint64 start, uint32 size); - bool ParseChunk_idx1(uint64 start, uint32 size); - bool ParseChunk_indx(uint64 start, uint32 size); - bool ParseChunk_avih(uint64 start, uint32 size); - bool ParseChunk_strh(uint64 start, uint32 size); - bool ParseChunk_strf(uint64 start, uint32 size); - bool ParseChunk_dmlh(uint64 start, uint32 size); - bool ParseList_movi(uint64 start, uint32 size); - bool ParseList_generic(uint64 start, uint32 size); - bool ParseList_strl(uint64 start, uint32 size); + status_t ParseChunk_AVI(int number, uint64 start, uint32 size); + status_t ParseChunk_LIST(uint64 start, uint32 size); + status_t ParseChunk_idx1(uint64 start, uint32 size); + status_t ParseChunk_indx(uint64 start, uint32 size); + status_t ParseChunk_avih(uint64 start, uint32 size); + status_t ParseChunk_strh(uint64 start, uint32 size); + status_t ParseChunk_strf(uint64 start, uint32 size); + status_t ParseChunk_dmlh(uint64 start, uint32 size); + status_t ParseList_movi(uint64 start, uint32 size); + status_t ParseList_generic(uint64 start, uint32 size); + status_t ParseList_strl(uint64 start, uint32 size); private: void CreateNewStreamInfo(); From marcusoverhagen at mail.berlios.de Fri Jun 8 00:03:12 2007 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Fri, 8 Jun 2007 00:03:12 +0200 Subject: [Haiku-commits] r21346 - haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML Message-ID: <200706072203.l57M3CMl021861@sheep.berlios.de> Author: marcusoverhagen Date: 2007-06-08 00:03:11 +0200 (Fri, 08 Jun 2007) New Revision: 21346 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21346&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h Log: check for scale==0 parse strn chunk fix spelling errors prepare for INFO list parsing Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp 2007-06-07 20:15:34 UTC (rev 21345) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp 2007-06-07 22:03:11 UTC (rev 21346) @@ -25,7 +25,7 @@ #include #include "OpenDMLFile.h" -//#define TRACE_ODML_FILE +#define TRACE_ODML_FILE #ifdef TRACE_ODML_FILE #define TRACE printf #else Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp 2007-06-07 20:15:34 UTC (rev 21345) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp 2007-06-07 22:03:11 UTC (rev 21346) @@ -27,7 +27,7 @@ #include "OpenDMLParser.h" #include "avi.h" -//#define TRACE_ODML_PARSER +#define TRACE_ODML_PARSER #ifdef TRACE_ODML_PARSER #define TRACE printf #else @@ -151,7 +151,7 @@ return B_ERROR; } if (fSize < 32) { - ERROR("OpenDMLParser::Parse: file to small\n"); + ERROR("OpenDMLParser::Parse: file too small\n"); return B_ERROR; } @@ -238,7 +238,7 @@ return B_ERROR; cont: - pos += (size) + (size & 1); + pos += size + (size & 1); riff_chunk_number++; } return B_OK; @@ -252,7 +252,7 @@ uint64 end = start + size; if (size < 9) { - ERROR("OpenDMLParser::ParseChunk_AVI: chunk is to small at pos %llu\n", start); + ERROR("OpenDMLParser::ParseChunk_AVI: chunk is too small at pos %llu\n", start); return B_ERROR; } @@ -301,7 +301,7 @@ TRACE("OpenDMLParser::ParseChunk_AVI: unknown chunk ignored\n"); } - pos += (Chunksize) + (Chunksize & 1); + pos += Chunksize + (Chunksize & 1); } return B_OK; @@ -315,7 +315,7 @@ uint32 fourcc; if (size < 5) { - ERROR("OpenDMLParser::ParseChunk_LIST: chunk is to small at pos %llu\n", start); + ERROR("OpenDMLParser::ParseChunk_LIST: chunk is too small at pos %llu\n", start); return B_ERROR; } @@ -338,6 +338,8 @@ return ParseList_strl(start + 4, size - 4); } else if (fourcc == FOURCC('o','d','m','l')) { return ParseList_generic(start + 4, size - 4); + } else if (fourcc == FOURCC('I','N','F','O')) { + return ParseList_INFO(start + 4, size - 4); } else { TRACE("OpenDMLParser::ParseChunk_LIST: unknown list type ignored\n"); return B_OK; @@ -458,6 +460,11 @@ DO_SWAP_INT16(fCurrentStream->stream_header.rect_bottom); #endif + if (fCurrentStream->stream_header.scale == 0) { + printf("OpenDMLParser::ParseChunk_strh: scale is 0\n"); + fCurrentStream->stream_header.scale = 1; + } + fCurrentStream->stream_header_valid = true; fCurrentStream->is_audio = fCurrentStream->stream_header.fourcc_type == FOURCC('a','u','d','s'); fCurrentStream->is_video = fCurrentStream->stream_header.fourcc_type == FOURCC('v','i','d','s'); @@ -597,6 +604,22 @@ } status_t +OpenDMLParser::ParseChunk_strn(uint64 start, uint32 size) +{ + TRACE("OpenDMLParser::ParseChunk_strn, size %lu\n", size); + + if (fCurrentStream == 0) { + ERROR("OpenDMLParser::ParseChunk_strn: error, no Stream info\n"); + return B_ERROR; + } + + // this is an optional null-terminated string, we ignore it... + + return B_OK; +} + + +status_t OpenDMLParser::ParseChunk_indx(uint64 start, uint32 size) { TRACE("OpenDMLParser::ParseChunk_indx\n"); @@ -648,7 +671,7 @@ status_t OpenDMLParser::ParseList_strl(uint64 start, uint32 size) { - TRACE("OpenDMLParser::ParseList_strl\n"); + TRACE("OpenDMLParser::ParseList_strl, size %lu\n", size); CreateNewStreamInfo(); fStreamCount++; @@ -659,7 +682,7 @@ status_t OpenDMLParser::ParseList_generic(uint64 start, uint32 size) { - TRACE("OpenDMLParser::ParseList_generic\n"); + TRACE("OpenDMLParser::ParseList_generic, size %lu\n", size); uint64 pos = start; uint64 end = start + size; @@ -713,6 +736,9 @@ } else if (Chunkfcc == FOURCC('s','t','r','f')) { if (ParseChunk_strf(pos, Chunksize) < B_OK) return B_ERROR; + } else if (Chunkfcc == FOURCC('s','t','r','n')) { + if (ParseChunk_strn(pos, Chunksize) < B_OK) + return B_ERROR; } else if (Chunkfcc == FOURCC('i','n','d','x')) { if (ParseChunk_indx(pos, Chunksize) < B_OK) return B_ERROR; @@ -731,9 +757,17 @@ } status_t +OpenDMLParser::ParseList_INFO(uint64 start, uint32 size) +{ + TRACE("OpenDMLParser::ParseList_INFO, size %lu\n", size); + + return B_OK; +} + +status_t OpenDMLParser::ParseList_movi(uint64 start, uint32 size) { - TRACE("OpenDMLParser::ParseList_movi\n"); + TRACE("OpenDMLParser::ParseList_movi, size %lu\n", size); if (fMovieListStart == 0) fMovieListStart = start; Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h 2007-06-07 20:15:34 UTC (rev 21345) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h 2007-06-07 22:03:11 UTC (rev 21346) @@ -71,9 +71,11 @@ status_t ParseChunk_avih(uint64 start, uint32 size); status_t ParseChunk_strh(uint64 start, uint32 size); status_t ParseChunk_strf(uint64 start, uint32 size); + status_t ParseChunk_strn(uint64 start, uint32 size); status_t ParseChunk_dmlh(uint64 start, uint32 size); status_t ParseList_movi(uint64 start, uint32 size); status_t ParseList_generic(uint64 start, uint32 size); + status_t ParseList_INFO(uint64 start, uint32 size); status_t ParseList_strl(uint64 start, uint32 size); private: From leavengood at mail.berlios.de Fri Jun 8 06:59:18 2007 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Fri, 8 Jun 2007 06:59:18 +0200 Subject: [Haiku-commits] r21347 - haiku/trunk/src/add-ons/screen_savers/message Message-ID: <200706080459.l584xI8W007559@sheep.berlios.de> Author: leavengood Date: 2007-06-08 06:59:14 +0200 (Fri, 08 Jun 2007) New Revision: 21347 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21347&view=rev Modified: haiku/trunk/src/add-ons/screen_savers/message/Message.cpp Log: Inspired by Daniel Sandler's Mac OS X recreation of Message, I've added a little rounded box on the bottom with the full message in it. Given that currently this version only uses fortune to get it's message this allows maximum enjoyment of the little anecdotes and jokes provided by fortune. Though after testing this 60+ times today I'm starting to get sick of fortunes. I've implemented everything myself here, including breaking the string up on newlines and drawing each line of text with the right vertical spacing. I suppose some clever use of BTextView would have been better. But this works fine and wasn't that much code. I'm not sure if this was the most productive use of the last 5 hours, but I learned quite a bit. Modified: haiku/trunk/src/add-ons/screen_savers/message/Message.cpp =================================================================== --- haiku/trunk/src/add-ons/screen_savers/message/Message.cpp 2007-06-07 22:03:11 UTC (rev 21346) +++ haiku/trunk/src/add-ons/screen_savers/message/Message.cpp 2007-06-08 04:59:14 UTC (rev 21347) @@ -52,6 +52,39 @@ } +int get_lines(BString *message, BString*** result, int *longestLine) +{ + // First count how many newlines there are + int count = 0; + int start = 0; + while ((start = message->FindFirst('\n', start)) != B_ERROR) { + start++; // To move past the new line + count++; + } + + // Now break the string up and put in result + BString **lines = new BString*[count]; + start = 0; + int end = 0; + int maxLength = 0; + for (int i = 0; ((end = message->FindFirst('\n', start)) != B_ERROR) && i < count; i++) { + lines[i] = new BString(); + message->CopyInto(*lines[i], start, end - start); + // Convert tabs to 4 spaces + lines[i]->ReplaceAll("\t", " "); + // Look for longest line + if (lines[i]->Length() > maxLength) { + maxLength = lines[i]->Length(); + *longestLine = i; + } + start = end + 1; + } + *result = lines; + + return count; +} + + // Inspired by the classic BeOS screensaver, of course. // Thanks to Jon Watte for writing the original. class Message : public BScreenSaver @@ -66,6 +99,7 @@ private: BList *fFontFamilies; float fScaleFactor; + bool fPreview; }; @@ -105,6 +139,7 @@ status_t Message::StartSaver(BView *view, bool preview) { + fPreview = preview; // Scale factor is based on the system I developed this on, in // other words other factors below depend on this. fScaleFactor = view->Bounds().Height() / 1024; @@ -168,17 +203,17 @@ offscreen.SetFont(&font); // Get the message - // TODO: Display the whole message at the bottom of the screen - // in a translucent rect BString *message = get_message(); + BString *origMessage = new BString(); + message->CopyInto(*origMessage, 0, message->Length()); // Replace newlines and tabs with spaces message->ReplaceSet("\n\t", ' '); int height = (int) offscreen.Bounds().Height(); int width = (int) offscreen.Bounds().Width(); - // From 8 to 16 iterations - int32 iterations = (rand() % 9) + 8; + // From 14 to 22 iterations + int32 iterations = (rand() % 8) + 14; for (int32 i = 0; i < iterations; i++) { // Randomly set font size and shear BFont font; @@ -193,9 +228,8 @@ offscreen.SetFont(&font); // Randomly set drawing location - // TODO: Improve this int x = (rand() % width) - (rand() % width/((rand() % 8)+1)); - int y = (rand() % height) - (rand() % height/((rand() % 8)+1)); + int y = rand() % height; // Draw new text offscreen.SetHighColor(colors[rand() % 8]); @@ -215,6 +249,42 @@ delete toDraw; } + // Now draw the full message in a nice translucent box, but only + // if this isn't preview mode + if (!fPreview) { + BFont font(be_fixed_font); + font.SetSize(14.0); + offscreen.SetFont(&font); + font_height fontHeight; + font.GetHeight(&fontHeight); + float lineHeight = fontHeight.ascent + fontHeight.descent + fontHeight.leading; + + BString **result = NULL; + int longestLine = 0; + int count = get_lines(origMessage, &result, &longestLine); + float stringWidth = font.StringWidth(result[longestLine]->String()); + BRect box(0, 0, stringWidth + 20, (lineHeight * count) + 20); + box.OffsetTo((width - box.Width()) / 2, height - box.Height() - 40); + + offscreen.SetDrawingMode(B_OP_ALPHA); + base_color.alpha = 128; + offscreen.SetHighColor(base_color); + offscreen.FillRoundRect(box, 8, 8); + offscreen.SetHighColor(205, 205, 205); + BPoint start = box.LeftTop(); + start.x += 10; + start.y += 10 + fontHeight.ascent + fontHeight.leading; + for (int i = 0; i < count; i++) { + offscreen.DrawString(result[i]->String(), start); + start.y += lineHeight; + delete result[i]; + } + delete[] result; + } + + delete origMessage; + delete message; + offscreen.Sync(); buffer.Unlock(); view->DrawBitmap(&buffer); From leavengood at mail.berlios.de Fri Jun 8 07:04:35 2007 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Fri, 8 Jun 2007 07:04:35 +0200 Subject: [Haiku-commits] r21348 - haiku/trunk/src/add-ons/screen_savers/message Message-ID: <200706080504.l5854Z98015935@sheep.berlios.de> Author: leavengood Date: 2007-06-08 07:04:33 +0200 (Fri, 08 Jun 2007) New Revision: 21348 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21348&view=rev Modified: haiku/trunk/src/add-ons/screen_savers/message/Message.cpp Log: Better name: result becomes lines. Modified: haiku/trunk/src/add-ons/screen_savers/message/Message.cpp =================================================================== --- haiku/trunk/src/add-ons/screen_savers/message/Message.cpp 2007-06-08 04:59:14 UTC (rev 21347) +++ haiku/trunk/src/add-ons/screen_savers/message/Message.cpp 2007-06-08 05:04:33 UTC (rev 21348) @@ -259,10 +259,11 @@ font.GetHeight(&fontHeight); float lineHeight = fontHeight.ascent + fontHeight.descent + fontHeight.leading; - BString **result = NULL; + BString **lines = NULL; int longestLine = 0; - int count = get_lines(origMessage, &result, &longestLine); - float stringWidth = font.StringWidth(result[longestLine]->String()); + int count = get_lines(origMessage, &lines, &longestLine); + + float stringWidth = font.StringWidth(lines[longestLine]->String()); BRect box(0, 0, stringWidth + 20, (lineHeight * count) + 20); box.OffsetTo((width - box.Width()) / 2, height - box.Height() - 40); @@ -275,11 +276,11 @@ start.x += 10; start.y += 10 + fontHeight.ascent + fontHeight.leading; for (int i = 0; i < count; i++) { - offscreen.DrawString(result[i]->String(), start); + offscreen.DrawString(lines[i]->String(), start); start.y += lineHeight; - delete result[i]; + delete lines[i]; } - delete[] result; + delete[] lines; } delete origMessage; From jackburton at mail.berlios.de Fri Jun 8 11:44:14 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Fri, 8 Jun 2007 11:44:14 +0200 Subject: [Haiku-commits] r21349 - haiku/trunk/src/system/kernel/vm Message-ID: <200706080944.l589iEQI000051@sheep.berlios.de> Author: jackburton Date: 2007-06-08 11:44:13 +0200 (Fri, 08 Jun 2007) New Revision: 21349 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21349&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm.cpp haiku/trunk/src/system/kernel/vm/vm_address_space.c Log: Got rid of a global, hope no one minds Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2007-06-08 05:04:33 UTC (rev 21348) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2007-06-08 09:44:13 UTC (rev 21349) @@ -58,8 +58,6 @@ #define ROUNDOWN(a, b) (((a) / (b)) * (b)) -extern vm_address_space *gKernelAddressSpace; - #define REGION_HASH_TABLE_SIZE 1024 static area_id sNextAreaID; static hash_table *sAreaHash; @@ -1321,7 +1319,7 @@ // have been adapted. Maybe it should be part of the kernel settings, // anyway (so that old drivers can always work). #if 0 - if (sourceArea->aspace == gKernelAddressSpace && addressSpace != gKernelAddressSpace + if (sourceArea->aspace == vm_kernel_address_space() && addressSpace != vm_kernel_address_space() && !(sourceArea->protection & B_USER_CLONEABLE_AREA)) { // kernel areas must not be cloned in userland, unless explicitly // declared user-cloneable upon construction @@ -2574,7 +2572,7 @@ void vm_free_unused_boot_loader_range(addr_t start, addr_t size) { - vm_translation_map *map = &gKernelAddressSpace->translation_map; + vm_translation_map *map = &vm_kernel_address_space()->translation_map; addr_t end = start + size; addr_t lastEnd = start; vm_area *area; @@ -2587,7 +2585,7 @@ map->ops->lock(map); - for (area = gKernelAddressSpace->areas; area; area = area->address_space_next) { + for (area = vm_kernel_address_space()->areas; area; area = area->address_space_next) { addr_t areaStart = area->base; addr_t areaEnd = areaStart + area->size; @@ -2981,7 +2979,7 @@ arch_vm_translation_map_init_post_sem(args); vm_address_space_init_post_sem(); - for (area = gKernelAddressSpace->areas; area; area = area->address_space_next) { + for (area = vm_kernel_address_space()->areas; area; area = area->address_space_next) { if (area->id == RESERVED_AREA_ID) continue; @@ -3617,14 +3615,14 @@ status_t vm_get_physical_page(addr_t paddr, addr_t *_vaddr, uint32 flags) { - return (*gKernelAddressSpace->translation_map.ops->get_physical_page)(paddr, _vaddr, flags); + return (*vm_kernel_address_space()->translation_map.ops->get_physical_page)(paddr, _vaddr, flags); } status_t vm_put_physical_page(addr_t vaddr) { - return (*gKernelAddressSpace->translation_map.ops->put_physical_page)(vaddr); + return (*vm_kernel_address_space()->translation_map.ops->put_physical_page)(vaddr); } Modified: haiku/trunk/src/system/kernel/vm/vm_address_space.c =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_address_space.c 2007-06-08 05:04:33 UTC (rev 21348) +++ haiku/trunk/src/system/kernel/vm/vm_address_space.c 2007-06-08 09:44:13 UTC (rev 21349) @@ -26,8 +26,9 @@ # define TRACE(x) ; #endif -vm_address_space *gKernelAddressSpace; +static vm_address_space *sKernelAddressSpace; + #define ASPACE_HASH_TABLE_SIZE 1024 static void *sAddressSpaceTable; static sem_id sAddressSpaceHashSem; @@ -140,7 +141,7 @@ { TRACE(("delete_address_space: called on aspace 0x%lx\n", addressSpace->id)); - if (addressSpace == gKernelAddressSpace) + if (addressSpace == sKernelAddressSpace) panic("tried to delete the kernel aspace!\n"); // put this aspace in the deletion state @@ -178,22 +179,22 @@ vm_get_kernel_address_space(void) { /* we can treat this one a little differently since it can't be deleted */ - atomic_add(&gKernelAddressSpace->ref_count, 1); - return gKernelAddressSpace; + atomic_add(&sKernelAddressSpace->ref_count, 1); + return sKernelAddressSpace; } vm_address_space * vm_kernel_address_space(void) { - return gKernelAddressSpace; + return sKernelAddressSpace; } team_id vm_kernel_address_space_id(void) { - return gKernelAddressSpace->id; + return sKernelAddressSpace->id; } @@ -354,11 +355,11 @@ panic("vm_init: error creating aspace hash table\n"); } - gKernelAddressSpace = NULL; + sKernelAddressSpace = NULL; // create the initial kernel address space if (vm_create_address_space(1, KERNEL_BASE, KERNEL_SIZE, - true, &gKernelAddressSpace) != B_OK) + true, &sKernelAddressSpace) != B_OK) panic("vm_init: error creating kernel address space!\n"); add_debugger_command("aspaces", &dump_aspace_list, "Dump a list of all address spaces"); @@ -371,11 +372,11 @@ status_t vm_address_space_init_post_sem(void) { - status_t status = arch_vm_translation_map_init_kernel_map_post_sem(&gKernelAddressSpace->translation_map); + status_t status = arch_vm_translation_map_init_kernel_map_post_sem(&sKernelAddressSpace->translation_map); if (status < B_OK) return status; - status = gKernelAddressSpace->sem = create_sem(WRITE_COUNT, "kernel_aspacelock"); + status = sKernelAddressSpace->sem = create_sem(WRITE_COUNT, "kernel_aspacelock"); if (status < B_OK) return status; From korli at mail.berlios.de Fri Jun 8 20:33:03 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Fri, 8 Jun 2007 20:33:03 +0200 Subject: [Haiku-commits] r21350 - in haiku/trunk/src/system/libroot/posix/glibc/arch: generic ppc x86 Message-ID: <200706081833.l58IX3Pc012199@sheep.berlios.de> Author: korli Date: 2007-06-08 20:33:02 +0200 (Fri, 08 Jun 2007) New Revision: 21350 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21350&view=rev Added: haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_trunc.c haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_truncf.c haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_trunc.S haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_truncf.S haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_truncl.S Modified: haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/Jamfile haiku/trunk/src/system/libroot/posix/glibc/arch/x86/Jamfile Log: added trunc, truncf (and truncl on x86) from glibc should help on bug #1260 Added: haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_trunc.c =================================================================== --- haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_trunc.c 2007-06-08 09:44:13 UTC (rev 21349) +++ haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_trunc.c 2007-06-08 18:33:02 UTC (rev 21350) @@ -0,0 +1,61 @@ +/* Truncate argument to nearest integral value not larger than the argument. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include "math_private.h" + + +double +__trunc (double x) +{ + int32_t i0, j0; + u_int32_t i1; + int sx; + + EXTRACT_WORDS (i0, i1, x); + sx = i0 & 0x80000000; + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + if (j0 < 20) + { + if (j0 < 0) + /* The magnitude of the number is < 1 so the result is +-0. */ + INSERT_WORDS (x, sx, 0); + else + INSERT_WORDS (x, sx | (i0 & ~(0x000fffff >> j0)), 0); + } + else if (j0 > 51) + { + if (j0 == 0x400) + /* x is inf or NaN. */ + return x + x; + } + else + { + INSERT_WORDS (x, i0, i1 & ~(0xffffffffu >> (j0 - 20))); + } + + return x; +} +weak_alias (__trunc, trunc) +#ifdef NO_LONG_DOUBLE +strong_alias (__trunc, __truncl) +weak_alias (__trunc, truncl) +#endif Added: haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_truncf.c =================================================================== --- haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_truncf.c 2007-06-08 09:44:13 UTC (rev 21349) +++ haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_truncf.c 2007-06-08 18:33:02 UTC (rev 21350) @@ -0,0 +1,52 @@ +/* Truncate argument to nearest integral value not larger than the argument. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include "math_private.h" + + +float +__truncf (float x) +{ + int32_t i0, j0; + int sx; + + GET_FLOAT_WORD (i0, x); + sx = i0 & 0x80000000; + j0 = ((i0 >> 23) & 0xff) - 0x7f; + if (j0 < 23) + { + if (j0 < 0) + /* The magnitude of the number is < 1 so the result is +-0. */ + SET_FLOAT_WORD (x, sx); + else + SET_FLOAT_WORD (x, sx | (i0 & ~(0x007fffff >> j0))); + } + else + { + if (j0 == 0x80) + /* x is inf or NaN. */ + return x + x; + } + + return x; +} +weak_alias (__truncf, truncf) Modified: haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/Jamfile 2007-06-08 09:44:13 UTC (rev 21349) +++ haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/Jamfile 2007-06-08 18:33:02 UTC (rev 21350) @@ -88,6 +88,7 @@ s_sincos.c s_sincosf.c s_tan.c s_tanf.c s_tanh.c s_tanhf.c + s_trunc.c s_truncf.c t_exp.c w_acos.c w_acosf.c # w_acosl.c w_acosh.c w_acoshf.c # w_acoshl.c Modified: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/Jamfile 2007-06-08 09:44:13 UTC (rev 21349) +++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/Jamfile 2007-06-08 18:33:02 UTC (rev 21350) @@ -157,6 +157,7 @@ s_sin.S s_sinf.S s_sinl.S s_sincos.S s_sincosf.S s_sincosl.S s_tan.S s_tanf.S s_tanl.S + s_trunc.S s_truncf.S s_truncl.S ; MergeObject posix_gnu_arch_$(TARGET_ARCH)_generic.o : Added: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_trunc.S =================================================================== --- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_trunc.S 2007-06-08 09:44:13 UTC (rev 21349) +++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_trunc.S 2007-06-08 18:33:02 UTC (rev 21350) @@ -0,0 +1,36 @@ +/* Truncate double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +ENTRY(__trunc) + fldl 4(%esp) + subl $8, %esp + fstcw 4(%esp) + movl $0xc00, %edx + orl 4(%esp), %edx + movl %edx, (%esp) + fldcw (%esp) + frndint + fldcw 4(%esp) + addl $8, %esp + ret +END(__trunc) +weak_alias (__trunc, trunc) Added: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_truncf.S =================================================================== --- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_truncf.S 2007-06-08 09:44:13 UTC (rev 21349) +++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_truncf.S 2007-06-08 18:33:02 UTC (rev 21350) @@ -0,0 +1,36 @@ +/* Truncate float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +ENTRY(__truncf) + flds 4(%esp) + subl $8, %esp + fstcw 4(%esp) + movl $0xc00, %edx + orl 4(%esp), %edx + movl %edx, (%esp) + fldcw (%esp) + frndint + fldcw 4(%esp) + addl $8, %esp + ret +END(__truncf) +weak_alias (__truncf, truncf) Added: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_truncl.S =================================================================== --- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_truncl.S 2007-06-08 09:44:13 UTC (rev 21349) +++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_truncl.S 2007-06-08 18:33:02 UTC (rev 21350) @@ -0,0 +1,36 @@ +/* Truncate long double value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +ENTRY(__truncl) + fldt 4(%esp) + subl $8, %esp + fstcw 4(%esp) + movl $0xc00, %edx + orl 4(%esp), %edx + movl %edx, (%esp) + fldcw (%esp) + frndint + fldcw 4(%esp) + addl $8, %esp + ret +END(__truncl) +weak_alias (__truncl, truncl) From korli at mail.berlios.de Sat Jun 9 01:01:17 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 9 Jun 2007 01:01:17 +0200 Subject: [Haiku-commits] r21351 - in haiku/trunk: headers/private/opengl/GL/internal src/add-ons/opengl/mesa_software_renderer src/kits/opengl/mesa src/kits/opengl/mesa/array_cache src/kits/opengl/mesa/drivers/common src/kits/opengl/mesa/glapi src/kits/opengl/mesa/main src/kits/opengl/mesa/shader src/kits/opengl/mesa/shader/grammar src/kits/opengl/mesa/shader/slang src/kits/opengl/mesa/shader/slang/library src/kits/opengl/mesa/sparc src/kits/opengl/mesa/swrast src/kits/opengl/mesa/swrast_setup src/kits/opengl/mesa/tnl src/kits/opengl/mesa/tnl_dd src/kits/opengl/mesa/vbo src/kits/opengl/mesa/x86 src/kits/opengl/mesa/x86-64 Message-ID: <200706082301.l58N1HrH004050@sheep.berlios.de> Author: korli Date: 2007-06-09 01:00:44 +0200 (Sat, 09 Jun 2007) New Revision: 21351 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21351&view=rev Added: haiku/trunk/src/kits/opengl/mesa/main/queryobj.c haiku/trunk/src/kits/opengl/mesa/main/queryobj.h haiku/trunk/src/kits/opengl/mesa/main/shaders.c haiku/trunk/src/kits/opengl/mesa/main/shaders.h haiku/trunk/src/kits/opengl/mesa/shader/prog_debug.c haiku/trunk/src/kits/opengl/mesa/shader/prog_debug.h haiku/trunk/src/kits/opengl/mesa/shader/prog_execute.c haiku/trunk/src/kits/opengl/mesa/shader/prog_execute.h haiku/trunk/src/kits/opengl/mesa/shader/prog_instruction.c haiku/trunk/src/kits/opengl/mesa/shader/prog_instruction.h haiku/trunk/src/kits/opengl/mesa/shader/prog_parameter.c haiku/trunk/src/kits/opengl/mesa/shader/prog_parameter.h haiku/trunk/src/kits/opengl/mesa/shader/prog_print.c haiku/trunk/src/kits/opengl/mesa/shader/prog_print.h haiku/trunk/src/kits/opengl/mesa/shader/prog_statevars.c haiku/trunk/src/kits/opengl/mesa/shader/prog_statevars.h haiku/trunk/src/kits/opengl/mesa/shader/shader_api.c haiku/trunk/src/kits/opengl/mesa/shader/shader_api.h haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_120_core_gc.h haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_builtin_120_common_gc.h haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_builtin_120_fragment_gc.h haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_version_syn.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_builtin.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_builtin.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_codegen.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_codegen.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_emit.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_emit.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_ir.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_ir.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_label.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_label.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_log.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_log.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_mem.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_mem.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_print.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_print.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_simplify.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_simplify.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_typeinfo.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_typeinfo.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_vartable.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_vartable.h haiku/trunk/src/kits/opengl/mesa/swrast/s_fragprog.c haiku/trunk/src/kits/opengl/mesa/swrast/s_fragprog.h haiku/trunk/src/kits/opengl/mesa/tnl/t_draw.c haiku/trunk/src/kits/opengl/mesa/vbo/ haiku/trunk/src/kits/opengl/mesa/vbo/vbo.h haiku/trunk/src/kits/opengl/mesa/vbo/vbo_attrib.h haiku/trunk/src/kits/opengl/mesa/vbo/vbo_attrib_tmp.h haiku/trunk/src/kits/opengl/mesa/vbo/vbo_context.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_context.h haiku/trunk/src/kits/opengl/mesa/vbo/vbo_exec.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_exec.h haiku/trunk/src/kits/opengl/mesa/vbo/vbo_exec_api.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_exec_array.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_exec_draw.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_exec_eval.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_rebase.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_save.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_save.h haiku/trunk/src/kits/opengl/mesa/vbo/vbo_save_api.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_save_draw.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_save_loopback.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_split.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_split.h haiku/trunk/src/kits/opengl/mesa/vbo/vbo_split_copy.c haiku/trunk/src/kits/opengl/mesa/vbo/vbo_split_inplace.c Removed: haiku/trunk/src/kits/opengl/mesa/array_cache/ac_context.c haiku/trunk/src/kits/opengl/mesa/array_cache/ac_context.h haiku/trunk/src/kits/opengl/mesa/array_cache/ac_import.c haiku/trunk/src/kits/opengl/mesa/array_cache/acache.h haiku/trunk/src/kits/opengl/mesa/main/occlude.c haiku/trunk/src/kits/opengl/mesa/main/occlude.h haiku/trunk/src/kits/opengl/mesa/shader/grammar/descrip.mms haiku/trunk/src/kits/opengl/mesa/shader/grammar/sources haiku/trunk/src/kits/opengl/mesa/shader/nvvertexec.c haiku/trunk/src/kits/opengl/mesa/shader/nvvertexec.h haiku/trunk/src/kits/opengl/mesa/shader/program_instruction.h haiku/trunk/src/kits/opengl/mesa/shader/shaderobjects.c haiku/trunk/src/kits/opengl/mesa/shader/shaderobjects.h haiku/trunk/src/kits/opengl/mesa/shader/shaderobjects_3dlabs.c haiku/trunk/src/kits/opengl/mesa/shader/shaderobjects_3dlabs.h haiku/trunk/src/kits/opengl/mesa/shader/slang/descrip.mms haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_builtin_vec4_gc.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_analyse.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_analyse.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_assemble.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_assemble.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_assemble_assignment.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_assemble_assignment.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_assemble_conditional.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_assemble_conditional.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_assemble_constructor.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_assemble_constructor.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_assemble_typeinfo.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_assemble_typeinfo.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_execute.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_execute.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_execute_x86.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_export.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_export.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_library_texsample.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_library_texsample.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_mesa.h haiku/trunk/src/kits/opengl/mesa/shader/slang/sources haiku/trunk/src/kits/opengl/mesa/shader/slang/traverse_wrap.h haiku/trunk/src/kits/opengl/mesa/swrast/s_arbshader.c haiku/trunk/src/kits/opengl/mesa/swrast/s_arbshader.h haiku/trunk/src/kits/opengl/mesa/swrast/s_nvfragprog.c haiku/trunk/src/kits/opengl/mesa/swrast/s_nvfragprog.h haiku/trunk/src/kits/opengl/mesa/tnl/t_array_api.c haiku/trunk/src/kits/opengl/mesa/tnl/t_array_api.h haiku/trunk/src/kits/opengl/mesa/tnl/t_array_import.c haiku/trunk/src/kits/opengl/mesa/tnl/t_array_import.h haiku/trunk/src/kits/opengl/mesa/tnl/t_save_api.h haiku/trunk/src/kits/opengl/mesa/tnl/t_save_loopback.c haiku/trunk/src/kits/opengl/mesa/tnl/t_save_playback.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_arbprogram.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_arbprogram.h haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_arbprogram_sse.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_arbshader.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vtx_api.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vtx_api.h haiku/trunk/src/kits/opengl/mesa/tnl/t_vtx_eval.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vtx_exec.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vtx_generic.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vtx_x86.c Modified: haiku/trunk/headers/private/opengl/GL/internal/glcore.h haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp haiku/trunk/src/kits/opengl/mesa/Jamfile haiku/trunk/src/kits/opengl/mesa/drivers/common/driverfuncs.c haiku/trunk/src/kits/opengl/mesa/drivers/common/driverfuncs.h haiku/trunk/src/kits/opengl/mesa/glapi/glapi.c haiku/trunk/src/kits/opengl/mesa/glapi/glapitable.h haiku/trunk/src/kits/opengl/mesa/glapi/glapitemp.h haiku/trunk/src/kits/opengl/mesa/glapi/glprocs.h haiku/trunk/src/kits/opengl/mesa/main/api_loopback.c haiku/trunk/src/kits/opengl/mesa/main/api_noop.c haiku/trunk/src/kits/opengl/mesa/main/arrayobj.c haiku/trunk/src/kits/opengl/mesa/main/attrib.c haiku/trunk/src/kits/opengl/mesa/main/bufferobj.c haiku/trunk/src/kits/opengl/mesa/main/buffers.c haiku/trunk/src/kits/opengl/mesa/main/colortab.c haiku/trunk/src/kits/opengl/mesa/main/config.h haiku/trunk/src/kits/opengl/mesa/main/context.c haiku/trunk/src/kits/opengl/mesa/main/context.h haiku/trunk/src/kits/opengl/mesa/main/dd.h haiku/trunk/src/kits/opengl/mesa/main/dlist.c haiku/trunk/src/kits/opengl/mesa/main/enable.c haiku/trunk/src/kits/opengl/mesa/main/enums.c haiku/trunk/src/kits/opengl/mesa/main/execmem.c haiku/trunk/src/kits/opengl/mesa/main/extensions.c haiku/trunk/src/kits/opengl/mesa/main/fbobject.c haiku/trunk/src/kits/opengl/mesa/main/framebuffer.c haiku/trunk/src/kits/opengl/mesa/main/framebuffer.h haiku/trunk/src/kits/opengl/mesa/main/get.c haiku/trunk/src/kits/opengl/mesa/main/getstring.c haiku/trunk/src/kits/opengl/mesa/main/glheader.h haiku/trunk/src/kits/opengl/mesa/main/image.c haiku/trunk/src/kits/opengl/mesa/main/imports.c haiku/trunk/src/kits/opengl/mesa/main/imports.h haiku/trunk/src/kits/opengl/mesa/main/light.c haiku/trunk/src/kits/opengl/mesa/main/light.h haiku/trunk/src/kits/opengl/mesa/main/lines.c haiku/trunk/src/kits/opengl/mesa/main/matrix.c haiku/trunk/src/kits/opengl/mesa/main/mipmap.c haiku/trunk/src/kits/opengl/mesa/main/mtypes.h haiku/trunk/src/kits/opengl/mesa/main/pixel.c haiku/trunk/src/kits/opengl/mesa/main/points.c haiku/trunk/src/kits/opengl/mesa/main/points.h haiku/trunk/src/kits/opengl/mesa/main/polygon.c haiku/trunk/src/kits/opengl/mesa/main/polygon.h haiku/trunk/src/kits/opengl/mesa/main/rastpos.c haiku/trunk/src/kits/opengl/mesa/main/rbadaptors.c haiku/trunk/src/kits/opengl/mesa/main/renderbuffer.c haiku/trunk/src/kits/opengl/mesa/main/renderbuffer.h haiku/trunk/src/kits/opengl/mesa/main/state.c haiku/trunk/src/kits/opengl/mesa/main/stencil.c haiku/trunk/src/kits/opengl/mesa/main/texcompress_fxt1.c haiku/trunk/src/kits/opengl/mesa/main/texcompress_s3tc.c haiku/trunk/src/kits/opengl/mesa/main/texenvprogram.c haiku/trunk/src/kits/opengl/mesa/main/teximage.c haiku/trunk/src/kits/opengl/mesa/main/texobj.c haiku/trunk/src/kits/opengl/mesa/main/texrender.c haiku/trunk/src/kits/opengl/mesa/main/texstate.c haiku/trunk/src/kits/opengl/mesa/main/texstore.c haiku/trunk/src/kits/opengl/mesa/main/texstore.h haiku/trunk/src/kits/opengl/mesa/main/varray.c haiku/trunk/src/kits/opengl/mesa/main/version.h haiku/trunk/src/kits/opengl/mesa/shader/arbprogparse.c haiku/trunk/src/kits/opengl/mesa/shader/arbprogram.c haiku/trunk/src/kits/opengl/mesa/shader/grammar/grammar.c haiku/trunk/src/kits/opengl/mesa/shader/nvfragparse.c haiku/trunk/src/kits/opengl/mesa/shader/nvprogram.c haiku/trunk/src/kits/opengl/mesa/shader/nvvertparse.c haiku/trunk/src/kits/opengl/mesa/shader/program.c haiku/trunk/src/kits/opengl/mesa/shader/program.h haiku/trunk/src/kits/opengl/mesa/shader/programopt.c haiku/trunk/src/kits/opengl/mesa/shader/programopt.h haiku/trunk/src/kits/opengl/mesa/shader/slang/library/gc_to_bin.c haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_common_builtin_gc.h haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_core_gc.h haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_fragment_builtin_gc.h haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_shader_syn.h haiku/trunk/src/kits/opengl/mesa/shader/slang/library/slang_vertex_builtin_gc.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_compile.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_compile.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_compile_function.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_compile_function.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_compile_operation.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_compile_operation.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_compile_struct.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_compile_variable.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_compile_variable.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_library_noise.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_link.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_link.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_preprocess.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_preprocess.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_storage.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_storage.h haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_utility.c haiku/trunk/src/kits/opengl/mesa/shader/slang/slang_utility.h haiku/trunk/src/kits/opengl/mesa/sparc/glapi_sparc.S haiku/trunk/src/kits/opengl/mesa/swrast/s_aaline.c haiku/trunk/src/kits/opengl/mesa/swrast/s_aalinetemp.h haiku/trunk/src/kits/opengl/mesa/swrast/s_aatriangle.c haiku/trunk/src/kits/opengl/mesa/swrast/s_aatritemp.h haiku/trunk/src/kits/opengl/mesa/swrast/s_accum.c haiku/trunk/src/kits/opengl/mesa/swrast/s_alpha.c haiku/trunk/src/kits/opengl/mesa/swrast/s_atifragshader.c haiku/trunk/src/kits/opengl/mesa/swrast/s_bitmap.c haiku/trunk/src/kits/opengl/mesa/swrast/s_buffers.c haiku/trunk/src/kits/opengl/mesa/swrast/s_context.c haiku/trunk/src/kits/opengl/mesa/swrast/s_context.h haiku/trunk/src/kits/opengl/mesa/swrast/s_copypix.c haiku/trunk/src/kits/opengl/mesa/swrast/s_depth.c haiku/trunk/src/kits/opengl/mesa/swrast/s_drawpix.c haiku/trunk/src/kits/opengl/mesa/swrast/s_feedback.c haiku/trunk/src/kits/opengl/mesa/swrast/s_fog.c haiku/trunk/src/kits/opengl/mesa/swrast/s_lines.c haiku/trunk/src/kits/opengl/mesa/swrast/s_linetemp.h haiku/trunk/src/kits/opengl/mesa/swrast/s_logic.c haiku/trunk/src/kits/opengl/mesa/swrast/s_masking.c haiku/trunk/src/kits/opengl/mesa/swrast/s_points.c haiku/trunk/src/kits/opengl/mesa/swrast/s_pointtemp.h haiku/trunk/src/kits/opengl/mesa/swrast/s_readpix.c haiku/trunk/src/kits/opengl/mesa/swrast/s_span.c haiku/trunk/src/kits/opengl/mesa/swrast/s_span.h haiku/trunk/src/kits/opengl/mesa/swrast/s_stencil.c haiku/trunk/src/kits/opengl/mesa/swrast/s_texcombine.c haiku/trunk/src/kits/opengl/mesa/swrast/s_texfilter.c haiku/trunk/src/kits/opengl/mesa/swrast/s_triangle.c haiku/trunk/src/kits/opengl/mesa/swrast/s_tritemp.h haiku/trunk/src/kits/opengl/mesa/swrast/s_zoom.c haiku/trunk/src/kits/opengl/mesa/swrast/swrast.h haiku/trunk/src/kits/opengl/mesa/swrast_setup/ss_context.c haiku/trunk/src/kits/opengl/mesa/swrast_setup/ss_triangle.c haiku/trunk/src/kits/opengl/mesa/swrast_setup/ss_tritmp.h haiku/trunk/src/kits/opengl/mesa/tnl/t_context.c haiku/trunk/src/kits/opengl/mesa/tnl/t_context.h haiku/trunk/src/kits/opengl/mesa/tnl/t_pipeline.c haiku/trunk/src/kits/opengl/mesa/tnl/t_pipeline.h haiku/trunk/src/kits/opengl/mesa/tnl/t_save_api.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_cull.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_fog.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_light.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_normals.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_points.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_program.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_render.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_rendertmp.h haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_texgen.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_texmat.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vb_vertex.c haiku/trunk/src/kits/opengl/mesa/tnl/t_vp_build.c haiku/trunk/src/kits/opengl/mesa/tnl/tnl.h haiku/trunk/src/kits/opengl/mesa/tnl_dd/t_dd_vb.c haiku/trunk/src/kits/opengl/mesa/x86-64/glapi_x86-64.S haiku/trunk/src/kits/opengl/mesa/x86-64/matypes.h haiku/trunk/src/kits/opengl/mesa/x86/common_x86.c haiku/trunk/src/kits/opengl/mesa/x86/glapi_x86.S haiku/trunk/src/kits/opengl/mesa/x86/matypes.h haiku/trunk/src/kits/opengl/mesa/x86/mmx_blend.S haiku/trunk/src/kits/opengl/mesa/x86/read_rgba_span_x86.S Log: updated mesa to 6.5.3 Modified: haiku/trunk/headers/private/opengl/GL/internal/glcore.h =================================================================== --- haiku/trunk/headers/private/opengl/GL/internal/glcore.h 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/headers/private/opengl/GL/internal/glcore.h 2007-06-08 23:00:44 UTC (rev 21351) @@ -38,17 +38,11 @@ #include -#ifdef CAPI -#undef CAPI -#endif -#define CAPI - #define GL_CORE_SGI 1 #define GL_CORE_MESA 2 #define GL_CORE_APPLE 4 typedef struct __GLcontextRec __GLcontext; -typedef struct __GLinterfaceRec __GLinterface; /* ** This file defines the interface between the GL core and the surrounding @@ -186,334 +180,4 @@ #define GLX_TEXTURE_2D_BIT_EXT 0x00000002 #define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 - -/************************************************************************/ - -/* -** Structure used for allocating and freeing drawable private memory. -** (like software buffers, for example). -** -** The memory allocation routines are provided by the surrounding -** "operating system" code, and they are to be used for allocating -** software buffers and things which are associated with the drawable, -** and used by any context which draws to that drawable. There are -** separate memory allocation functions for drawables and contexts -** since drawables and contexts can be created and destroyed independently -** of one another, and the "operating system" may want to use separate -** allocation arenas for each. -** -** The freePrivate function is filled in by the core routines when they -** allocates software buffers, and stick them in "private". The freePrivate -** function will destroy anything allocated to this drawable (to be called -** when the drawable is destroyed). -*/ -typedef struct __GLdrawableRegionRec __GLdrawableRegion; -typedef struct __GLdrawableBufferRec __GLdrawableBuffer; -typedef struct __GLdrawablePrivateRec __GLdrawablePrivate; - -typedef struct __GLregionRectRec { - /* lower left (inside the rectangle) */ - GLint x0, y0; - /* upper right (outside the rectangle) */ - GLint x1, y1; -} __GLregionRect; - -struct __GLdrawableRegionRec { - GLint numRects; - __GLregionRect *rects; - __GLregionRect boundingRect; -}; - -/************************************************************************/ - -/* masks for the buffers */ -#define __GL_FRONT_BUFFER_MASK 0x00000001 -#define __GL_FRONT_LEFT_BUFFER_MASK 0x00000001 -#define __GL_FRONT_RIGHT_BUFFER_MASK 0x00000002 -#define __GL_BACK_BUFFER_MASK 0x00000004 -#define __GL_BACK_LEFT_BUFFER_MASK 0x00000004 -#define __GL_BACK_RIGHT_BUFFER_MASK 0x00000008 -#define __GL_ACCUM_BUFFER_MASK 0x00000010 -#define __GL_DEPTH_BUFFER_MASK 0x00000020 -#define __GL_STENCIL_BUFFER_MASK 0x00000040 -#define __GL_AUX_BUFFER_MASK(i) (0x0000080 << (i)) - -#define __GL_ALL_BUFFER_MASK 0xffffffff - -/* what Resize routines return if resize resorted to fallback case */ -#define __GL_BUFFER_FALLBACK 0x10 - -typedef void (*__GLbufFallbackInitFn)(__GLdrawableBuffer *buf, - __GLdrawablePrivate *glPriv, GLint bits); -typedef void (*__GLbufMainInitFn)(__GLdrawableBuffer *buf, - __GLdrawablePrivate *glPriv, GLint bits, - __GLbufFallbackInitFn back); - -/* -** A drawable buffer -** -** This data structure describes the context side of a drawable. -** -** According to the spec there could be multiple contexts bound to the same -** drawable at the same time (from different threads). In order to avoid -** multiple-access conflicts, locks are used to serialize access. When a -** thread needs to access (read or write) a member of the drawable, it takes -** a lock first. Some of the entries in the drawable are treated "mostly -** constant", so we take the freedom of allowing access to them without -** taking a lock (for optimization reasons). -** -** For more details regarding locking, see buffers.h in the GL core -*/ -struct __GLdrawableBufferRec { - /* - ** Buffer dimensions - */ - GLint width, height, depth; - - /* - ** Framebuffer base address - */ - void *base; - - /* - ** Framebuffer size (in bytes) - */ - GLuint size; - - /* - ** Size (in bytes) of each element in the framebuffer - */ - GLuint elementSize; - GLuint elementSizeLog2; - - /* - ** Element skip from one scanline to the next. - ** If the buffer is part of another buffer (for example, fullscreen - ** front buffer), outerWidth is the width of that buffer. - */ - GLint outerWidth; - - /* - ** outerWidth * elementSize - */ - GLint byteWidth; - - /* - ** Allocation/deallocation is done based on this handle. A handle - ** is conceptually different from the framebuffer 'base'. - */ - void *handle; - - /* imported */ - GLboolean (*resize)(__GLdrawableBuffer *buf, - GLint x, GLint y, GLuint width, GLuint height, - __GLdrawablePrivate *glPriv, GLuint bufferMask); - void (*lock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); - void (*unlock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); - void (*fill)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, - GLuint val, GLint x, GLint y, GLint w, GLint h); - void (*free)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); - - /* exported */ - void (*freePrivate)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); -#ifdef __cplusplus - void *privatePtr; -#else - void *private; -#endif - - /* private */ - void *other; /* implementation private data */ - __GLbufMainInitFn mainInit; - __GLbufFallbackInitFn fallbackInit; -}; - -/* -** The context side of the drawable private -*/ -struct __GLdrawablePrivateRec { - /* - ** Drawable Modes - */ - __GLcontextModes *modes; - - /* - ** Drawable size - */ - GLuint width, height; - - /* - ** Origin in screen coordinates of the drawable - */ - GLint xOrigin, yOrigin; -#ifdef __GL_ALIGNED_BUFFERS - /* - ** Drawable offset from screen origin - */ - GLint xOffset, yOffset; - - /* - ** Alignment restriction - */ - GLint xAlignment, yAlignment; -#endif - /* - ** Should we invert the y axis? - */ - GLint yInverted; - - /* - ** Mask specifying which buffers are renderable by the hw - */ - GLuint accelBufferMask; - - /* - ** the buffers themselves - */ - __GLdrawableBuffer frontBuffer; - __GLdrawableBuffer backBuffer; - __GLdrawableBuffer accumBuffer; - __GLdrawableBuffer depthBuffer; - __GLdrawableBuffer stencilBuffer; -#if defined(__GL_NUMBER_OF_AUX_BUFFERS) && (__GL_NUMBER_OF_AUX_BUFFERS > 0) - __GLdrawableBuffer *auxBuffer; -#endif - - __GLdrawableRegion ownershipRegion; - - /* - ** Lock for the drawable private structure - */ - void *lock; -#ifdef DEBUG - /* lock debugging info */ - int lockRefCount; - int lockLine[10]; - char *lockFile[10]; -#endif - - /* imported */ - void *(*malloc)(size_t size); - void *(*calloc)(size_t numElem, size_t elemSize); - void *(*realloc)(void *oldAddr, size_t newSize); - void (*free)(void *addr); - - GLboolean (*addSwapRect)(__GLdrawablePrivate *glPriv, - GLint x, GLint y, GLsizei width, GLsizei height); - void (*setClipRect)(__GLdrawablePrivate *glPriv, - GLint x, GLint y, GLsizei width, GLsizei height); - void (*updateClipRegion)(__GLdrawablePrivate *glPriv); - GLboolean (*resize)(__GLdrawablePrivate *glPriv); - void (*getDrawableSize)(__GLdrawablePrivate *glPriv, - GLint *x, GLint *y, GLuint *width, GLuint *height); - - void (*lockDP)(__GLdrawablePrivate *glPriv, __GLcontext *gc); - void (*unlockDP)(__GLdrawablePrivate *glPriv); - - /* exported */ -#ifdef __cplusplus - void *privatePtr; -#else - void *private; -#endif - void (*freePrivate)(__GLdrawablePrivate *); - - /* client data */ - void *other; -}; - -/* -** Macros to lock/unlock the drawable private -*/ -#if defined(DEBUG) -#define __GL_LOCK_DP(glPriv,gc) \ - (*(glPriv)->lockDP)(glPriv,gc); \ - (glPriv)->lockLine[(glPriv)->lockRefCount] = __LINE__; \ - (glPriv)->lockFile[(glPriv)->lockRefCount] = __FILE__; \ - (glPriv)->lockRefCount++ -#define __GL_UNLOCK_DP(glPriv) \ - (glPriv)->lockRefCount--; \ - (glPriv)->lockLine[(glPriv)->lockRefCount] = 0; \ - (glPriv)->lockFile[(glPriv)->lockRefCount] = NULL; \ - (*(glPriv)->unlockDP)(glPriv) -#else /* DEBUG */ -#define __GL_LOCK_DP(glPriv,gc) (*(glPriv)->lockDP)(glPriv,gc) -#define __GL_UNLOCK_DP(glPriv) (*(glPriv)->unlockDP)(glPriv) -#endif /* DEBUG */ - - -/* -** Procedures which are imported by the GL from the surrounding -** "operating system". Math functions are not considered part of the -** "operating system". -*/ -typedef struct __GLimportsRec { - /* Memory management */ - void * (*malloc)(__GLcontext *gc, size_t size); - void *(*calloc)(__GLcontext *gc, size_t numElem, size_t elemSize); - void *(*realloc)(__GLcontext *gc, void *oldAddr, size_t newSize); - void (*free)(__GLcontext *gc, void *addr); - - /* Error handling */ - void (*warning)(__GLcontext *gc, char *fmt); - void (*fatal)(__GLcontext *gc, char *fmt); - - /* other system calls */ - char *(CAPI *getenv)(__GLcontext *gc, const char *var); - int (CAPI *atoi)(__GLcontext *gc, const char *str); - int (CAPI *sprintf)(__GLcontext *gc, char *str, const char *fmt, ...); - void *(CAPI *fopen)(__GLcontext *gc, const char *path, const char *mode); - int (CAPI *fclose)(__GLcontext *gc, void *stream); - int (CAPI *fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...); - - /* Drawing surface management */ - __GLdrawablePrivate *(*getDrawablePrivate)(__GLcontext *gc); - __GLdrawablePrivate *(*getReadablePrivate)(__GLcontext *gc); - - /* Operating system dependent data goes here */ - void *other; -} __GLimports; - -/************************************************************************/ - -/* -** Procedures which are exported by the GL to the surrounding "operating -** system" so that it can manage multiple GL context's. -*/ -typedef struct __GLexportsRec { - /* Context management (return GL_FALSE on failure) */ - GLboolean (*destroyContext)(__GLcontext *gc); - GLboolean (*loseCurrent)(__GLcontext *gc); - /* oldglPriv isn't used anymore, kept for backwards compatibility */ - GLboolean (*makeCurrent)(__GLcontext *gc); - GLboolean (*shareContext)(__GLcontext *gc, __GLcontext *gcShare); - GLboolean (*copyContext)(__GLcontext *dst, const __GLcontext *src, GLuint mask); - GLboolean (*forceCurrent)(__GLcontext *gc); - - /* Drawing surface notification callbacks */ - GLboolean (*notifyResize)(__GLcontext *gc); - void (*notifyDestroy)(__GLcontext *gc); - void (*notifySwapBuffers)(__GLcontext *gc); - - /* Dispatch table override control for external agents like libGLS */ - struct __GLdispatchStateRec* (*dispatchExec)(__GLcontext *gc); - void (*beginDispatchOverride)(__GLcontext *gc); - void (*endDispatchOverride)(__GLcontext *gc); -} __GLexports; - -/************************************************************************/ - -/* -** This must be the first member of a __GLcontext structure. This is the -** only part of a context that is exposed to the outside world; everything -** else is opaque. -*/ -struct __GLinterfaceRec { - __GLimports imports; - __GLexports exports; -}; - -extern __GLcontext *__glCoreCreateContext(__GLimports *, __GLcontextModes *); -extern void __glCoreNopDispatch(void); - #endif /* __gl_core_h_ */ Modified: haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp =================================================================== --- haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp 2007-06-08 23:00:44 UTC (rev 21351) @@ -21,7 +21,6 @@ #include extern "C" { -#include "array_cache/acache.h" #include "extensions.h" #include "drivers/common/driverfuncs.h" #include "main/colormac.h" @@ -35,6 +34,7 @@ #include "tnl/tnl.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" +#include "vbo/vbo.h" #if defined(USE_X86_ASM) @@ -55,11 +55,6 @@ #define BE_BCOMP 0 #define BE_ACOMP 3 -#define PACK_B_RGBA32(color) (color[BCOMP] | (color[GCOMP] << 8) | \ - (color[RCOMP] << 16) | (color[ACOMP] << 24)) - -#define PACK_B_RGB32(color) (color[BCOMP] | (color[GCOMP] << 8) | \ - (color[RCOMP] << 16) | 0xFF000000) #else // Big Endian B_RGBA32 bitmap format #define BE_RCOMP 1 @@ -67,11 +62,6 @@ #define BE_BCOMP 3 #define BE_ACOMP 0 -#define PACK_B_RGBA32(color) (color[ACOMP] | (color[RCOMP] << 8) | \ - (color[GCOMP] << 16) | (color[BCOMP] << 24)) - -#define PACK_B_RGB32(color) ((color[RCOMP] << 8) | (color[GCOMP] << 16) | \ - (color[BCOMP] << 24) | 0xFF000000) #endif /**********************************************************************/ @@ -213,7 +203,7 @@ /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext(fContext); - _ac_CreateContext(fContext); + _vbo_CreateContext(fContext); _tnl_CreateContext(fContext); _swsetup_CreateContext(fContext); _swsetup_Wakeup(fContext); @@ -310,7 +300,7 @@ fRenderBuffer->PutMonoValues = put_mono_values_RGB16; break; default: - fprintf(stderr, "unsupported screen color space %ld\n", cs); + fprintf(stderr, "unsupported screen color space %d\n", cs); debugger("unsupported OpenGL color space"); break; } @@ -347,9 +337,12 @@ MesaSoftwareRenderer::SwapBuffers(bool VSync) { CALLED(); - _mesa_notifySwapBuffers(fContext); - + + if (fBitmap) { + if (fVisual->doubleBufferMode) + _mesa_notifySwapBuffers(fContext); + if (!fDirectModeEnabled || fInfo == NULL) { GLView()->LockLooper(); GLView()->DrawBitmap(fBitmap); @@ -627,7 +620,7 @@ CALLED(); _swrast_InvalidateState(ctx, new_state); _swsetup_InvalidateState(ctx, new_state); - _ac_InvalidateState(ctx, new_state); + _vbo_InvalidateState(ctx, new_state); _tnl_InvalidateState(ctx, new_state); } @@ -636,6 +629,8 @@ MesaSoftwareRenderer::RenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *render, GLenum internalFormat, GLuint width, GLuint height) { + render->Width = width; + render->Height = height; return GL_TRUE; } @@ -652,3 +647,4 @@ { fInfo = info; } + Modified: haiku/trunk/src/kits/opengl/mesa/Jamfile =================================================================== --- haiku/trunk/src/kits/opengl/mesa/Jamfile 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/src/kits/opengl/mesa/Jamfile 2007-06-08 23:00:44 UTC (rev 21351) @@ -21,8 +21,8 @@ UseHeaders [ FDirName $(SUBDIR) shader slang ] ; UseHeaders [ FDirName $(SUBDIR) swrast ] ; UseHeaders [ FDirName $(SUBDIR) swrast_setup ] ; +UseHeaders [ FDirName $(SUBDIR) vbo ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) array_cache ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) drivers common ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) glapi ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) main ] ; @@ -33,6 +33,7 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) swrast ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) swrast_setup ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) tnl ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) vbo ] ; { local defines ; @@ -83,12 +84,7 @@ read_rgba_span_x86.S t_vertex_sse.c - t_vb_arbprogram_sse.c - t_vtx_x86.c - t_vtx_x86_gcc.S - slang_execute_x86.c - x86sse.c ; @@ -158,12 +154,13 @@ lines.c matrix.c mipmap.c - occlude.c pixel.c points.c polygon.c + queryobj.c rastpos.c renderbuffer.c + shaders.c state.c stencil.c texcompress.c @@ -189,20 +186,10 @@ m_vector.c m_xform.c - # array_cache - ac_context.c - ac_import.c - # tnl - t_array_api.c - t_array_import.c t_context.c + t_draw.c t_pipeline.c - t_save_api.c - t_save_loopback.c - t_save_playback.c - t_vb_arbprogram.c - t_vb_arbshader.c t_vb_cull.c t_vb_fog.c t_vb_light.c @@ -216,17 +203,12 @@ t_vp_build.c t_vertex.c t_vertex_generic.c - t_vtx_api.c - t_vtx_generic.c - t_vtx_eval.c - t_vtx_exec.c # swrast s_aaline.c s_aatriangle.c s_accum.c s_alpha.c - s_arbshader.c s_atifragshader.c s_bitmap.c s_blend.c @@ -238,11 +220,11 @@ s_drawpix.c s_feedback.c s_fog.c + s_fragprog.c s_imaging.c s_lines.c s_logic.c s_masking.c - s_nvfragprog.c s_points.c s_readpix.c s_span.c @@ -263,36 +245,57 @@ atifragshader.c nvfragparse.c nvprogram.c - nvvertexec.c nvvertparse.c + prog_execute.c + prog_instruction.c + prog_parameter.c + prog_print.c + prog_statevars.c program.c - shaderobjects.c - shaderobjects_3dlabs.c + shader_api.c # shader/grammar grammar_mesa.c # shader/slang - slang_analyse.c - slang_assemble.c - slang_assemble_assignment.c - slang_assemble_conditional.c - slang_assemble_constructor.c - slang_assemble_typeinfo.c + slang_builtin.c + slang_codegen.c slang_compile.c slang_compile_function.c slang_compile_operation.c slang_compile_struct.c slang_compile_variable.c - slang_execute.c - slang_export.c + slang_emit.c + slang_ir.c + slang_label.c slang_library_noise.c - slang_library_texsample.c slang_link.c + slang_log.c + slang_mem.c slang_preprocess.c + slang_print.c + slang_simplify.c slang_storage.c + slang_typeinfo.c slang_utility.c + slang_vartable.c + # vbo + vbo_context.c + vbo_exec.c + vbo_exec_api.c + vbo_exec_array.c + vbo_exec_draw.c + vbo_exec_eval.c + vbo_rebase.c + vbo_save.c + vbo_save_api.c + vbo_save_draw.c + vbo_save_loopback.c + vbo_split.c + vbo_split_copy.c + vbo_split_inplace.c + $(arch_sources) # glapi Deleted: haiku/trunk/src/kits/opengl/mesa/array_cache/ac_context.c Deleted: haiku/trunk/src/kits/opengl/mesa/array_cache/ac_context.h Deleted: haiku/trunk/src/kits/opengl/mesa/array_cache/ac_import.c Deleted: haiku/trunk/src/kits/opengl/mesa/array_cache/acache.h Modified: haiku/trunk/src/kits/opengl/mesa/drivers/common/driverfuncs.c =================================================================== --- haiku/trunk/src/kits/opengl/mesa/drivers/common/driverfuncs.c 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/src/kits/opengl/mesa/drivers/common/driverfuncs.c 2007-06-08 23:00:44 UTC (rev 21351) @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.3 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -28,8 +28,9 @@ #include "buffers.h" #include "context.h" #include "framebuffer.h" -#include "occlude.h" #include "program.h" +#include "prog_execute.h" +#include "queryobj.h" #include "renderbuffer.h" #include "texcompress.h" #include "texformat.h" @@ -43,6 +44,7 @@ #include "fbobject.h" #include "texrender.h" #endif +#include "shader_api.h" #include "arrayobj.h" #include "driverfuncs.h" @@ -127,7 +129,7 @@ driver->NewProgram = _mesa_new_program; driver->DeleteProgram = _mesa_delete_program; #if FEATURE_MESA_program_debug - driver->GetFragmentProgramRegister = _swrast_get_program_register; + driver->GetProgramRegister = _mesa_get_program_register; #endif /* FEATURE_MESA_program_debug */ /* simple state commands */ @@ -248,4 +250,45 @@ driver->EndList = NULL; driver->BeginCallList = NULL; driver->EndCallList = NULL; + + + /* XXX temporary here */ + _mesa_init_glsl_driver_functions(driver); } + + +/** + * Plug in Mesa's GLSL functions. + */ +void +_mesa_init_glsl_driver_functions(struct dd_function_table *driver) +{ + driver->AttachShader = _mesa_attach_shader; + driver->BindAttribLocation = _mesa_bind_attrib_location; + driver->CompileShader = _mesa_compile_shader; + driver->CreateProgram = _mesa_create_program; + driver->CreateShader = _mesa_create_shader; + driver->DeleteProgram2 = _mesa_delete_program2; + driver->DeleteShader = _mesa_delete_shader; + driver->DetachShader = _mesa_detach_shader; + driver->GetActiveAttrib = _mesa_get_active_attrib; + driver->GetActiveUniform = _mesa_get_active_uniform; + driver->GetAttachedShaders = _mesa_get_attached_shaders; + driver->GetAttribLocation = _mesa_get_attrib_location; + driver->GetHandle = _mesa_get_handle; + driver->GetProgramiv = _mesa_get_programiv; + driver->GetProgramInfoLog = _mesa_get_program_info_log; + driver->GetShaderiv = _mesa_get_shaderiv; + driver->GetShaderInfoLog = _mesa_get_shader_info_log; + driver->GetShaderSource = _mesa_get_shader_source; + driver->GetUniformfv = _mesa_get_uniformfv; + driver->GetUniformLocation = _mesa_get_uniform_location; + driver->IsProgram = _mesa_is_program; + driver->IsShader = _mesa_is_shader; + driver->LinkProgram = _mesa_link_program; + driver->ShaderSource = _mesa_shader_source; + driver->Uniform = _mesa_uniform; + driver->UniformMatrix = _mesa_uniform_matrix; + driver->UseProgram = _mesa_use_program; + driver->ValidateProgram = _mesa_validate_program; +} Modified: haiku/trunk/src/kits/opengl/mesa/drivers/common/driverfuncs.h =================================================================== --- haiku/trunk/src/kits/opengl/mesa/drivers/common/driverfuncs.h 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/src/kits/opengl/mesa/drivers/common/driverfuncs.h 2007-06-08 23:00:44 UTC (rev 21351) @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.1 + * Version: 6.5.3 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -29,4 +29,8 @@ extern void _mesa_init_driver_functions(struct dd_function_table *driver); + +extern void +_mesa_init_glsl_driver_functions(struct dd_function_table *driver); + #endif Modified: haiku/trunk/src/kits/opengl/mesa/glapi/glapi.c =================================================================== --- haiku/trunk/src/kits/opengl/mesa/glapi/glapi.c 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/src/kits/opengl/mesa/glapi/glapi.c 2007-06-08 23:00:44 UTC (rev 21351) @@ -240,6 +240,7 @@ else if (knownID != _glthread_GetID()) { ThreadSafe = GL_TRUE; _glapi_set_dispatch(NULL); + _glapi_set_context(NULL); } } else if (!_glapi_get_dispatch()) { @@ -1003,7 +1004,6 @@ GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *); assert(secondaryColor3fOffset == _gloffset_SecondaryColor3fEXT); assert(secondaryColor3fOffset == offset); - assert(_glapi_get_proc_address("glSecondaryColor3fEXT") == (_glapi_proc) &glSecondaryColor3fEXT); } { GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV"); @@ -1011,7 +1011,6 @@ GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *); assert(pointParameterivOffset == _gloffset_PointParameterivNV); assert(pointParameterivOffset == offset); - assert(_glapi_get_proc_address("glPointParameterivNV") == (_glapi_proc) &glPointParameterivNV); } { GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV"); Modified: haiku/trunk/src/kits/opengl/mesa/glapi/glapitable.h =================================================================== --- haiku/trunk/src/kits/opengl/mesa/glapi/glapitable.h 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/src/kits/opengl/mesa/glapi/glapitable.h 2007-06-08 23:00:44 UTC (rev 21351) @@ -30,7 +30,11 @@ # define _GLAPI_TABLE_H_ #ifndef GLAPIENTRYP -#define GLAPIENTRYP +# ifndef GLAPIENTRY +# define GLAPIENTRY +# endif + +# define GLAPIENTRYP GLAPIENTRY * #endif typedef void (*_glapi_proc)(void); /* generic function pointer */ @@ -704,7 +708,7 @@ void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 664 */ void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 665 */ void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 666 */ - void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** params); /* 667 */ + void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 667 */ void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 668 */ void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 669 */ void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 670 */ Modified: haiku/trunk/src/kits/opengl/mesa/glapi/glapitemp.h =================================================================== --- haiku/trunk/src/kits/opengl/mesa/glapi/glapitemp.h 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/src/kits/opengl/mesa/glapi/glapitemp.h 2007-06-08 23:00:44 UTC (rev 21351) @@ -4865,16 +4865,21 @@ DISPATCH(GetTrackMatrixivNV, (target, address, pname, params), (F, "glGetTrackMatrixivNV(0x%x, %d, 0x%x, %p);\n", target, address, pname, (const void *) params)); } -KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointervARB)(GLuint index, GLenum pname, GLvoid ** params) +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid ** pointer) { - DISPATCH(GetVertexAttribPointervNV, (index, pname, params), (F, "glGetVertexAttribPointervARB(%d, 0x%x, %p);\n", index, pname, (const void *) params)); + DISPATCH(GetVertexAttribPointervNV, (index, pname, pointer), (F, "glGetVertexAttribPointerv(%d, 0x%x, %p);\n", index, pname, (const void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** params) +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointervARB)(GLuint index, GLenum pname, GLvoid ** pointer) { - DISPATCH(GetVertexAttribPointervNV, (index, pname, params), (F, "glGetVertexAttribPointervNV(%d, 0x%x, %p);\n", index, pname, (const void *) params)); + DISPATCH(GetVertexAttribPointervNV, (index, pname, pointer), (F, "glGetVertexAttribPointervARB(%d, 0x%x, %p);\n", index, pname, (const void *) pointer)); } +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer) +{ + DISPATCH(GetVertexAttribPointervNV, (index, pname, pointer), (F, "glGetVertexAttribPointervNV(%d, 0x%x, %p);\n", index, pname, (const void *) pointer)); +} + KEYWORD1 void KEYWORD2 NAME(GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params) { DISPATCH(GetVertexAttribdvNV, (index, pname, params), (F, "glGetVertexAttribdvNV(%d, 0x%x, %p);\n", index, pname, (const void *) params)); @@ -6577,6 +6582,7 @@ TABLE_ENTRY(BindProgramARB), TABLE_ENTRY(DeleteProgramsARB), TABLE_ENTRY(GenProgramsARB), + TABLE_ENTRY(GetVertexAttribPointerv), TABLE_ENTRY(GetVertexAttribPointervARB), TABLE_ENTRY(IsProgramARB), TABLE_ENTRY(PointParameteri), Modified: haiku/trunk/src/kits/opengl/mesa/glapi/glprocs.h =================================================================== --- haiku/trunk/src/kits/opengl/mesa/glapi/glprocs.h 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/src/kits/opengl/mesa/glapi/glprocs.h 2007-06-08 23:00:44 UTC (rev 21351) @@ -1086,6 +1086,7 @@ "glBindProgramARB\0" "glDeleteProgramsARB\0" "glGenProgramsARB\0" + "glGetVertexAttribPointerv\0" "glGetVertexAttribPointervARB\0" "glIsProgramARB\0" "glPointParameteri\0" @@ -2229,11 +2230,12 @@ NAME_FUNC_OFFSET(18432, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), NAME_FUNC_OFFSET(18452, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), NAME_FUNC_OFFSET(18469, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18498, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(18513, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(18531, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(18550, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(18574, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(18495, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18524, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(18539, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(18557, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(18576, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(18600, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; Modified: haiku/trunk/src/kits/opengl/mesa/main/api_loopback.c =================================================================== --- haiku/trunk/src/kits/opengl/mesa/main/api_loopback.c 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/src/kits/opengl/mesa/main/api_loopback.c 2007-06-08 23:00:44 UTC (rev 21351) @@ -146,7 +146,7 @@ loopback_Color3iv_f( const GLint *v ) { COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), - INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); + INT_TO_FLOAT(v[2]), 1.0 ); } static void GLAPIENTRY Modified: haiku/trunk/src/kits/opengl/mesa/main/api_noop.c =================================================================== --- haiku/trunk/src/kits/opengl/mesa/main/api_noop.c 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/src/kits/opengl/mesa/main/api_noop.c 2007-06-08 23:00:44 UTC (rev 21351) @@ -45,7 +45,7 @@ static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b ) { GET_CURRENT_CONTEXT(ctx); - ctx->Current.EdgeFlag = b; + ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] = (GLfloat)b; } static void GLAPIENTRY _mesa_noop_Indexf( GLfloat f ) Modified: haiku/trunk/src/kits/opengl/mesa/main/arrayobj.c =================================================================== --- haiku/trunk/src/kits/opengl/mesa/main/arrayobj.c 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/src/kits/opengl/mesa/main/arrayobj.c 2007-06-08 23:00:44 UTC (rev 21351) @@ -114,40 +114,34 @@ obj->Vertex.StrideB = 0; obj->Vertex.Ptr = NULL; obj->Vertex.Enabled = GL_FALSE; - obj->Vertex.Flags = CA_CLIENT_DATA; obj->Normal.Type = GL_FLOAT; obj->Normal.Stride = 0; obj->Normal.StrideB = 0; obj->Normal.Ptr = NULL; obj->Normal.Enabled = GL_FALSE; - obj->Normal.Flags = CA_CLIENT_DATA; obj->Color.Size = 4; obj->Color.Type = GL_FLOAT; obj->Color.Stride = 0; obj->Color.StrideB = 0; obj->Color.Ptr = NULL; obj->Color.Enabled = GL_FALSE; - obj->Color.Flags = CA_CLIENT_DATA; obj->SecondaryColor.Size = 4; obj->SecondaryColor.Type = GL_FLOAT; obj->SecondaryColor.Stride = 0; obj->SecondaryColor.StrideB = 0; obj->SecondaryColor.Ptr = NULL; obj->SecondaryColor.Enabled = GL_FALSE; - obj->SecondaryColor.Flags = CA_CLIENT_DATA; obj->FogCoord.Size = 1; obj->FogCoord.Type = GL_FLOAT; obj->FogCoord.Stride = 0; obj->FogCoord.StrideB = 0; obj->FogCoord.Ptr = NULL; obj->FogCoord.Enabled = GL_FALSE; - obj->FogCoord.Flags = CA_CLIENT_DATA; obj->Index.Type = GL_FLOAT; obj->Index.Stride = 0; obj->Index.StrideB = 0; obj->Index.Ptr = NULL; obj->Index.Enabled = GL_FALSE; - obj->Index.Flags = CA_CLIENT_DATA; for (i = 0; i < MAX_TEXTURE_UNITS; i++) { obj->TexCoord[i].Size = 4; obj->TexCoord[i].Type = GL_FLOAT; @@ -155,13 +149,11 @@ obj->TexCoord[i].StrideB = 0; obj->TexCoord[i].Ptr = NULL; obj->TexCoord[i].Enabled = GL_FALSE; - obj->TexCoord[i].Flags = CA_CLIENT_DATA; } obj->EdgeFlag.Stride = 0; obj->EdgeFlag.StrideB = 0; obj->EdgeFlag.Ptr = NULL; obj->EdgeFlag.Enabled = GL_FALSE; - obj->EdgeFlag.Flags = CA_CLIENT_DATA; for (i = 0; i < VERT_ATTRIB_MAX; i++) { obj->VertexAttrib[i].Size = 4; obj->VertexAttrib[i].Type = GL_FLOAT; @@ -170,7 +162,6 @@ obj->VertexAttrib[i].Ptr = NULL; obj->VertexAttrib[i].Enabled = GL_FALSE; obj->VertexAttrib[i].Normalized = GL_FALSE; - obj->VertexAttrib[i].Flags = CA_CLIENT_DATA; } #if FEATURE_ARB_vertex_buffer_object Modified: haiku/trunk/src/kits/opengl/mesa/main/attrib.c =================================================================== --- haiku/trunk/src/kits/opengl/mesa/main/attrib.c 2007-06-08 18:33:02 UTC (rev 21350) +++ haiku/trunk/src/kits/opengl/mesa/main/attrib.c 2007-06-08 23:00:44 UTC (rev 21351) @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 6.5.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -138,9 +138,9 @@ attr->Blend = ctx->Color.BlendEnabled; attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled; attr->ColorMaterial = ctx->Light.ColorMaterialEnabled; - attr->ColorTable = ctx->Pixel.ColorTableEnabled; - attr->PostColorMatrixColorTable = ctx->Pixel.PostColorMatrixColorTableEnabled; - attr->PostConvolutionColorTable = ctx->Pixel.PostConvolutionColorTableEnabled; [... truncated: 54888 lines follow ...] From korli at mail.berlios.de Sat Jun 9 01:02:28 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 9 Jun 2007 01:02:28 +0200 Subject: [Haiku-commits] r21352 - haiku/trunk/headers/os/opengl/GL Message-ID: <200706082302.l58N2SSq005945@sheep.berlios.de> Author: korli Date: 2007-06-09 01:02:21 +0200 (Sat, 09 Jun 2007) New Revision: 21352 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21352&view=rev Modified: haiku/trunk/headers/os/opengl/GL/glext.h Log: forgot this one (part of mesa 6.5.3) Modified: haiku/trunk/headers/os/opengl/GL/glext.h =================================================================== --- haiku/trunk/headers/os/opengl/GL/glext.h 2007-06-08 23:00:44 UTC (rev 21351) +++ haiku/trunk/headers/os/opengl/GL/glext.h 2007-06-08 23:02:21 UTC (rev 21352) @@ -6,32 +6,26 @@ #endif /* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** Copyright (c) 2007 The Khronos Group Inc. ** -** http://oss.sgi.com/projects/FreeB +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: ** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. ** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: This software was created using the -** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has -** not been independently verified as being compliant with the OpenGL(R) -** version 1.2.1 Specification. +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) @@ -52,9 +46,9 @@ /*************************************************************/ /* Header file version number, required by OpenGL ABI for Linux */ -/* glext.h last updated 2006/08/30 */ +/* glext.h last updated 2007/02/12 */ /* Current version at http://www.opengl.org/registry/ */ -#define GL_GLEXT_VERSION 34 +#define GL_GLEXT_VERSION 39 #ifndef GL_VERSION_1_2 #define GL_UNSIGNED_BYTE_3_3_2 0x8032 @@ -3019,7 +3013,6 @@ #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB @@ -3104,6 +3097,8 @@ #ifndef GL_EXT_framebuffer_multisample #define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 #endif #ifndef GL_MESAX_texture_stack @@ -3122,7 +3117,269 @@ #ifndef GL_EXT_gpu_program_parameters #endif +#ifndef GL_APPLE_flush_buffer_range +#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 +#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 +#endif +#ifndef GL_NV_gpu_program4 +#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 +#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 +#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 +#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 +#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 +#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 +#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 +#endif + +#ifndef GL_NV_geometry_program4 +#define GL_LINES_ADJACENCY_EXT 0x000A +#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B +#define GL_TRIANGLES_ADJACENCY_EXT 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D +#define GL_GEOMETRY_PROGRAM_NV 0x8C26 +#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 +#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 +#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA +#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB +#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 +#define GL_PROGRAM_POINT_SIZE_EXT 0x8642 +#endif + +#ifndef GL_EXT_geometry_shader4 +#define GL_GEOMETRY_SHADER_EXT 0x8DD9 +/* reuse GL_GEOMETRY_VERTICES_OUT_EXT */ +/* reuse GL_GEOMETRY_INPUT_TYPE_EXT */ +/* reuse GL_GEOMETRY_OUTPUT_TYPE_EXT */ +/* reuse GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT */ +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD +#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE +#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 +/* reuse GL_LINES_ADJACENCY_EXT */ +/* reuse GL_LINE_STRIP_ADJACENCY_EXT */ +/* reuse GL_TRIANGLES_ADJACENCY_EXT */ +/* reuse GL_TRIANGLE_STRIP_ADJACENCY_EXT */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ +/* reuse GL_PROGRAM_POINT_SIZE_EXT */ +#endif + +#ifndef GL_NV_vertex_program4 +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD +#endif + +#ifndef GL_EXT_gpu_shader4 +#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 +#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 +#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 +#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 +#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 +#define GL_INT_SAMPLER_1D_EXT 0x8DC9 +#define GL_INT_SAMPLER_2D_EXT 0x8DCA +#define GL_INT_SAMPLER_3D_EXT 0x8DCB +#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC +#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD +#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 +#endif + +#ifndef GL_EXT_draw_instanced +#endif + +#ifndef GL_EXT_packed_float +#define GL_R11F_G11F_B10F_EXT 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B +#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C +#endif + +#ifndef GL_EXT_texture_array +#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 +#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D +#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF +#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ +#endif + +#ifndef GL_EXT_texture_buffer_object +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E +#endif + +#ifndef GL_EXT_texture_compression_latc +#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 +#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 +#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 +#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 +#endif + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE +#endif + +#ifndef GL_EXT_texture_shared_exponent +#define GL_RGB9_E5_EXT 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E +#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F +#endif + +#ifndef GL_NV_depth_buffer_float +#define GL_DEPTH_COMPONENT32F_NV 0x8DAB +#define GL_DEPTH32F_STENCIL8_NV 0x8DAC +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD +#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF +#endif + +#ifndef GL_NV_fragment_program4 +#endif + +#ifndef GL_NV_framebuffer_multisample_coverage +#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB +#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 +#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 +#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 +#endif + +#ifndef GL_EXT_framebuffer_sRGB +#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 +#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA +#endif + +#ifndef GL_NV_geometry_shader4 +#endif + +#ifndef GL_NV_parameter_buffer_object +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 +#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 +#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 +#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 +#endif + +#ifndef GL_EXT_draw_buffers2 +#endif + +#ifndef GL_NV_transform_feedback +#define GL_BACK_PRIMARY_COLOR_NV 0x8C77 +#define GL_BACK_SECONDARY_COLOR_NV 0x8C78 +#define GL_TEXTURE_COORD_NV 0x8C79 +#define GL_CLIP_DISTANCE_NV 0x8C7A +#define GL_VERTEX_ID_NV 0x8C7B +#define GL_PRIMITIVE_ID_NV 0x8C7C +#define GL_GENERIC_ATTRIB_NV 0x8C7D +#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 +#define GL_ACTIVE_VARYINGS_NV 0x8C81 +#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 +#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 +#define GL_PRIMITIVES_GENERATED_NV 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 +#define GL_RASTERIZER_DISCARD_NV 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B +#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C +#define GL_SEPARATE_ATTRIBS_NV 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F +#endif + +#ifndef GL_EXT_bindable_uniform +#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 +#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 +#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 +#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED +#define GL_UNIFORM_BUFFER_EXT 0x8DEE +#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF +#endif + +#ifndef GL_EXT_texture_integer +#define GL_RGBA32UI_EXT 0x8D70 +#define GL_RGB32UI_EXT 0x8D71 +#define GL_ALPHA32UI_EXT 0x8D72 +#define GL_INTENSITY32UI_EXT 0x8D73 +#define GL_LUMINANCE32UI_EXT 0x8D74 +#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 +#define GL_RGBA16UI_EXT 0x8D76 +#define GL_RGB16UI_EXT 0x8D77 +#define GL_ALPHA16UI_EXT 0x8D78 +#define GL_INTENSITY16UI_EXT 0x8D79 +#define GL_LUMINANCE16UI_EXT 0x8D7A +#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B +#define GL_RGBA8UI_EXT 0x8D7C +#define GL_RGB8UI_EXT 0x8D7D +#define GL_ALPHA8UI_EXT 0x8D7E +#define GL_INTENSITY8UI_EXT 0x8D7F +#define GL_LUMINANCE8UI_EXT 0x8D80 +#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 +#define GL_RGBA32I_EXT 0x8D82 +#define GL_RGB32I_EXT 0x8D83 +#define GL_ALPHA32I_EXT 0x8D84 +#define GL_INTENSITY32I_EXT 0x8D85 +#define GL_LUMINANCE32I_EXT 0x8D86 +#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 +#define GL_RGBA16I_EXT 0x8D88 +#define GL_RGB16I_EXT 0x8D89 +#define GL_ALPHA16I_EXT 0x8D8A +#define GL_INTENSITY16I_EXT 0x8D8B +#define GL_LUMINANCE16I_EXT 0x8D8C +#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D +#define GL_RGBA8I_EXT 0x8D8E +#define GL_RGB8I_EXT 0x8D8F +#define GL_ALPHA8I_EXT 0x8D90 +#define GL_INTENSITY8I_EXT 0x8D91 +#define GL_LUMINANCE8I_EXT 0x8D92 +#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 +#define GL_RED_INTEGER_EXT 0x8D94 +#define GL_GREEN_INTEGER_EXT 0x8D95 +#define GL_BLUE_INTEGER_EXT 0x8D96 +#define GL_ALPHA_INTEGER_EXT 0x8D97 +#define GL_RGB_INTEGER_EXT 0x8D98 +#define GL_RGBA_INTEGER_EXT 0x8D99 +#define GL_BGR_INTEGER_EXT 0x8D9A +#define GL_BGRA_INTEGER_EXT 0x8D9B +#define GL_LUMINANCE_INTEGER_EXT 0x8D9C +#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D +#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E +#endif + + /*************************************************************/ #include @@ -3162,7 +3419,7 @@ /* This code block is duplicated in glext.h, so must be protected */ #define GLEXT_64_TYPES_DEFINED /* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GLX_OML_sync_control extension). */ +/* (as used in the GL_EXT_timer_query extension). */ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #include #elif defined(__sun__) @@ -3184,12 +3441,12 @@ typedef long int int32_t; typedef long long int int64_t; typedef unsigned long long int uint64_t; -#elif defined(WIN32) && defined(_MSC_VER) -typedef long int int32_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; -#elif defined(WIN32) && defined(__GNUC__) -#include #else #include /* Fallback option */ #endif @@ -6687,7 +6944,315 @@ typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); #endif +#ifndef GL_APPLE_flush_buffer_range +#define GL_APPLE_flush_buffer_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum, GLintptr, GLsizeiptr); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size); +#endif +#ifndef GL_NV_gpu_program4 +#define GL_NV_gpu_program4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum, GLuint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum, GLuint, const GLint *); +GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum, GLuint, GLsizei, const GLint *); +GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum, GLuint, const GLuint *); +GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum, GLuint, GLsizei, const GLuint *); +GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum, GLuint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum, GLuint, const GLint *); +GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum, GLuint, GLsizei, const GLint *); +GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum, GLuint, const GLuint *); +GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum, GLuint, GLsizei, const GLuint *); +GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum, GLuint, GLint *); +GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum, GLuint, GLuint *); +GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum, GLuint, GLint *); +GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum, GLuint, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); +#endif + +#ifndef GL_NV_geometry_program4 +#define GL_NV_geometry_program4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramVertexLimitNV (GLenum, GLint); +GLAPI void APIENTRY glFramebufferTextureEXT (GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum, GLenum, GLuint, GLint, GLint); +GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum, GLenum, GLuint, GLint, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif + +#ifndef GL_EXT_geometry_shader4 +#define GL_EXT_geometry_shader4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramParameteriEXT (GLuint, GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +#endif + +#ifndef GL_NV_vertex_program4 +#define GL_NV_vertex_program4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint, GLint); +GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint, GLint, GLint); +GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint, GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); +#endif + +#ifndef GL_EXT_gpu_shader4 +#define GL_EXT_gpu_shader4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetUniformuivEXT (GLuint, GLint, GLuint *); +GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint, GLuint, const GLchar *); +GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint, const GLchar *); +GLAPI void APIENTRY glUniform1uiEXT (GLint, GLuint); +GLAPI void APIENTRY glUniform2uiEXT (GLint, GLuint, GLuint); +GLAPI void APIENTRY glUniform3uiEXT (GLint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glUniform4uiEXT (GLint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glUniform1uivEXT (GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glUniform2uivEXT (GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glUniform3uivEXT (GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glUniform4uivEXT (GLint, GLsizei, const GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +#endif + +#ifndef GL_EXT_draw_instanced +#define GL_EXT_draw_instanced 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif + +#ifndef GL_EXT_packed_float +#define GL_EXT_packed_float 1 +#endif + +#ifndef GL_EXT_texture_array +#define GL_EXT_texture_array 1 +#endif + +#ifndef GL_EXT_texture_buffer_object +#define GL_EXT_texture_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBufferEXT (GLenum, GLenum, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); +#endif + +#ifndef GL_EXT_texture_compression_latc +#define GL_EXT_texture_compression_latc 1 +#endif + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_EXT_texture_compression_rgtc 1 +#endif + +#ifndef GL_EXT_texture_shared_exponent +#define GL_EXT_texture_shared_exponent 1 +#endif + +#ifndef GL_NV_depth_buffer_float +#define GL_NV_depth_buffer_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthRangedNV (GLdouble, GLdouble); +GLAPI void APIENTRY glClearDepthdNV (GLdouble); +GLAPI void APIENTRY glDepthBoundsdNV (GLdouble, GLdouble); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth); +typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax); +#endif + +#ifndef GL_NV_fragment_program4 +#define GL_NV_fragment_program4 1 +#endif + +#ifndef GL_NV_framebuffer_multisample_coverage +#define GL_NV_framebuffer_multisample_coverage 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +#endif + +#ifndef GL_EXT_framebuffer_sRGB +#define GL_EXT_framebuffer_sRGB 1 +#endif + +#ifndef GL_NV_geometry_shader4 +#define GL_NV_geometry_shader4 1 +#endif + +#ifndef GL_NV_parameter_buffer_object +#define GL_NV_parameter_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum, GLuint, GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum, GLuint, GLuint, GLsizei, const GLint *); +GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum, GLuint, GLuint, GLsizei, const GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params); +#endif + +#ifndef GL_EXT_draw_buffers2 +#define GL_EXT_draw_buffers2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint, GLboolean, GLboolean, GLboolean, GLboolean); +GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum, GLuint, GLboolean *); +GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum, GLuint, GLint *); +GLAPI void APIENTRY glEnableIndexedEXT (GLenum, GLuint); +GLAPI void APIENTRY glDisableIndexedEXT (GLenum, GLuint); +GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data); +typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index); +#endif + +#ifndef GL_NV_transform_feedback +#define GL_NV_transform_feedback 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum); +GLAPI void APIENTRY glEndTransformFeedbackNV (void); +GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint, const GLint *, GLenum); +GLAPI void APIENTRY glBindBufferRangeNV (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr); +GLAPI void APIENTRY glBindBufferOffsetNV (GLenum, GLuint, GLuint, GLintptr); +GLAPI void APIENTRY glBindBufferBaseNV (GLenum, GLuint, GLuint); +GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint, GLsizei, const GLint *, GLenum); +GLAPI void APIENTRY glActiveVaryingNV (GLuint, const GLchar *); +GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint, const GLchar *); +GLAPI void APIENTRY glGetActiveVaryingNV (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint, GLuint, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); +typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location); +#endif + +#ifndef GL_EXT_bindable_uniform +#define GL_EXT_bindable_uniform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniformBufferEXT (GLuint, GLint, GLuint); +GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint, GLint); +GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer); +typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location); +typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location); +#endif + +#ifndef GL_EXT_texture_integer +#define GL_EXT_texture_integer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexParameterIivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glTexParameterIuivEXT (GLenum, GLenum, const GLuint *); +GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum, GLenum, GLuint *); +GLAPI void APIENTRY glClearColorIiEXT (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glClearColorIuiEXT (GLuint, GLuint, GLuint, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha); +typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha); +#endif + + #ifdef __cplusplus } #endif From bonefish at mail.berlios.de Sat Jun 9 01:14:49 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 01:14:49 +0200 Subject: [Haiku-commits] r21353 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200706082314.l58NEnMe023488@sheep.berlios.de> Author: bonefish Date: 2007-06-09 01:14:48 +0200 (Sat, 09 Jun 2007) New Revision: 21353 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21353&view=rev Modified: haiku/trunk/headers/os/interface/LayoutUtils.h haiku/trunk/src/kits/interface/LayoutUtils.cpp Log: * Added FixSizeConstraints() functions, which adjust the elements of a (min, max, preferred) size triple so that they are compatible with each other. * Implemented AlignInFrame(BView*, BRect). Modified: haiku/trunk/headers/os/interface/LayoutUtils.h =================================================================== --- haiku/trunk/headers/os/interface/LayoutUtils.h 2007-06-08 23:02:21 UTC (rev 21352) +++ haiku/trunk/headers/os/interface/LayoutUtils.h 2007-06-08 23:14:48 UTC (rev 21353) @@ -22,6 +22,11 @@ // static float SubtractSizesFloat(float a, float b); static int32 SubtractSizesInt32(int32 a, int32 b); static float SubtractDistances(float a, float b); + + static void FixSizeConstraints(float& min, float& max, + float& preferred); + static void FixSizeConstraints(BSize& min, BSize& max, + BSize& preferred); static BSize ComposeSize(BSize size, BSize layoutSize); static BAlignment ComposeAlignment(BAlignment alignment, Modified: haiku/trunk/src/kits/interface/LayoutUtils.cpp =================================================================== --- haiku/trunk/src/kits/interface/LayoutUtils.cpp 2007-06-08 23:02:21 UTC (rev 21352) +++ haiku/trunk/src/kits/interface/LayoutUtils.cpp 2007-06-08 23:14:48 UTC (rev 21353) @@ -5,7 +5,9 @@ #include +#include + // // AddSizesFloat // float // BLayoutUtils::AddSizesFloat(float a, float b) @@ -24,6 +26,7 @@ // return AddSizesFloat(AddSizesFloat(a, b), c); // } + // AddSizesInt32 int32 BLayoutUtils::AddSizesInt32(int32 a, int32 b) @@ -33,6 +36,7 @@ return a + b; } + // AddSizesInt32 int32 BLayoutUtils::AddSizesInt32(int32 a, int32 b, int32 c) @@ -40,6 +44,7 @@ return AddSizesInt32(AddSizesInt32(a, b), c); } + // AddDistances float BLayoutUtils::AddDistances(float a, float b) @@ -51,6 +56,7 @@ return sum; } + // AddDistances float BLayoutUtils::AddDistances(float a, float b, float c) @@ -58,6 +64,7 @@ return AddDistances(AddDistances(a, b), c); } + // // SubtractSizesFloat // float // BLayoutUtils::SubtractSizesFloat(float a, float b) @@ -67,6 +74,7 @@ // return a - b - 1; // } + // SubtractSizesInt32 int32 BLayoutUtils::SubtractSizesInt32(int32 a, int32 b) @@ -76,6 +84,7 @@ return a - b; } + // SubtractDistances float BLayoutUtils::SubtractDistances(float a, float b) @@ -85,6 +94,29 @@ return a - b - 1; } + +// FixSizeConstraints +void +BLayoutUtils::FixSizeConstraints(float& min, float& max, float& preferred) +{ + if (max < min) + max = min; + if (preferred < min) + preferred = min; + else if (preferred > max) + preferred = max; +} + + +// FixSizeConstraints +void +BLayoutUtils::FixSizeConstraints(BSize& min, BSize& max, BSize& preferred) +{ + FixSizeConstraints(min.width, max.width, preferred.width); + FixSizeConstraints(min.height, max.height, preferred.height); +} + + // ComposeSize BSize BLayoutUtils::ComposeSize(BSize size, BSize layoutSize) @@ -97,6 +129,7 @@ return size; } + // ComposeAlignment BAlignment BLayoutUtils::ComposeAlignment(BAlignment alignment, BAlignment layoutAlignment) @@ -109,6 +142,7 @@ return alignment; } + // AlignInFrame BRect BLayoutUtils::AlignInFrame(BRect frame, BSize maxSize, BAlignment alignment) @@ -130,38 +164,38 @@ return frame; } + // AlignInFrame void BLayoutUtils::AlignInFrame(BView* view, BRect frame) { -// TODO:... -// BSize maxSize = view->MaxSize(); -// BAlignment alignment = view->Alignment(); -// -// if (view->HasHeightForWidth()) { -// // The view has height for width, so we do the horizontal alignment -// // ourselves and restrict the height max constraint respectively. -// -// if (maxSize.width < frame.width -// && alignment.horizontal != B_ALIGN_USE_FULL_WIDTH) { -// frame.x += (int)((frame.width - maxSize.width) -// * alignment.RelativeHorizontal()); -// frame.width = maxSize.width; -// } -// alignment.horizontal = BAlignment.B_ALIGN_USE_FULL_WIDTH; -// -// float minHeight; -// float maxHeight; -// float preferredHeight; -// view->GetHeightForWidth(frame.width, &minHeight, &maxHeight, -// &preferredHeight); -// -// frame.height = max_c(frame.height, info.min); -// maxSize.height = minHeight; -// } -// -// frame = AlignInFrame(frame, maxSize, alignment); -// view->SetLocation(frame.x, frame.y); -// view->SetSize(frame.getSize()); + BSize maxSize = view->MaxSize(); + BAlignment alignment = view->Alignment(); + + if (view->HasHeightForWidth()) { + // The view has height for width, so we do the horizontal alignment + // ourselves and restrict the height max constraint respectively. + + if (maxSize.width < frame.Width() + && alignment.horizontal != B_ALIGN_USE_FULL_WIDTH) { + frame.OffsetBy(floor((frame.Width() - maxSize.width) + * alignment.RelativeHorizontal()), 0); + frame.right = frame.left + maxSize.width; + } + alignment.horizontal = B_ALIGN_USE_FULL_WIDTH; + + float minHeight; + float maxHeight; + float preferredHeight; + view->GetHeightForWidth(frame.Width(), &minHeight, &maxHeight, + &preferredHeight); + + frame.bottom = frame.top + max_c(frame.Height(), minHeight); + maxSize.height = minHeight; + } + + frame = AlignInFrame(frame, maxSize, alignment); + view->MoveTo(frame.LeftTop()); + view->ResizeTo(frame.Size()); } From bonefish at mail.berlios.de Sat Jun 9 01:16:21 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 01:16:21 +0200 Subject: [Haiku-commits] r21354 - haiku/trunk/headers/os/interface Message-ID: <200706082316.l58NGLHc024741@sheep.berlios.de> Author: bonefish Date: 2007-06-09 01:16:20 +0200 (Sat, 09 Jun 2007) New Revision: 21354 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21354&view=rev Modified: haiku/trunk/headers/os/interface/Size.h Log: Added BSize::Set(). BPoint and BRect feature a similar method. Modified: haiku/trunk/headers/os/interface/Size.h =================================================================== --- haiku/trunk/headers/os/interface/Size.h 2007-06-08 23:14:48 UTC (rev 21353) +++ haiku/trunk/headers/os/interface/Size.h 2007-06-08 23:16:20 UTC (rev 21354) @@ -28,6 +28,7 @@ inline float Width() const; inline float Height() const; + inline void Set(float width, float height); inline void SetWidth(float width); inline void SetHeight(float height); @@ -87,6 +88,15 @@ } +// Set +inline void +BSize::Set(float width, float height) +{ + this->width = width; + this->height = height; +} + + // SetWidth inline void BSize::SetWidth(float width) From bonefish at mail.berlios.de Sat Jun 9 01:24:49 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 01:24:49 +0200 Subject: [Haiku-commits] r21355 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200706082324.l58NOnoP006095@sheep.berlios.de> Author: bonefish Date: 2007-06-09 01:24:38 +0200 (Sat, 09 Jun 2007) New Revision: 21355 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21355&view=rev Modified: haiku/trunk/headers/os/interface/View.h haiku/trunk/src/kits/interface/View.cpp Log: * Set the _RESIZE_MASK_ macro to 0xffff. It was the bitwise inverse of the disjunction of all view flags before, and the new layout related flags were missing. I suppose there was not striking reason for previous method. * Made InvalidateLayout() virtual. When implementing layout management directly in a derived class instead of a separate BLayout, one needs to override it to know when to discard cashed layout infos. * Added a ResizeTo(BSize) method. * Avoided ugly multi-line strings in PrintToStream(). Modified: haiku/trunk/headers/os/interface/View.h =================================================================== --- haiku/trunk/headers/os/interface/View.h 2007-06-08 23:16:20 UTC (rev 21354) +++ haiku/trunk/headers/os/interface/View.h 2007-06-08 23:24:38 UTC (rev 21355) @@ -80,9 +80,7 @@ const uint32 B_SUPPORTS_LAYOUT = 0x00100000UL; /* 21 */ const uint32 B_INVALIDATE_AFTER_LAYOUT = 0x00080000UL; /* 20 */ -#define _RESIZE_MASK_ ~(B_FULL_UPDATE_ON_RESIZE | _B_RESERVED1_ | B_WILL_DRAW \ - | B_PULSE_NEEDED | B_NAVIGABLE_JUMP | B_FRAME_EVENTS | B_NAVIGABLE \ - | B_SUBPIXEL_PRECISE | B_DRAW_ON_CHILDREN | B_INPUT_METHOD_AWARE | _B_RESERVED7_) +#define _RESIZE_MASK_ (0xffff) const uint32 _VIEW_TOP_ = 1UL; const uint32 _VIEW_LEFT_ = 2UL; @@ -473,6 +471,7 @@ void MoveTo(float x, float y); void ResizeBy(float dh, float dv); void ResizeTo(float width, float height); + void ResizeTo(BSize size); void ScrollBy(float dh, float dv); void ScrollTo(float x, float y); virtual void ScrollTo(BPoint where); @@ -533,7 +532,7 @@ virtual void SetLayout(BLayout* layout); BLayout* GetLayout() const; - void InvalidateLayout(bool descendants = false); + virtual void InvalidateLayout(bool descendants = false); void EnableLayoutInvalidation(); void DisableLayoutInvalidation(); bool IsLayoutValid() const; @@ -560,7 +559,6 @@ friend class BTabView; friend class BWindow; - virtual void _ReservedView10(); virtual void _ReservedView11(); virtual void _ReservedView12(); virtual void _ReservedView13(); Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2007-06-08 23:16:20 UTC (rev 21354) +++ haiku/trunk/src/kits/interface/View.cpp 2007-06-08 23:24:38 UTC (rev 21355) @@ -3642,6 +3642,13 @@ } +void +BView::ResizeTo(BSize size) +{ + ResizeBy(size.width - fBounds.Width(), size.height - fBounds.Height()); +} + + // #pragma mark - // Inherited Methods (from BHandler) @@ -4843,7 +4850,7 @@ extern "C" void _ReservedView7__5BView() {} extern "C" void _ReservedView8__5BView() {} extern "C" void _ReservedView9__5BView() {} -void BView::_ReservedView10(){} +extern "C" void _ReservedView10__5BView() {} void BView::_ReservedView11(){} void BView::_ReservedView12(){} void BView::_ReservedView13(){} @@ -4871,25 +4878,25 @@ BView::PrintToStream() { printf("BView::PrintToStream()\n"); - printf("\tName: %s\ -\tParent: %s\ -\tFirstChild: %s\ -\tNextSibling: %s\ -\tPrevSibling: %s\ -\tOwner(Window): %s\ -\tToken: %ld\ -\tFlags: %ld\ -\tView origin: (%f,%f)\ -\tView Bounds rectangle: (%f,%f,%f,%f)\ -\tShow level: %d\ -\tTopView?: %s\ -\tBPicture: %s\ -\tVertical Scrollbar %s\ -\tHorizontal Scrollbar %s\ -\tIs Printing?: %s\ -\tShelf?: %s\ -\tEventMask: %ld\ -\tEventOptions: %ld\n", + printf("\tName: %s\n" + "\tParent: %s\n" + "\tFirstChild: %s\n" + "\tNextSibling: %s\n" + "\tPrevSibling: %s\n" + "\tOwner(Window): %s\n" + "\tToken: %ld\n" + "\tFlags: %ld\n" + "\tView origin: (%f,%f)\n" + "\tView Bounds rectangle: (%f,%f,%f,%f)\n" + "\tShow level: %d\n" + "\tTopView?: %s\n" + "\tBPicture: %s\n" + "\tVertical Scrollbar %s\n" + "\tHorizontal Scrollbar %s\n" + "\tIs Printing?: %s\n" + "\tShelf?: %s\n" + "\tEventMask: %ld\n" + "\tEventOptions: %ld\n", Name(), fParent ? fParent->Name() : "NULL", fFirstChild ? fFirstChild->Name() : "NULL", @@ -4910,23 +4917,23 @@ fEventMask, fEventOptions); - printf("\tState status:\ -\t\tLocalCoordianteSystem: (%f,%f)\ -\t\tPenLocation: (%f,%f)\ -\t\tPenSize: %f\ -\t\tHighColor: [%d,%d,%d,%d]\ -\t\tLowColor: [%d,%d,%d,%d]\ -\t\tViewColor: [%d,%d,%d,%d]\ -\t\tPattern: %llx\ -\t\tDrawingMode: %d\ -\t\tLineJoinMode: %d\ -\t\tLineCapMode: %d\ -\t\tMiterLimit: %f\ -\t\tAlphaSource: %d\ -\t\tAlphaFuntion: %d\ -\t\tScale: %f\ -\t\t(Print)FontAliasing: %s\ -\t\tFont Info:\n", + printf("\tState status:\n" + "\t\tLocalCoordianteSystem: (%f,%f)\n" + "\t\tPenLocation: (%f,%f)\n" + "\t\tPenSize: %f\n" + "\t\tHighColor: [%d,%d,%d,%d]\n" + "\t\tLowColor: [%d,%d,%d,%d]\n" + "\t\tViewColor: [%d,%d,%d,%d]\n" + "\t\tPattern: %llx\n" + "\t\tDrawingMode: %d\n" + "\t\tLineJoinMode: %d\n" + "\t\tLineCapMode: %d\n" + "\t\tMiterLimit: %f\n" + "\t\tAlphaSource: %d\n" + "\t\tAlphaFuntion: %d\n" + "\t\tScale: %f\n" + "\t\t(Print)FontAliasing: %s\n" + "\t\tFont Info:\n", fState->origin.x, fState->origin.y, fState->pen_location.x, fState->pen_location.y, fState->pen_size, From bonefish at mail.berlios.de Sat Jun 9 01:40:18 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 01:40:18 +0200 Subject: [Haiku-commits] r21356 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200706082340.l58NeI53015815@sheep.berlios.de> Author: bonefish Date: 2007-06-09 01:40:16 +0200 (Sat, 09 Jun 2007) New Revision: 21356 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21356&view=rev Modified: haiku/trunk/headers/os/interface/Box.h haiku/trunk/src/kits/interface/Box.cpp Log: * Added layout-friendly constructors and implemented Min/Max/PreferredSize(), and DoLayout(). When the B_SUPPORTS_LAYOUT view flag is set (as is by default when using one of the new constructors) the BBox completely manages one true child (the first child that is not the label view). * Centralized the layout related computation in new method _ValidateLayoutData(). The computed infos are cached in a new private LayoutData structure. * GetPreferredSize() was broken in several respects. It does now return the same result as PreferredSize(). If B_SUPPORTS_LAYOUT is not set, these are the sums of the insets induces by the frame and the label. I.e. those values can for instance be added to the child's preferred size to compute the preferred size of the compound. Not sure, if the Haiku-only TopBorderOffset() and InnerFrame() functions still make sense. With layout management they're actually superfluous. Modified: haiku/trunk/headers/os/interface/Box.h =================================================================== --- haiku/trunk/headers/os/interface/Box.h 2007-06-08 23:24:38 UTC (rev 21355) +++ haiku/trunk/headers/os/interface/Box.h 2007-06-08 23:40:16 UTC (rev 21356) @@ -12,10 +12,17 @@ class BBox : public BView { public: BBox(BRect frame, const char *name = NULL, - uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP, + uint32 resizingMode = B_FOLLOW_LEFT + | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, border_style border = B_FANCY_BORDER); + BBox(const char* name, + uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS + | B_NAVIGABLE_JUMP, + border_style border = B_FANCY_BORDER, + BView* child = NULL); + BBox(border_style border, BView* child); virtual ~BBox(); /* Archiving */ @@ -60,7 +67,16 @@ virtual status_t Perform(perform_code d, void* arg); + virtual BSize MinSize(); + virtual BSize MaxSize(); + virtual BSize PreferredSize(); + + virtual void InvalidateLayout(bool descendants = false); + virtual void DoLayout(); + private: + struct LayoutData; + virtual void _ReservedBox1(); virtual void _ReservedBox2(); @@ -71,11 +87,14 @@ void _DrawFancy(BRect labelBox); void _ClearLabel(); + BView* _Child() const; + void _ValidateLayoutData(); + char* fLabel; BRect fBounds; border_style fStyle; BView* fLabelView; - BRect* fLabelBox; + LayoutData* fLayoutData; }; #endif // _BOX_H Modified: haiku/trunk/src/kits/interface/Box.cpp =================================================================== --- haiku/trunk/src/kits/interface/Box.cpp 2007-06-08 23:24:38 UTC (rev 21355) +++ haiku/trunk/src/kits/interface/Box.cpp 2007-06-08 23:40:16 UTC (rev 21356) @@ -11,18 +11,37 @@ #include -#include -#include #include #include #include +#include +#include +#include +#include + +struct BBox::LayoutData { + LayoutData() + : valid(false) + { + } + + BRect label_box; // label box (label string or label view); in case + // of a label string not including descent + BRect insets; // insets induced by border and label + BSize min; + BSize max; + BSize preferred; + bool valid; // validity the other fields +}; + + BBox::BBox(BRect frame, const char *name, uint32 resizingMode, uint32 flags, border_style border) - : BView(frame, name, resizingMode, flags | B_FRAME_EVENTS), - fStyle(border) + : BView(frame, name, resizingMode, flags | B_WILL_DRAW | B_FRAME_EVENTS), + fStyle(border) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -31,6 +50,36 @@ } +BBox::BBox(const char* name, uint32 flags, border_style border, BView* child) + : BView(BRect(0, 0, -1, -1), name, B_FOLLOW_NONE, + flags | B_WILL_DRAW | B_FRAME_EVENTS | B_SUPPORTS_LAYOUT), + fStyle(border) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + _InitObject(); + + if (child) + AddChild(child); +} + + +BBox::BBox(border_style border, BView* child) + : BView(BRect(0, 0, -1, -1), NULL, B_FOLLOW_NONE, + B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP | B_SUPPORTS_LAYOUT), + fStyle(border) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + _InitObject(); + + if (child) + AddChild(child); +} + + BBox::BBox(BMessage *archive) : BView(archive) { @@ -41,6 +90,8 @@ BBox::~BBox() { _ClearLabel(); + + delete fLayoutData; } @@ -75,8 +126,13 @@ void BBox::SetBorder(border_style border) { + if (border == fStyle) + return; + fStyle = border; + InvalidateLayout(); + if (Window() != NULL && LockLooper()) { Invalidate(); UnlockLooper(); @@ -95,14 +151,12 @@ float BBox::TopBorderOffset() { - float labelHeight = 0; + _ValidateLayoutData(); - if (fLabel != NULL) - labelHeight = fLabelBox->Height(); - else if (fLabelView != NULL) - labelHeight = fLabelView->Bounds().Height(); + if (fLabel != NULL || fLabelView != NULL) + return fLayoutData->label_box.Height() / 2; - return ceilf(labelHeight / 2.0f); + return 0; } @@ -110,24 +164,15 @@ BRect BBox::InnerFrame() { - float borderSize = Border() == B_FANCY_BORDER ? 2.0f - : Border() == B_PLAIN_BORDER ? 1.0f : 0.0f; - float labelHeight = 0.0f; + _ValidateLayoutData(); - if (fLabel != NULL) { - // fLabelBox doesn't contain the font's descent, but we want it here - font_height fontHeight; - GetFontHeight(&fontHeight); + BRect frame(Bounds()); + frame.left += fLayoutData->insets.left; + frame.top += fLayoutData->insets.top; + frame.right -= fLayoutData->insets.right; + frame.bottom -= fLayoutData->insets.bottom; - labelHeight = ceilf(fontHeight.ascent + fontHeight.descent); - } else if (fLabelView != NULL) - labelHeight = fLabelView->Bounds().Height(); - - BRect rect = Bounds().InsetByCopy(borderSize, borderSize); - if (labelHeight) - rect.top = Bounds().top + labelHeight; - - return rect; + return frame; } @@ -136,17 +181,10 @@ { _ClearLabel(); - if (string) { - font_height fontHeight; - GetFontHeight(&fontHeight); - + if (string) fLabel = strdup(string); - // leave 6 pixels of the frame, and have a gap of 4 pixels between - // the frame and the text on both sides - fLabelBox = new BRect(6.0f, 0, StringWidth(string) + 14.0f, - ceilf(fontHeight.ascent)); - } + InvalidateLayout(); if (Window()) Invalidate(); @@ -164,6 +202,8 @@ AddChild(fLabelView, ChildAt(0)); } + InvalidateLayout(); + if (Window()) Invalidate(); @@ -188,11 +228,13 @@ void BBox::Draw(BRect updateRect) { + _ValidateLayoutData(); + PushState(); BRect labelBox = BRect(0, 0, 0, 0); if (fLabel != NULL) { - labelBox = *fLabelBox; + labelBox = fLayoutData->label_box; BRegion update(updateRect); update.Exclude(labelBox); @@ -376,54 +418,12 @@ void BBox::GetPreferredSize(float *_width, float *_height) { - float width, height; - bool label = true; + _ValidateLayoutData(); - // acount for label - if (fLabelView) { - fLabelView->GetPreferredSize(&width, &height); - width += 10.0; - // the label view is placed 10 pixels from the left - } else if (fLabel) { - font_height fh; - GetFontHeight(&fh); - width += ceilf(StringWidth(fLabel)); - height += ceilf(fh.ascent + fh.descent); - } else { - label = false; - width = 0; - height = 0; - } - - // acount for border - switch (fStyle) { - case B_NO_BORDER: - break; - case B_PLAIN_BORDER: - // label: (1 pixel for border + 1 pixel for padding) * 2 - // no label: (1 pixel for border) * 2 + 1 pixel for padding - width += label ? 4 : 3; - // label: 1 pixel for bottom border + 1 pixel for padding - // no label: (1 pixel for border) * 2 + 1 pixel for padding - height += label ? 2 : 3; - break; - case B_FANCY_BORDER: - // label: (2 pixel for border + 1 pixel for padding) * 2 - // no label: (2 pixel for border) * 2 + 1 pixel for padding - width += label ? 6 : 5; - // label: 2 pixel for bottom border + 1 pixel for padding - // no label: (2 pixel for border) * 2 + 1 pixel for padding - height += label ? 3 : 5; - break; - } - // NOTE: children are ignored, you can use BBox::GetPreferredSize() - // to get the minimum size of this object, then add the size - // of your child(ren) plus inner padding for the final size - if (_width) - *_width = width; + *_width = fLayoutData->preferred.width; if (_height) - *_height = height; + *_height = fLayoutData->preferred.height; } @@ -448,6 +448,80 @@ } +BSize +BBox::MinSize() +{ + _ValidateLayoutData(); + + BSize size = (GetLayout() ? GetLayout()->MinSize() : fLayoutData->min); + return BLayoutUtils::ComposeSize(ExplicitMinSize(), size); +} + + +BSize +BBox::MaxSize() +{ + _ValidateLayoutData(); + + BSize size = (GetLayout() ? GetLayout()->MaxSize() : fLayoutData->max); + return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size); +} + + +BSize +BBox::PreferredSize() +{ + _ValidateLayoutData(); + + BSize size = (GetLayout() ? GetLayout()->PreferredSize() + : fLayoutData->preferred); + return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), size); +} + + +void +BBox::InvalidateLayout(bool descendants) +{ + fLayoutData->valid = false; + BView::InvalidateLayout(descendants); +} + + +void +BBox::DoLayout() +{ + // Bail out, if we shan't do layout. + if (!(Flags() & B_SUPPORTS_LAYOUT)) + return; + + // If the user set a layout, we let the base class version call its + // hook. + if (GetLayout()) { + BView::DoLayout(); + return; + } + + _ValidateLayoutData(); + + // layout the label view + if (fLabelView) { + fLabelView->MoveTo(fLayoutData->label_box.LeftTop()); + fLabelView->ResizeTo(fLayoutData->label_box.Size()); + } + + // layout the child + if (BView* child = _Child()) { + BRect frame(Bounds()); + frame.left += fLayoutData->insets.left; + frame.top += fLayoutData->insets.top; + frame.right -= fLayoutData->insets.right; + frame.bottom -= fLayoutData->insets.bottom; + + BLayoutUtils::AlignInFrame(child, frame); + } +} + + void BBox::_ReservedBox1() {} void BBox::_ReservedBox2() {} @@ -466,7 +540,7 @@ fLabel = NULL; fLabelView = NULL; - fLabelBox = NULL; + fLayoutData = new LayoutData; int32 flags = 0; @@ -588,13 +662,110 @@ fBounds.top = 0; if (fLabel) { - delete fLabelBox; free(fLabel); fLabel = NULL; - fLabelBox = NULL; } else if (fLabelView) { fLabelView->RemoveSelf(); delete fLabelView; fLabelView = NULL; } } + + +BView* +BBox::_Child() const +{ + for (int32 i = 0; BView* view = ChildAt(i); i++) { + if (view != fLabelView) + return view; + } + + return NULL; +} + + +void +BBox::_ValidateLayoutData() +{ + if (fLayoutData->valid) + return; + + // compute the label box, width and height + bool label = true; + float labelHeight = 0; // height of the label (pixel count) + if (fLabel) { + // leave 6 pixels of the frame, and have a gap of 4 pixels between + // the frame and the text on either side + font_height fontHeight; + GetFontHeight(&fontHeight); + fLayoutData->label_box.Set(6.0f, 0, 14.0f + StringWidth(fLabel), + ceilf(fontHeight.ascent)); + labelHeight = ceilf(fontHeight.ascent + fontHeight.descent) + 1; + } else if (fLabelView) { + // the label view is placed at (0, 10) at its preferred size + BSize size = fLabelView->PreferredSize(); + fLayoutData->label_box.Set(10, 0, 10 + size.width, size.height); + labelHeight = size.height + 1; + } else { + label = false; + } + + // border + switch (fStyle) { + case B_PLAIN_BORDER: + fLayoutData->insets.Set(1, 1, 1, 1); + break; + case B_FANCY_BORDER: + fLayoutData->insets.Set(2, 2, 2, 2); + break; + case B_NO_BORDER: + default: + fLayoutData->insets.Set(0, 0, 0, 0); + break; + } + + // if there's a label, the top inset will be dictated by the label + if (label && labelHeight > fLayoutData->insets.top) + fLayoutData->insets.top = labelHeight; + + // total number of pixel the border adds + float addWidth = fLayoutData->insets.left + fLayoutData->insets.right; + float addHeight = fLayoutData->insets.top + fLayoutData->insets.bottom; + + // compute the minimal width induced by the label + float minWidth; + if (label) + minWidth = fLayoutData->label_box.right + fLayoutData->insets.right; + else + minWidth = addWidth - 1; + + // finally consider the child constraints, if we shall support layout + BView* child = _Child(); + if (child && (Flags() & B_SUPPORTS_LAYOUT)) { + BSize min = child->MinSize(); + BSize max = child->MaxSize(); + BSize preferred = child->PreferredSize(); + + min.width += addWidth; + min.height += addHeight; + preferred.width += addWidth; + preferred.height += addHeight; + max.width = BLayoutUtils::AddDistances(max.width, addWidth - 1); + max.height = BLayoutUtils::AddDistances(max.height, addHeight - 1); + + if (min.width < minWidth) + min.width = minWidth; + BLayoutUtils::FixSizeConstraints(min, max, preferred); + + fLayoutData->min = min; + fLayoutData->max = max; + fLayoutData->preferred = preferred; + } else { + fLayoutData->min.Set(minWidth, addHeight - 1); + fLayoutData->max.Set(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED); + fLayoutData->preferred = fLayoutData->min; + } + + fLayoutData->valid = true; +} + From bonefish at mail.berlios.de Sat Jun 9 01:42:50 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 01:42:50 +0200 Subject: [Haiku-commits] r21357 - haiku/trunk/src/tests/kits/interface/layout/widget_layout_test Message-ID: <200706082342.l58Ngorn016005@sheep.berlios.de> Author: bonefish Date: 2007-06-09 01:42:50 +0200 (Sat, 09 Jun 2007) New Revision: 21357 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21357&view=rev Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/RadioButton.h Log: Fixed header guard. Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/RadioButton.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/RadioButton.h 2007-06-08 23:40:16 UTC (rev 21356) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/RadioButton.h 2007-06-08 23:42:50 UTC (rev 21357) @@ -2,8 +2,8 @@ * Copyright 2007, Ingo Weinhold . * All rights reserved. Distributed under the terms of the MIT License. */ -#ifndef WIDGET_LAYOUT_TEST_CHECK_BOX_H -#define WIDGET_LAYOUT_TEST_CHECK_BOX_H +#ifndef WIDGET_LAYOUT_TEST_RADIO_BUTTON_H +#define WIDGET_LAYOUT_TEST_RADIO_BUTTON_H #include @@ -76,4 +76,4 @@ }; -#endif // WIDGET_LAYOUT_TEST_CHECK_BOX_H +#endif // WIDGET_LAYOUT_TEST_RADIO_BUTTON_H From bonefish at mail.berlios.de Sat Jun 9 01:43:42 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 01:43:42 +0200 Subject: [Haiku-commits] r21358 - haiku/trunk/src/tests/kits/interface/layout/widget_layout_test Message-ID: <200706082343.l58NhgAG016094@sheep.berlios.de> Author: bonefish Date: 2007-06-09 01:43:42 +0200 (Sat, 09 Jun 2007) New Revision: 21358 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21358&view=rev Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/TwoDimensionalSliderView.cpp haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp Log: Aesthetical changes. Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/TwoDimensionalSliderView.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/TwoDimensionalSliderView.cpp 2007-06-08 23:42:50 UTC (rev 21357) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/TwoDimensionalSliderView.cpp 2007-06-08 23:43:42 UTC (rev 21358) @@ -16,7 +16,7 @@ fMaxLocation(0, 0), fDragging(false) { - SetViewColor((rgb_color){0, 120, 0, 255}); + SetViewColor((rgb_color){255, 0, 0, 255}); } Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp 2007-06-08 23:42:50 UTC (rev 21357) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp 2007-06-08 23:43:42 UTC (rev 21358) @@ -69,7 +69,7 @@ // slider view fSliderView = new TwoDimensionalSliderView( new BMessage(MSG_2D_SLIDER_VALUE_CHANGED), this); - fSliderView->SetLocationRange(BPoint(30, 40), BPoint(150, 130)); + fSliderView->SetLocationRange(BPoint(0, 0), BPoint(0, 0)); view->AddChild(fSliderView); _UpdateSliderConstraints(); From bonefish at mail.berlios.de Sat Jun 9 01:45:26 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 01:45:26 +0200 Subject: [Haiku-commits] r21359 - haiku/trunk/src/tests/kits/interface/layout/widget_layout_test Message-ID: <200706082345.l58NjQAk016213@sheep.berlios.de> Author: bonefish Date: 2007-06-09 01:45:25 +0200 (Sat, 09 Jun 2007) New Revision: 21359 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21359&view=rev Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ViewContainer.cpp haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ViewContainer.h Log: Override BView::InvalidateLayout() as well to avoid stupid compiler warning. Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ViewContainer.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ViewContainer.cpp 2007-06-08 23:43:42 UTC (rev 21358) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ViewContainer.cpp 2007-06-08 23:45:25 UTC (rev 21359) @@ -119,6 +119,13 @@ void +ViewContainer::InvalidateLayout(bool descendants) +{ + BView::InvalidateLayout(descendants); +} + + +void ViewContainer::InvalidateLayout() { if (View::IsLayoutValid()) { Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ViewContainer.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ViewContainer.h 2007-06-08 23:43:42 UTC (rev 21358) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ViewContainer.h 2007-06-08 23:45:25 UTC (rev 21359) @@ -28,6 +28,8 @@ virtual void MouseMoved(BPoint where, uint32 code, const BMessage* message); + virtual void InvalidateLayout(bool descendants); + // View hooks virtual void InvalidateLayout(); From bonefish at mail.berlios.de Sat Jun 9 01:46:25 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 01:46:25 +0200 Subject: [Haiku-commits] r21360 - haiku/trunk/src/tests/kits/interface/layout/widget_layout_test Message-ID: <200706082346.l58NkPP0016295@sheep.berlios.de> Author: bonefish Date: 2007-06-09 01:46:25 +0200 (Sat, 09 Jun 2007) New Revision: 21360 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21360&view=rev Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/TestView.cpp haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/TestView.h Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile Log: New helper class TestView. Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile 2007-06-08 23:45:25 UTC (rev 21359) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile 2007-06-08 23:46:25 UTC (rev 21360) @@ -13,6 +13,7 @@ RadioButton.cpp StringView.cpp Test.cpp + TestView.cpp TwoDimensionalSliderView.cpp View.cpp ViewContainer.cpp Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/TestView.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/TestView.cpp 2007-06-08 23:45:25 UTC (rev 21359) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/TestView.cpp 2007-06-08 23:46:25 UTC (rev 21360) @@ -0,0 +1,48 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#include "TestView.h" + + +TestView::TestView(BSize minSize, BSize maxSize, BSize preferredSize) + : BView("test view", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), + fMinSize(minSize), + fMaxSize(maxSize), + fPreferredSize(preferredSize) +{ + SetViewColor((rgb_color){150, 220, 150, 255}); + SetHighColor((rgb_color){0, 80, 0, 255}); +} + + +BSize +TestView::MinSize() +{ + return fMinSize; +} + + +BSize +TestView::MaxSize() +{ + return fMaxSize; +} + + +BSize +TestView::PreferredSize() +{ + return fPreferredSize; +} + + +void +TestView::Draw(BRect updateRect) +{ + BRect bounds(Bounds()); + StrokeRect(bounds); + StrokeLine(bounds.LeftTop(), bounds.RightBottom()); + StrokeLine(bounds.LeftBottom(), bounds.RightTop()); +} Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/TestView.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/TestView.h 2007-06-08 23:45:25 UTC (rev 21359) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/TestView.h 2007-06-08 23:46:25 UTC (rev 21360) @@ -0,0 +1,30 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef WIDGET_LAYOUT_TEST_TEST_VIEW_H +#define WIDGET_LAYOUT_TEST_TEST_VIEW_H + + +#include + + +class TestView : public BView { +public: + TestView(BSize minSize, BSize maxSize, + BSize preferredSize); + + virtual BSize MinSize(); + virtual BSize MaxSize(); + virtual BSize PreferredSize(); + + virtual void Draw(BRect updateRect); + +private: + BSize fMinSize; + BSize fMaxSize; + BSize fPreferredSize; +}; + + +#endif // WIDGET_LAYOUT_TEST_TEST_VIEW_H From bonefish at mail.berlios.de Sat Jun 9 01:48:09 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 01:48:09 +0200 Subject: [Haiku-commits] r21361 - haiku/trunk/src/tests/kits/interface/layout/widget_layout_test Message-ID: <200706082348.l58Nm9QA016435@sheep.berlios.de> Author: bonefish Date: 2007-06-09 01:48:08 +0200 (Sat, 09 Jun 2007) New Revision: 21361 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21361&view=rev Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h Log: Extended the BBox test. One can now play with label and child view. Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp 2007-06-08 23:46:25 UTC (rev 21360) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp 2007-06-08 23:48:08 UTC (rev 21361) @@ -8,15 +8,21 @@ #include #include +#include #include +#include "CheckBox.h" #include "GroupView.h" #include "RadioButton.h" +#include "TestView.h" // messages enum { MSG_BORDER_STYLE_CHANGED = 'bstc', + MSG_LABEL_CHANGED = 'lbch', + MSG_LONG_LABEL_CHANGED = 'llch', + MSG_CHILD_CHANGED = 'chch' }; @@ -33,12 +39,31 @@ }; +// LabelRadioButton +class BoxTest::LabelRadioButton : public LabeledRadioButton { +public: + LabelRadioButton(const char* label, const char* boxLabel, + bool labelView = false) + : LabeledRadioButton(label), + fLabel(boxLabel), + fLabelView(labelView) + { + } + + const char* fLabel; + bool fLabelView; +}; + + // constructor BoxTest::BoxTest() : Test("Box", NULL), - fBox(new BBox(BRect(0, 0, 9, 9), "test box", B_FOLLOW_NONE)), - fBorderStyleRadioGroup(NULL) -// TODO: Layout-friendly constructor + fBox(new BBox("test box")), + fChild(NULL), + fBorderStyleRadioGroup(NULL), + fLabelRadioGroup(NULL), + fLongLabelCheckBox(NULL), + fChildCheckBox(NULL) { SetView(fBox); } @@ -48,6 +73,7 @@ BoxTest::~BoxTest() { delete fBorderStyleRadioGroup; + delete fLabelRadioGroup; } @@ -67,6 +93,7 @@ controls->AddChild(group); // the radio button group for selecting the border style + fBorderStyleRadioGroup = new RadioButtonGroup( new BMessage(MSG_BORDER_STYLE_CHANGED), this); @@ -89,6 +116,47 @@ // default to no border fBorderStyleRadioGroup->SelectButton(0L); + // spacing + group->AddChild(new VStrut(10)); + + // the radio button group for selecting the label + + fLabelRadioGroup = new RadioButtonGroup(new BMessage(MSG_LABEL_CHANGED), + this); + + // no label + button = new LabelRadioButton("No label", NULL); + group->AddChild(button); + fLabelRadioGroup->AddButton(button->GetRadioButton()); + + // label string + button = new LabelRadioButton("Label string", ""); + group->AddChild(button); + fLabelRadioGroup->AddButton(button->GetRadioButton()); + + // label view + button = new LabelRadioButton("Label view", NULL, true); + group->AddChild(button); + fLabelRadioGroup->AddButton(button->GetRadioButton()); + + // default to no border + fLabelRadioGroup->SelectButton(0L); + + // spacing + group->AddChild(new VStrut(10)); + + // long label + fLongLabelCheckBox = new LabeledCheckBox("Long label", + new BMessage(MSG_LONG_LABEL_CHANGED), this); + group->AddChild(fLongLabelCheckBox); + + // child + fChildCheckBox = new LabeledCheckBox("Child", + new BMessage(MSG_CHILD_CHANGED), this); + group->AddChild(fChildCheckBox); + + + // glue group->AddChild(new Glue()); } @@ -108,6 +176,15 @@ case MSG_BORDER_STYLE_CHANGED: _UpdateBorderStyle(); break; + case MSG_LABEL_CHANGED: + _UpdateLabel(); + break; + case MSG_LONG_LABEL_CHANGED: + _UpdateLongLabel(); + break; + case MSG_CHILD_CHANGED: + _UpdateChild(); + break; default: Test::MessageReceived(message); break; @@ -132,3 +209,62 @@ fBox->SetBorder(button->fBorderStyle); } } + + +// _UpdateLabel +void +BoxTest::_UpdateLabel() +{ + if (fLabelRadioGroup) { + // We need to get the parent of the actually selected button, since + // that is the labeled radio button we've derived our + // BorderStyleRadioButton from. + AbstractButton* selectedButton = fLabelRadioGroup->SelectedButton(); + View* parent = (selectedButton ? selectedButton->Parent() : NULL); + LabelRadioButton* button = dynamic_cast(parent); + if (button) { + if (button->fLabelView) + fBox->SetLabel(new BButton("", NULL)); + else + fBox->SetLabel(button->fLabel); + + _UpdateLongLabel(); + } + } +} + + +// _UpdateLongLabel +void +BoxTest::_UpdateLongLabel() +{ + if (!fLongLabelCheckBox) + return; + + const char* label = (fLongLabelCheckBox->IsSelected() + ? "Quite Long Label for a BBox" + : "Label"); + + if (BView* labelView = fBox->LabelView()) { + if (BButton* button = dynamic_cast(labelView)) + button->SetLabel(label); + } else if (fBox->Label()) + fBox->SetLabel(label); +} + + +// _UpdateChild +void +BoxTest::_UpdateChild() +{ + if (!fChildCheckBox || fChildCheckBox->IsSelected() == (fChild != NULL)) + return; + + if (fChild) { + fBox->RemoveChild(fChild); + fChild = NULL; + } else { + fChild = new TestView(BSize(20, 10), BSize(350, 200), BSize(100, 70)); + fBox->AddChild(fChild); + } +} Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h 2007-06-08 23:46:25 UTC (rev 21360) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h 2007-06-08 23:48:08 UTC (rev 21361) @@ -10,6 +10,7 @@ class BBox; +class LabeledCheckBox; class RadioButtonGroup; @@ -25,12 +26,20 @@ private: void _UpdateBorderStyle(); + void _UpdateLabel(); + void _UpdateLongLabel(); + void _UpdateChild(); private: class BorderStyleRadioButton; + class LabelRadioButton; BBox* fBox; + BView* fChild; RadioButtonGroup* fBorderStyleRadioGroup; + RadioButtonGroup* fLabelRadioGroup; + LabeledCheckBox* fLongLabelCheckBox; + LabeledCheckBox* fChildCheckBox; }; From darkwyrm at mail.berlios.de Sat Jun 9 06:15:28 2007 From: darkwyrm at mail.berlios.de (darkwyrm at BerliOS) Date: Sat, 9 Jun 2007 06:15:28 +0200 Subject: [Haiku-commits] r21362 - haiku/trunk/src/documentation/uiguidelines Message-ID: <200706090415.l594FSkR005986@sheep.berlios.de> Author: darkwyrm Date: 2007-06-09 06:15:27 +0200 (Sat, 09 Jun 2007) New Revision: 21362 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21362&view=rev Modified: haiku/trunk/src/documentation/uiguidelines/HaikuHIG.xml Log: Proofreading fixes for about the first half of the document Modified: haiku/trunk/src/documentation/uiguidelines/HaikuHIG.xml =================================================================== --- haiku/trunk/src/documentation/uiguidelines/HaikuHIG.xml 2007-06-08 23:48:08 UTC (rev 21361) +++ haiku/trunk/src/documentation/uiguidelines/HaikuHIG.xml 2007-06-09 04:15:27 UTC (rev 21362) @@ -18,9 +18,9 @@ Haiku is an operating system which is known for its speed and being easy for anyone to use. This is partly because good programmers try to design their apps for more than just themselves. We are going to examine how you can also make your program more appealing. The reason is easy: easier to use means more people using your program. Writing good software can be hard, but it is worth the time and effort. -Who Ya Writin' It Fer? +Who's Gonna Use It? -You probably already know what kind of program you are going to write. If not, put this book away and do some thinking first -- without a clear idea of what you want, it's hard to do something about it. Once you know what general kind of program you would like to create, you also need to figure out who the program is meant for. This can be something as general as 'desktop users' to something as specific as 'Haiku Web Developers'. When you know who the main users of your program will be, you can make certain assumptions about what your users know. You can't necessarily expect a musician to understand how to effectively use a 3D modelling program as advanced as, say, 3D Studio Max. +You probably already know what kind of program you are going to write. If not, put this book away and do some thinking first. Without a clear idea of what you want, it's hard to do something about it. Once you know what general kind of program you would like to create, you also need to figure out who the program is meant for. This can be something as general as 'desktop users' to something as specific as 'Haiku Web Developers'. When you know who the main users of your program will be, you can make certain assumptions about what your users know. You can't necessarily expect a musician to understand how to effectively use a 3D modelling program as advanced as, say, 3D Studio Max, but you can expect them to have skills which lend themselves to using a program for writing music. Depending on how concerned you are about details, you may even want to create a user profile -- a fictional idea of an example user. This can consist of just one or two sentences or can be several paragraphs. A short user profile contains the person's first name, occupation, level of expertise, and what kinds of things they want to be able to do with their computer. One thing to be sure of is to make the user profile believable -- like a person you might know. In fact, when you design your app, it may be helpful if you know someone who fits into the target audience. You don't want to design you app for that person specifically, but, rather, someone just like them. @@ -46,7 +46,7 @@ Summary -Careful planning is the key to writing excellent software, regardless of what stage of development a project may be in. In order to be easy, good software only has what is really needed. It also helps the user do his work wherever possible. Only by thoroughly understanding what the work is, how it is to be done, and who is doing it can a program provide the best experience possible. +Careful planning is the key to writing excellent software, regardless of what stage of development a project may be in. In order to be easy, good software only has what is really needed. It also helps the user do his work wherever possible. Only by thoroughly understanding what the work is, how it is to be done, and who is doing it can a program provide the best experience possible. @@ -69,13 +69,13 @@ Jobs in the Information Technology industry are almost always professional positions. One aspect which makes IT a profession is that it has its own body of knowledge and terminology to go with it. Most people have only a rudimentary 'computerese' vocabulary. The thing that they look at when they use a computer is called a monitor or just 'the screen'; the little arrow on the screen is called the cursor, and the thing they type with is called a keyboard. Few users know (or care) what a 'file format' is and fewer still do not know what an 'invalid sector' on a floppy disk might be. -Good programs use regular language instead of technical terms. For file management software, 'volumes' are really disks -- even though the term isn't quite accurate, a normal person thinks a disk is a storage container and that volume is what you have up too high at really good parties. Images are 'pictures'. A person doesn't 'kill' a application that has 'hung' -- he 'forces a frozen program to quit'. Details like this may seem minor, but many small improvements in a program's usability can have a profound effect overall. Of course, if your target audience is IT professionals, these kinds of terms are perfectly acceptable. Be sure that you match the everyday language of your audience. +Good programs use language appropriate for the audience. The problem is that quite a lot of software intended for the general desktop user reads like Yiddish for Joe User. In such cases, regular, everyday language should be used as much as is possible. For file management software, 'volumes' are really disks -- even though the term isn't quite accurate, a normal person thinks a disk is a storage container and that volume is what you have up too high at really good parties. Images are 'pictures'. A person doesn't 'kill' a application that has 'hung' -- he 'forces a frozen program to quit'. Details like this may seem minor, but many small improvements in a program's usability can have a profound effect overall. Of course, if your target audience is IT professionals, these kinds of terms are perfectly acceptable. Be sure that you match the everyday language of your audience and when in doubt, err toward using less technical language. Good Software Does Not Expose Its Implementation -Good software works a certain way because it is the best way to be done, not because the code was written in a certain way or because it was dictated by an underlying API. An example of this would be if a music composition program has an easily-reached maximum song size because the code monkey who wrote it used a 16-bit variable instead of a 32-bit one. While there are sometimes limitations that cannot be overcome, the actual code written and the architecture used when it was written should have as little effect as possible on what the user sees and works with when using your software. +Good software works a certain way because it is the best way to be done or close to it, not because the code was written in a certain way or because it was dictated by an underlying API. An example of this would be if a music composition program has an easily-reached maximum song size because the code monkey who wrote it used a 16-bit variable instead of a 32-bit one. While there are sometimes limitations that cannot be overcome, the actual code written and the architecture used when it was written should have as little effect as possible on what the user sees and works with when using your software. @@ -93,7 +93,7 @@ Good Software Gives Plenty of Feedback -Imagine for a moment that you have just started converting a movie file to another format. You hit the button marked 'Go' and wait. Then you wait some more. You go to the restroom, brew a new pot of coffee, get the mail from the box, and come back to wait some more. You're sure you clicked the button, but nothing seems to be happening. Did something go wrong? Only after some snooping around with a file manager do you find out that everything is OK. You didn't know what was happening because the program didn't tell you what it was doing. +Imagine for a moment that you have just started converting a movie file to another format. You hit the button marked 'Go' and wait. Then you wait some more. You go to the restroom, brew a new pot of coffee, get the mail from the box, confirm that mullets are still out-of-style, and come back to wait some more. You're sure you clicked the button, but nothing seems to be happening. Did something go wrong? Only after some snooping around with a file manager do you find out that everything is OK. You didn't know what was happening because the program didn't tell you what it was doing. Good software keep the lines of communication open. Good feedback just means making sure that the user knows what your program is doing at any given time, especially if the program is busy doing something which makes him wait. CD and DVD burning programs tell the user how much is left before they are finished making a CD or DVD. File management programs tell how many files are left to copy or move. Web browsers animate a little icon while they download a web page. Users have a natural tendency to think that if nothing seems to be happening, then the program is probably frozen. Making sure that the user knows your program is hard at work puts his mind at ease. @@ -102,13 +102,13 @@ Good Software Makes Errors Hard -It has been said that nothing can be made foolproof because fools are so ingenious. Even so, make it tough for the user to make a mistake. If, for example, the user needs to enter in some text and certain characters are not allowed, then disable those characters for the text box it needs to be entered in. If resizing a window horizontally should not be done for some reason, don't let the user do it. Does your program require a selection from a list before the user clicks OK? Tell the user that -- nicely, of course -- and then disable the OK button until a selection is made. An even better solution would be to select a good default choice for the user and give him the option to change it. Build constraints into your application which prevent errors. This would be why 3.5" floppy disks have a notch in one side -- it can be inserted into a drive only one way. Constraints are also good for lazy developers because then their software crashes less and they don't need to wri! te as much error-handling code. +It has been said that nothing can be made foolproof because fools are so ingenious. Even so, make it tough for the user to make a mistake. If, for example, the user needs to enter in some text and certain characters are not allowed, then disable those characters for the text box it needs to be entered in instead of nagging the user with a message box. If resizing a window horizontally should not be done for some reason, don't let the user do it. Does your program require a selection from a list before the user clicks OK? Tell the user that -- nicely, of course -- and then disable the OK button until a selection is made. An even better solution would be to select a good default choice for the user and give him the option to change it. Build constraints into your application which prevent errors. This would be why 3.5" floppy disks have a notch in one side -- it can be inserted into a drive only one way. Constraints are also good for lazy developers because then their s! oftware crashes less and they don't need to write as much error-handling code. Good Applications Handle Errors Gracefully -Even if you make it hard for a user to make a mistake, expect your program to have to deal with errors. It is possible for a program to handle errors in a way that doesn't leave the user wondering what happened. When code is written, errors of all sorts need to be anticipated and handled, such as lack of memory, lack of disk space, permissions errors, corrupted files, and loss of network connectivity. As Murphy's Law states, if something can go wrong in a given situation, it probably will. Hope for the best but prepare for the worst: within reason, handle every error that is likely to occur. Doing so greatly improves the perception of your software by the outside world. Crashes are unacceptable in all cases. Period. Error messages, for example, need to describe at the user's level of expertise what happened and suggest what the user can do to remedy the situation. In the worst case, the program needs to provide an easy way for the user to send technical information ab! out the problem back to you via e-mail or some other means. In all cases, the user's data is to be preserved. +Even if you make it hard for a user to make a mistake, expect your program to have to deal with errors. It is possible for a program to handle errors in a way that doesn't leave the user wondering what happened. When code is written, errors of all sorts need to be anticipated and handled, such as lack of memory, lack of disk space, permissions errors, corrupted files, and loss of network connectivity. As Murphy's Law states, if something can go wrong in a given situation, it probably will. Hope for the best but prepare for the worst: without bordering on the completely ridiculous, handle every error that is likely to occur. Doing so greatly improves the perception of your software by the outside world. Crashes are unacceptable in all cases. Period. Error messages, for example, need to describe at the user's level of expertise what happened and suggest what the user can do to remedy the situation. In the worst case, the program needs to provide an easy way for the user! to send technical information about the problem back to you via e-mail or some other means. In all cases, the user's data is to be preserved. One way that you can see how well your program handles errors is to deliberately try to break it in every way possible. Feed the entire text of your Aunt May's quiche recipe into a text box all at once. Try to open files it has no business being given. Take a valid document, back it up, open it in DiskProbe, enter as much junk data into it as you like, and then try to open it. Break your Internet connection while it's in the middle of an update. Try to using filenames with really wonky filenames. Be creative and ridiculous and, most of all, have fun breaking things! @@ -116,7 +116,7 @@ Good Software is Forgiving -Computers are excellent tools for people because they are good at many things that people are not. From a perspective which focuses on technology, humans are imprecise, illogical, disorganized, and make mistakes frequently. They are, however, excellent at forming habits and matching patterns, two things computers have a difficult time doing. Make commands undoable whenever possible and when it is not possible, be sure to inform the user that such is the case. Utilize a computer's strengths to make up for a person's inherent weaknesses. +Computers are excellent tools for people because they are good at many things that people are not. From a perspective which focuses on technology, humans are imprecise, illogical, disorganized, and make mistakes frequently. They are, however, excellent at forming habits and matching patterns, two things computers have a difficult time doing. Make commands undoable whenever possible and when it is not possible, be sure to inform the user that such is the case. Capitalize on a computer's strengths to make up for a person's inherent weaknesses. @@ -148,19 +148,19 @@ Avoid Hardcoded File Paths -Whenever your program needs to specify a particular area on the system, use of the find_directory() function to generate it. If and when the day comes that Haiku supports multiple users, your application will make a smooth transition to the new architecture. This will also allow for backward compatibility with older versions of BeOS, such as the change in locations for B_COMMON_FONTS_DIRECTORY being in a different place for Haiku than on R5. find_directory() is supported in both C and C++ environments. +Whenever your program needs to specify a particular location on the system, use of the find_directory() function to generate it. If and when the day comes that Haiku supports multiple users, your application will make a smooth transition to the new architecture. This will also allow for backward compatibility with older versions of BeOS, such as the change in locations for B_COMMON_FONTS_DIRECTORY being in a different place for Haiku than on R5. find_directory() is supported in both C and C++ environments. Make Your App's Look Fits in with Others -Certain function calls have been provided in the API to aid in making sure that your software shares the same general look as other applications and allow the user to make customizations to the system at the same time. Unless there is a very good reason for it, get colors for your program with ui_color() and the constants which go with it. Determine the size of your controls dynamically - use the ResizeToPreferred and GetPreferredSize for system controls and calculate the size of your own controls based on font sizes obtained from the system instead of hardcoded values. All of this will allow better ease-of-use for the user who prefers tiny fonts to increase use of desktop real estate and also for older users who need larger font sizes to accommodate weaker visual acuity. Graphics are an important part of a program's look, but don't reimplement the look of the buttons and other standard controls just to make your application stand out from the rest. By keeping visual ! consistency with the rest of the operating system, you avoid confusing the user with buttons that do not look like you can click on them, strange-acting menus, and so forth. +Certain function calls have been provided in the API to aid in making sure that your software shares the same general look as other applications and allow the user to make customizations to the system at the same time. Unless there is a very good reason for it, get colors for your program with ui_color() and the constants which go with it. Determine the size of your controls dynamically - use the ResizeToPreferred and GetPreferredSize for system controls and calculate the size of your own controls based on font sizes obtained from the system instead of hardcoded values. If you're writing code specifically for Haiku and don't care about compatibility with other BeOS flavors, use the new layout API. All of this will allow better ease-of-use for the user who prefers tiny fonts to increase use of desktop real estate and also for older users who need larger font sizes to accommodate weaker visual acuity. Graphics are an important part of a program's look, but don't reimple! ment the look of the buttons and other standard controls just to make your application stand out from the rest. By keeping visual consistency with the rest of the operating system, you avoid confusing the user with buttons that do not look like you can click on them, strange-acting menus, and so forth. Live Updates -One way to make sure that your application communicates effectively with the user is to provide "live" updates to information in it. This mostly relates to files in the system. A good example is an address book program which automatically removes and adds entries when new People files are added to the People folder. The information doesn't even have to be data that is outside your program. It could just be as simple as updating an entry in a list of items as the user types makes changes to it in a form in a different part of the GUI. Responsiveness like this in a program helps the user feel more in control of the work he is doing. +One way to make sure that your application communicates effectively with the user is to provide "live" updates to information in it. This mostly relates to files in the system. A good example is an address book program which automatically removes and adds entries when new People files are added to the People folder. The information doesn't even have to be data that is outside your program. It could just be as simple as updating an entry in a list of items as the user types makes changes to it in a form in a different part of the GUI. Responsiveness like this in a program helps the user feel more in control of the work he is doing and prevents possible loss of data. @@ -172,7 +172,7 @@ Formats to prefer: ImageJPEG or PNG SoundWAV or Ogg Vorbis -MovieMPEG4 or AVI +MovieOgg Theora or AVI @@ -181,11 +181,11 @@ The filesystem that Be created was nothing short of amazing in the 1990s. Even with the gradual evolution of other operating systems having progressed since then, it is still one of the most powerful around. Attributes are a powerful tool which allow you to store data about a file without being part of the file. This kind of power is easily put to use with audio files, such as FLAC, Ogg Vorbis, and the ubiquitous MP3. By attaching attributes to audio files, you can search for them with a query. Queries also leverage the filesystem's power. As long as the attribute you are querying for is indexed in the filesystem, there is no place a file with that attribute can hide. To top it all off, they are also a fast way of search for files meeting a certain criteria. -Although both attributes and queries are very powerful, use good sense in utilizing them. It takes quite a while to read a large number of attributes from a file, so you may wish to cache them if you are writing a program which will need to read more than just a few of them. Queries can only make use of attributes which are indexed, and their speed goes down as more and more attributes are indexed, so use good sense, as well. +Although both attributes and queries are very powerful, use good sense. It takes quite a while to read a large number of attributes from a file, so you may wish to cache them if you are writing a program which will need to read more than just a few of them. Queries can only make use of attributes which are indexed, and their speed goes down as more and more attributes are indexed. -The System Tray: It's Not Just for Dinner +The System Tray: It's Not Just for Dinner Anymore Because it can very easily become cluttered, install icons in the Deskbar's shelf only when it provides information that is updated often or if it provides functionality which will be frequently accessed by the user. Examples of these kinds of situations would be monitoring memory and processor load, checking mail, or quick access to features provided by a personal information management program. If it is unlikely that the user will need to access the information or functionality less than once per session, don't use the Deskbar -- accessing your program through the Be menu or an icon on the desktop should be sufficient. @@ -205,7 +205,7 @@ -Mouse Vocabulary, AKA "You Want Me to What?!" +Mouse Vocabulary, AKA "What's This Button Do?" The mouse, while the favorite rodent of most users, is not a very intuitive device: mouse skills must be learned. Most of the time, mouse skills are not an issue because the user is clicking on buttons, menus, and so forth, but sometimes a program must deal directly with mouse clicks and moves. Mouse operations fall into one of three categories. @@ -242,6 +242,7 @@ More than 3 consecutive clicks (quadruple clicking or more) Drag with tertiary mouse button Drag with modifier keys + Secondary/Tertiary click with modifier keys @@ -305,9 +306,9 @@ -Design without Throwing Fitts +Design to Prevent Fitts -According to Mr. Fitts, when using a mouse or other pointing device, the amount of time it takes to point to something is proportional to how far away that something is and how big it is. While it might seem obvious, this is often overlooked when a program is designed. The easiest places for a user to click are the four corners of the screen and the pixel directly under the cursor. The reason for this is because the mouse need not be moved for to click on the pixel under it and the user does not have to think much when moving the cursor to a corner because as soon as it reaches an edge, it can go no farther in that direction regardless of how much the mouse is moved. For this reason the Deskbar is in one corner of the screen. +According to Mr. Fitts, when using a mouse or other pointing device, the amount of time it takes to point to something is proportional to how far away that something is and how big it is. While it might seem obvious, this is often overlooked when a program is designed. The easiest places for a user to click are the four corners of the screen and the pixel directly under the cursor. The reason for this is because the mouse need not be moved for to click on the pixel under it and the user does not have to think much when moving the cursor to a corner because as soon as it reaches an edge, it can go no farther in that direction regardless of how much the mouse is moved. The Deskbar is in one corner of the screen for this reason. When you design the graphical interface for your program, make controls easy to click on. Toolbars that have a text label as part of each button are inherently easier to click because the labels add to the size of the buttons. A number of existing image editing programs use the secondary mouse button for a pop-up menu to access common features because the mouse doesn't have to move in order to bring the menu up. Researchers have even experimented with circular menus -- called pie menus -- which capitalize on Fitts' Law in order to make a menu as fast as possible. Your program need not go to such measures, but do keep in mind that teeny controls slow users down. @@ -330,9 +331,9 @@ A feature which is very helpful to a user is drop feedback. Any time the user is dragging something and the cursor passes over your program's window, it can react in a way to show the user that your program will accept the dragged object. Drop feedback can take a variety of forms: -A list control could draw a line in between two items to show where the item would go. +A list control could draw a line in between two items to show where the dragged item would be placed if the user released the button. -BTextView controls show a line where dragged text would be placed. +BTextView controls show a line where dragged text would be placed if dropped. If the user drags an entry over a folder, Tracker shades it slightly. @@ -398,7 +399,7 @@ Replicants -Replicants are neat. Replicants are neat. Replicants are ... *thump* .... Sorry - I got carried away, so to speak. :^) As cool as replicant technology is, it is only an emerging technology in other operating systems and is unfamiliar to most users in general. As such, it is best left as an extra feature and not the primary mode of operation for a program. There are some guidelines for using them, however. +Replicants take their cue from Dolly the sheep in allowing a BView to be closned and allow you to do Really Neat Things(TM). As cool as replicant technology is, it is only an emerging technology in other operating systems and is unfamiliar to most users in general. As such, it is best left as an extra feature and not the primary mode of operation for a program. Here are some guidelines for using them, however. It is appropriate for program to be a replicant if it is a lightweight program which provides information or a feature which the user will want to be able to access frequently. @@ -407,7 +408,7 @@ Be sure it is big enough to not get lost when placed on a busy desktop background. At the same time, do not take over the user's desktop unless he wants this to happen. 32 pixels square is a good minimum size, for example. -Provide a reliable way for the user to control your replicant. Do not rely on the menu provided by the dragger handle it does not have a menu bar of its own because the handle may have been hidden. Instead, provide another means which is immediately obvious or, at the very least, show a pop-up menu if the user clicks on it (with either button) and there are no other clickable controls. +Provide a reliable way for the user to control your replicant. Do not rely on the menu provided by the dragger handle because the handle itself may have been hidden. Instead, provide another means which is immediately obvious or, at the very least, show a pop-up menu if the user clicks on it (with either button) and there are no other clickable controls. Place a frame around the replicant's border so that it stands out from its surroundings @@ -421,21 +422,21 @@ Use of Text in the GUI -Almost without exception, if you are writing a program, you will need to pay at least a little attention to how it uses text. There is, believe it or not, are right ways and wrong ways, and while most of the guidelines for text might seem trivial, paying attention to what seem like niggling little details is what makes a good program into a great one. +Almost without exception, if you are writing a program, you will need to pay at least a little attention to how it uses text. There are, believe it or not, right ways and wrong ways, and while most of the guidelines for text might seem trivial, paying attention to what seem like niggling little details is what sets a good program apart from the rest. -Above all else mentioned in this chapter, use everyday language -- not technical terms-- and be both clear and concise. +Above all else mentioned in this chapter, use language appropriate for your audience -- most of the time, this means avoiding technical terms -- and be both clear and concise. -Error Messages, or, "I'm sorry Dave. I'm afraid I can't do that" +Error Messages, or, "I'm sorry Dave, I'm afraid I can't do that" -Perhaps the place where you should use text the most is in error messages. They should appear as seldom as possible because you anticipated and handled as many error conditions as possible and tried to blow it up real good, right? ;) When your program can't handle a particular error, the error message given to the user should do the following: +Perhaps the place where you should use text the most is in error messages. They should appear as seldom as possible because you anticipated and handled as many error conditions as possible and then tried to blow it up real good, right? ;) When your program can't handle a particular error, the error message given to the user should do the following: Explain what happened in everyday words. Provide enough information to know what happened without providing details which could confuse the user. For example, if a mail client sends a request to a server for e-mail and the server fails to respond, a way to explain this might be something like "MyMailApp could not check your e-mail. The mail server did not respond when contacted." -Offer suggestions to help the user fix the problem, if possible. Using the above example, one possible suggestion might be "Try checking your Internet connection with your web browser. If that works, the mail server might not be working correctly and you may want to try again later." +Offer suggestions to help the user fix the problem, if possible. Using the above example, one possible suggestion might be "Try checking your Internet connection with your web browser. If your web browser works, the mail server might not be working correctly and you may want to try again later." @@ -443,7 +444,7 @@ ...Ellipses... -An ellipsis is a series of 3 dots (...) used to tell the user that a control, often a menu item or button, will open a window. For example, a menu item named "New..." will display a window which has the title "New". However, if creating a new document does not require showing a window, then an ellipsis should not be used. Please be sure to use the B_UTF8_ELLIPSIS character instead of 3 periods. Many keymaps allow you to type in an ellipsis with the Option + period keyboard shortcut. +An ellipsis is a series of 3 dots (...) used to tell the user that a control, often a menu item or button, will open a window. For example, a menu item named "New..." will display a window which has the title "New". However, if creating a new document does not require showing a window, then an ellipsis should not be used. Please be sure to use the B_UTF8_ELLIPSIS character instead of 3 periods. Some BeOS keymaps, such as the US QWERTY keymap, allow you to type in an ellipsis with the Option + period keyboard shortcut. @@ -451,12 +452,12 @@ Sometimes space is at a premium. Abbreviations, acronyms, and contractions can come in very handy in these instances, but they can also be confusing. Whenever possible, avoid using them. Many times the reason there is not enough space is it isn't being used as efficiently as possible. When you use an abbreviation, please be sure that it is absolutely necessary, that it is both common and clear, and that it is appropriate for your program's target audience. For example, using the octothorpe (# symbol) is an abbreviation for the word 'number' in the English language which fits these criteria in most cases. These same guidelines also apply to acronyms. For example, the acronym CMYK (Cyan, Magenta, Yellow, Black) is acceptable in a color picker for an image processing application designed for graphics professionals, but not in one meant for children. Menus and button labels should never be abbreviated or contain an acronym. -Special care must be used with contractions. They can be a pitfall for users who are not using a program which is in their native language. Because they require more advanced command of the language, avoid using them in a place where their role is crucial in conveying the meaning of a message. For example, a checkbox for a message dialog with a checkbox marked "Don't show this message again" which is unchecked by default should be reworded "Always show this message" and have the checkbox checked by default. +Special care must be used with contractions. They can be a pitfall for users who are not using a program in their native language. Because they require a more advanced command of a language, avoid using them in a place where their role is crucial in conveying the meaning of a message. For example, a checkbox for a message dialog with a checkbox marked "Don't show this message again" which is unchecked by default should be reworded "Always show this message" and have the checkbox checked by default. -cApItAlIzAtIoN and Speling +Capitalization and Spelling Nothing is more unprofessional than spelling and capitalization errors. If spelling is not your strong suit, consult a spell checker, dictionary, or at least a friend. This is particularly important if you are working with a language which is not your native one. Use title capitalization in all places except where full sentences are used. This means that all "important" words and the last word in a phrase -- regardless of importance -- are capitalized. Prepositions, definite articles, and conjunctions (as, for, to, the, and, etc.) are generally not capitalized except when they are the first or last word in the phrase, such as in "Save As...". @@ -464,7 +465,7 @@ Use of Fonts -Good use of fonts can way make your program more visually appealing, but when not used well, can make it ugly, hard to read, or worse. Stick to the plain, bold, and fixed system fonts to maintain some general visual consistency across the operating system. It is perfectly acceptable to use a different font size, but do it only when you need a heading or something similar and try to limit the number of different sizes to just a few. A window which has lots of different font styles and sizes is harder to read and looks unprofessional. Control labels should always be in the system plain font and size specified by the system. +Good use of fonts can way make your program more visually appealing, but when not used well, can make it ugly, hard to read, or worse. Stick to the plain, bold, and fixed system fonts to maintain some general visual consistency across the operating system. It is perfectly acceptable to use different font sizes, but do it only when you need a heading or something similar and try to limit the number of different sizes to just a few. A window which has lots of different font styles and sizes is harder to read and looks unprofessional. Control labels should always be in the system plain font and size specified by the system. When calculating the layout for the controls, be sure that you do not depend on the system font being set to a particular font size. Most BControl-derived controls implement the methods GetPreferredSize and ResizeToPreferred to take font size into account. A basic idea of the line height for a font can be calculated by calling BFont::GetHeight() and adding together the values of the font_height structure. @@ -473,15 +474,15 @@ Special Case: The Command Line -When designing a program to work in a command-line environment there are some special considerations which must be addressed. Interaction with other programs, use in shell scripts, and a generally consistent interface for command-line programs are just some of the things you will need to keep in mind. The major design decisions you should make are how your program will get its data, what options are available, and what feedback the user will be given. +When designing a program to work in a command-line environment there are some special considerations which must be addressed. Interaction with other programs, use in shell scripts, and a generally consistent interface for command-line programs are just some of the things you will need to keep in mind. The major design decisions you should make are how your program will get its data, what options will be available, and what feedback the user will be given. -Spend some time thinking about how your program should interact with the shell and with other programs. Most of the time, this will boil down to whether your program is file-oriented or stream-oriented. Stream-oriented programs like grep and less work more or less like filters, getting data from stdin and dumping data to stdout. File-oriented programs like zip and bzip2 are given a list of files which the program then operates on. Your program can certainly do both, but choose a primary method because it will influence design decisions later on. Seriously consider handling wildcards instead of relying on the shell to do it if your program is file-oriented. This does mean more work for you as a developer, but it also reduces typing and, thus, typing errors for the user. Of course, if it doesn't make sense to support wildcards, then don't do it. +Spend some time thinking about how your program should interact with the shell and with other programs. Most of the time, this will boil down to whether your program is file-oriented or stream-oriented. Stream-oriented programs like grep and less work pretty much like filters, getting data from stdin and dumping data to stdout. File-oriented programs like zip and bzip2 are given a list of files which the program then operates on. Your program can certainly do both, but choose a primary method because it will influence design decisions later on. Seriously consider handling wildcards instead of relying on the shell to do it for you if your program is file-oriented. This does mean more work for you as a developer, but it also reduces typing and, thus, typing errors for the user. Of course, if it doesn't make sense to support wildcards, then don't do it. -Choose options which are going to be accessible by command-line switches carefully. Make each one available only if it fills a reasonably common task. From the perspective of the user, adding an option is adding a feature, which will, int turn, increase the complexity of your program. Provide GNU-style (double dash + long name) switches for all options. The most commonly-used options should also have a corresponding short (single-dash + single letter) one. The switches --help and -h are reserved for showing help information. Only standard UNIX applications (ls, tar, df, etc.) are not required to follow the standard for -h in order to avoid breaking backward compatibility. All new command-line programs need to follow this. +Choose options which are going to be accessible by command-line switches carefully. Make each one available only if it fills a reasonably common task. From the perspective of the user, adding an option is adding a feature, which will, in turn, increase the complexity of your program. Provide GNU-style (double dash + long name) switches for all options. The most commonly-used options should also have a short (single-dash + single letter) counterpart. The switches --help and -h are reserved for showing help information. Only standard UNIX applications (ls, tar, df, etc.) are not required to follow the standard for -h in order to avoid breaking backward compatibility. All new command-line programs need to follow this. Also, if your program requires one or more parameters, do the user a favor and show the help message if there are no extra parameters instead of telling the user to retype the command with the help switch. -When an option requires a particular value, there is also a standard for how the user is to provide the information. GNU-style command options should follow the format --option=value with the option to enclose the value in quotes. Multiple values for a switch should be comma-separated. Short-style command options should place a space between each value that follows it like this: -t value1 value2 value2 ... As mentioned above, wildcards should be handled by the program except when it does not make sense. If your program does something which modifies data, make sure that your program requires some sort of parameter -- a switch, a file, or whatever -- so that data is not lost if the user invokes your program without knowing what it does. You can assume that the user is sharper than a bowling ball, but do not expect the user to have expert knowledge of the operating system or, for that matter, your program. Programs which merely report information, ls and df come to mind,! are not required to do this as long as the information displayed gives the user an idea of what the program does. +When an option requires a particular value, there is also a standard for how the user is to provide the information. GNU-style command options should follow the format --option=value with the option to enclose the value in quotes. Multiple values for a switch should be comma-separated. Short-style command options should place a space between each value that follows it like this: -t value1 value2 value3 ... As mentioned above, wildcards should be handled by the program except when it does not make sense. If your program does something which modifies data, make sure that your program requires some sort of parameter -- a switch, a file, or whatever -- so that data is not lost if the user invokes your program without knowing what it does. You can assume that the user is sharper than a bowling ball, but do not expect the user to have expert knowledge of the operating system or, for that matter, your program. Programs which merely report information -- ls and df come to min! d -- are not required to do this as long as the information displayed gives the user an idea of what the program does. -Be sure to give enough feedback when your program does its thing. Like graphical programs, long tasks should inform the user of progress. This may be something as complex as a full-fledged progress meter drawn with text, a simple series of periods, a listing each file operated on, or something else. *All* programs should provide some sort of feedback -- the only time a program may print nothing is if there is a "quiet" option which the user has specified. The feedback your program gives doesn't even have to be excessive; you can just give general details. A "verbose" option should provide more detail than the program does by default. As explained earlier in this chapter, error messages should be no more technical than absolutely necessary and should be helpful whenever possible. If your program requires a parameter of some sort and isn't given any, show either the same message as for the help option or an abbreviated version which is still reasonably informative along! with something to point the user to the help option for more detailed information. +Be sure to give enough feedback when your program does its thing. Like graphical programs, long tasks should inform the user of progress. This may be something as complex as a full-fledged progress meter drawn with text, a simple series of periods, a listing each file operated on, or something else. *All* programs should provide some sort of feedback; the only time a program may print nothing is if there is a "quiet" option which the user has specified. The feedback your program gives doesn't even have to be excessive; you can just give general details. A "verbose" option should provide more detail than the program does by default. As explained earlier in this chapter, error messages should be no more technical than absolutely necessary and should be helpful whenever possible. If your program requires a parameter of some sort and isn't given any, show either the same message as for the help option or an abbreviated version which is still reasonably informative along w! ith something to point the user to the help option for more detailed information. @@ -494,7 +495,7 @@ Program Icons -Your program's icon is one easy way to set it apart from the rest of the pack. BeOS-style icons follow one of two perspectives - flat and isometric. Flat icons look like a head-on view. Isometric icons "look down" on the icon from a point above and to the right of the object with angled lines being about 30 degrees from horizontal. A good icon can give your program a favorable and professional impression to people who otherwise doesn't know a thing about you or your program. Take some time to create or find a good-looking icon. Whatever you do, don't just slap together a shabby-looking icon. It would be better not provide an icon at all and rely on the system to show the default application icon than to have one which reflects poorly on your program's reputation. +Your program's icon is one easy way to set it apart from the rest of the pack. BeOS-style icons follow one of two perspectives - flat and isometric. Flat icons look like a head-on view. Isometric icons "look down" on the icon from a point above and to the right of the object with angled lines being about 30 degrees from horizontal. A good icon can give your program a favorable and professional impression to people who otherwise doesn't know a thing about you or your program. Take some time to create or find a good-looking icon. Whatever you do, don't just slap together a shabby-looking icon. It would be better not provide an icon at all and rely on the system to show the default application icon than to have one which reflects poorly on your program's reputation. For more details on icon creation, consult the Haiku Icon Guidelines. @@ -512,7 +513,7 @@ About Windows... Doorways to Creative Expression -Give yourself some credit in your program: make an About window. They don't need to be especially fancy, but they can be if you are so inclined. It should contain the title of your program, the version, you and any other authors or the name of your company, and copyright information. If nothing else, write a few lines of code to show a BAlert with this information and you'll have enough. If there is a lot of information to show, using a marquee effect to automatically scroll the information or at least a read-only text view with a scroll bar. Do not include information about the computer itself, such as the amount of RAM or processor speed -- it doesn't belong here. While you certainly may show something short about the licensing of your program like "Distributed under the terms of the GNU Public License," the full text of the license belongs elsewhere. The window should not have a tab and should either have a button marked 'Close' or simply disappear when clicked. It! should also respond to the Command + W keyboard shortcut. +Give yourself some credit in your program: make an About window. They don't need to be especially fancy, but they can be if you are so inclined. It should contain the title of your program, the version, you and any other authors or the name of your company, and copyright information. If nothing else, write a few lines of code to show a BAlert with this information and you'll have enough. If there is a lot of information to show, using a marquee effect to automatically scroll the information or at least a read-only text view with a scroll bar. Do not include information about the computer itself, such as the amount of RAM or processor speed; it doesn't belong here. While you certainly may show something short about the licensing of your program like "Distributed under the terms of the GNU Public License," the full text of the license belongs elsewhere. The window should not have a tab and should either have a button marked 'Close' or simply disappear when clicked. It s! hould also respond to the Command + W keyboard shortcut. @@ -542,7 +543,7 @@ Making Your Own Cursors -You can very easily make your own cursors for your own purposes, but do it only if a different cursor will dramatically improve how well the user can work with your program. At the moment cursors can only be 16 pixels square and be black, white, or transparent. Be sure that the hot spot -- the actual location passed to applications when a mouse button is pressed -- is very obvious. Good hot spots are the tip of the hand cursor, the point of an arrow, or the center of a crosshairs. Use the full dimensions available to increase the cursor's visibility at high screen resolutions. +You can very easily make your own cursors for your own purposes, but do it only if a different cursor will dramatically improve how well the user can work with your program. At the moment, cursors can only be 16 pixels square and be black, white, or transparent. Be sure that the hot spot -- the actual location passed to applications when a mouse button is pressed -- is very obvious. Good hot spots are the tip of the hand cursor, the point of an arrow, or the center of a crosshairs. Use the full dimensions available to increase the cursor's visibility at high screen resolutions. NOTE: There is not nor will there ever be a busy cursor in BeOS-based operating systems. This is a deliberate design decision. If you have a need for a busy cursor, you need to make your program more responsive. Often you can use multiple threads to eliminate the need for a busy cursor. @@ -595,7 +596,6 @@ Examples of Good Dynamic Menu Item Usage - |Window| ----------------- Show Tool Window From bonefish at mail.berlios.de Sat Jun 9 12:47:06 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 12:47:06 +0200 Subject: [Haiku-commits] r21363 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200706091047.l59Al6fS004992@sheep.berlios.de> Author: bonefish Date: 2007-06-09 12:47:05 +0200 (Sat, 09 Jun 2007) New Revision: 21363 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21363&view=rev Modified: haiku/trunk/headers/os/interface/Control.h haiku/trunk/src/kits/interface/Control.cpp Log: Added layout-friendly constructor. Modified: haiku/trunk/headers/os/interface/Control.h =================================================================== --- haiku/trunk/headers/os/interface/Control.h 2007-06-09 04:15:27 UTC (rev 21362) +++ haiku/trunk/headers/os/interface/Control.h 2007-06-09 10:47:05 UTC (rev 21363) @@ -1,140 +1,137 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: Control.h -// Author: Marc Flerackers (mflerackers at androme.be) -// Description: BControl is the base class for user-event handling objects. -//------------------------------------------------------------------------------ - +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, OpenBeOS +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +// File Name: Control.h +// Author: Marc Flerackers (mflerackers at androme.be) +// Description: BControl is the base class for user-event handling objects. +//------------------------------------------------------------------------------ + #ifndef _CONTROL_H #define _CONTROL_H - -// Standard Includes ----------------------------------------------------------- - -// System Includes ------------------------------------------------------------- -#include -#include -#include /* For convenience */ -#include - -// Project Includes ------------------------------------------------------------ - -// Local Includes -------------------------------------------------------------- - -// Local Defines --------------------------------------------------------------- -enum { - B_CONTROL_OFF = 0, - B_CONTROL_ON = 1 -}; - -// Globals --------------------------------------------------------------------- - - -class BWindow; - + +// Standard Includes ----------------------------------------------------------- + +// System Includes ------------------------------------------------------------- +#include +#include +#include /* For convenience */ +#include + +// Project Includes ------------------------------------------------------------ + +// Local Includes -------------------------------------------------------------- + +// Local Defines --------------------------------------------------------------- +enum { + B_CONTROL_OFF = 0, + B_CONTROL_ON = 1 +}; + +// Globals --------------------------------------------------------------------- + + +class BWindow; + // BControl class -------------------------------------------------------------- -class BControl : public BView, public BInvoker { +class BControl : public BView, public BInvoker { public: - BControl(BRect frame, - const char *name, - const char *label, - BMessage *message, - uint32 resizingMode, - uint32 flags); -virtual ~BControl(); - - BControl(BMessage *archive); -static BArchivable *Instantiate(BMessage *archive); -virtual status_t Archive(BMessage *archive, bool deep = true) const; - -virtual void WindowActivated(bool active); -virtual void AttachedToWindow(); -virtual void MessageReceived(BMessage *message); -virtual void MakeFocus(bool focused = true); -virtual void KeyDown(const char *bytes, int32 numBytes); -virtual void MouseDown(BPoint point); -virtual void MouseUp(BPoint point); -virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message); -virtual void DetachedFromWindow(); - -virtual void SetLabel(const char *string); - const char *Label() const; - -virtual void SetValue(int32 value); - int32 Value() const; - -virtual void SetEnabled(bool enabled); - bool IsEnabled() const; - -virtual void GetPreferredSize(float *width, float *height); -virtual void ResizeToPreferred(); - -virtual status_t Invoke(BMessage *message = NULL); -virtual BHandler *ResolveSpecifier(BMessage *message, - int32 index, - BMessage *specifier, - int32 what, - const char *property); -virtual status_t GetSupportedSuites(BMessage *message); - -virtual void AllAttached(); -virtual void AllDetached(); - -virtual status_t Perform(perform_code d, void *arg); - -protected: - - bool IsFocusChanging() const; - bool IsTracking() const; - void SetTracking(bool state); - - void SetValueNoUpdate(int32 value); - -private: - -virtual void _ReservedControl1(); -virtual void _ReservedControl2(); -virtual void _ReservedControl3(); -virtual void _ReservedControl4(); - - BControl &operator=(const BControl &); - - void InitData(BMessage *data = NULL); - - char *fLabel; - int32 fValue; - bool fEnabled; - bool fFocusChanging; - bool fTracking; - bool fWantsNav; + BControl(BRect frame, + const char *name, + const char *label, + BMessage *message, + uint32 resizingMode, + uint32 flags); + BControl(const char *name, + const char *label, + BMessage *message, + uint32 flags); +virtual ~BControl(); + + BControl(BMessage *archive); +static BArchivable *Instantiate(BMessage *archive); +virtual status_t Archive(BMessage *archive, bool deep = true) const; + +virtual void WindowActivated(bool active); +virtual void AttachedToWindow(); +virtual void MessageReceived(BMessage *message); +virtual void MakeFocus(bool focused = true); +virtual void KeyDown(const char *bytes, int32 numBytes); +virtual void MouseDown(BPoint point); +virtual void MouseUp(BPoint point); +virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message); +virtual void DetachedFromWindow(); + +virtual void SetLabel(const char *string); + const char *Label() const; + +virtual void SetValue(int32 value); + int32 Value() const; + +virtual void SetEnabled(bool enabled); + bool IsEnabled() const; + +virtual void GetPreferredSize(float *width, float *height); +virtual void ResizeToPreferred(); + +virtual status_t Invoke(BMessage *message = NULL); +virtual BHandler *ResolveSpecifier(BMessage *message, + int32 index, + BMessage *specifier, + int32 what, + const char *property); +virtual status_t GetSupportedSuites(BMessage *message); + +virtual void AllAttached(); +virtual void AllDetached(); + +virtual status_t Perform(perform_code d, void *arg); + +protected: + + bool IsFocusChanging() const; + bool IsTracking() const; + void SetTracking(bool state); + + void SetValueNoUpdate(int32 value); + +private: + +virtual void _ReservedControl1(); +virtual void _ReservedControl2(); +virtual void _ReservedControl3(); +virtual void _ReservedControl4(); + + BControl &operator=(const BControl &); + + void InitData(BMessage *data = NULL); + + char *fLabel; + int32 fValue; + bool fEnabled; + bool fFocusChanging; + bool fTracking; + bool fWantsNav; uint32 _reserved[4]; -}; -//------------------------------------------------------------------------------ +}; +//------------------------------------------------------------------------------ -#endif // _CONTROL_H - -/* - * $Log $ - * - * $Id $ - * - */ +#endif // _CONTROL_H Modified: haiku/trunk/src/kits/interface/Control.cpp =================================================================== --- haiku/trunk/src/kits/interface/Control.cpp 2007-06-09 04:15:27 UTC (rev 21362) +++ haiku/trunk/src/kits/interface/Control.cpp 2007-06-09 10:47:05 UTC (rev 21363) @@ -54,6 +54,17 @@ } +BControl::BControl(const char *name, const char *label, BMessage *message, + uint32 flags) + : BView(name, flags) +{ + InitData(NULL); + + SetLabel(label); + SetMessage(message); +} + + BControl::~BControl() { free(fLabel); From bonefish at mail.berlios.de Sat Jun 9 12:51:17 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 12:51:17 +0200 Subject: [Haiku-commits] r21364 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200706091051.l59ApHAU009444@sheep.berlios.de> Author: bonefish Date: 2007-06-09 12:51:15 +0200 (Sat, 09 Jun 2007) New Revision: 21364 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21364&view=rev Modified: haiku/trunk/headers/os/interface/Button.h haiku/trunk/src/kits/interface/Button.cpp Log: * Added default value for message in two arguments constructor. * Removed resizing to minimum height in layout-friendly constructors. * Cache preferred size. * Implemented all of Min/Max/PreferredSize(). Modified: haiku/trunk/headers/os/interface/Button.h =================================================================== --- haiku/trunk/headers/os/interface/Button.h 2007-06-09 10:47:05 UTC (rev 21363) +++ haiku/trunk/headers/os/interface/Button.h 2007-06-09 10:51:15 UTC (rev 21364) @@ -57,7 +57,7 @@ BMessage *message, uint32 flags = B_WILL_DRAW | B_NAVIGABLE | B_FULL_UPDATE_ON_RESIZE); - BButton(const char* label, BMessage *message); + BButton(const char* label, BMessage *message = NULL); virtual ~BButton(); @@ -98,10 +98,15 @@ virtual status_t GetSupportedSuites(BMessage *message); virtual status_t Perform(perform_code d, void *arg); +virtual void InvalidateLayout(bool descendants = false); + +virtual BSize MinSize(); virtual BSize MaxSize(); +virtual BSize PreferredSize(); private: + BSize _ValidatePreferredSize(); virtual void _ReservedButton1(); virtual void _ReservedButton2(); @@ -115,9 +120,9 @@ status_t Execute (); - float fCachedWidth; + BSize fPreferredSize; bool fDrawAsDefault; - uint32 _reserved[3]; + uint32 _reserved[2]; }; //------------------------------------------------------------------------------ Modified: haiku/trunk/src/kits/interface/Button.cpp =================================================================== --- haiku/trunk/src/kits/interface/Button.cpp 2007-06-09 10:47:05 UTC (rev 21363) +++ haiku/trunk/src/kits/interface/Button.cpp 2007-06-09 10:51:15 UTC (rev 21364) @@ -23,6 +23,7 @@ uint32 resizingMode, uint32 flags) : BControl(frame, name, label, message, resizingMode, flags | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), + fPreferredSize(-1, -1), fDrawAsDefault(false) { // Resize to minimum height if needed @@ -36,31 +37,20 @@ BButton::BButton(const char* name, const char* label, BMessage *message, uint32 flags) - : BControl(BRect(0, 0, -1, -1), name, label, message, B_FOLLOW_NONE, - flags | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_SUPPORTS_LAYOUT), + : BControl(name, label, message, + flags | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), + fPreferredSize(-1, -1), fDrawAsDefault(false) { - // Resize to minimum height if needed - font_height fh; - GetFontHeight(&fh); - float minHeight = 12.0f + (float)ceil(fh.ascent + fh.descent); - if (Bounds().Height() < minHeight) - ResizeTo(Bounds().Width(), minHeight); } BButton::BButton(const char* label, BMessage *message) - : BControl(BRect(0, 0, -1, -1), NULL, label, message, B_FOLLOW_NONE, - B_WILL_DRAW | B_NAVIGABLE | B_FULL_UPDATE_ON_RESIZE - | B_SUPPORTS_LAYOUT), + : BControl(NULL, label, message, + B_WILL_DRAW | B_NAVIGABLE | B_FULL_UPDATE_ON_RESIZE), + fPreferredSize(-1, -1), fDrawAsDefault(false) { - // Resize to minimum height if needed - font_height fh; - GetFontHeight(&fh); - float minHeight = 12.0f + (float)ceil(fh.ascent + fh.descent); - if (Bounds().Height() < minHeight) - ResizeTo(Bounds().Width(), minHeight); } @@ -622,25 +612,13 @@ void BButton::GetPreferredSize(float *_width, float *_height) { - if (_height) { - font_height fontHeight; - GetFontHeight(&fontHeight); + _ValidatePreferredSize(); -// *_height = 12.0f + ceilf(fontHeight.ascent + fontHeight.descent) - *_height = ceilf((fontHeight.ascent + fontHeight.descent) * 1.8) - + (fDrawAsDefault ? 6.0f : 0); - } + if (_width) + *_width = fPreferredSize.width; - if (_width) { - float width = 20.0f + (float)ceil(StringWidth(Label())); - if (width < 75.0f) - width = 75.0f; - - if (fDrawAsDefault) - width += 6.0f; - - *_width = width; - } + if (_height) + *_height = fPreferredSize.height; } @@ -723,13 +701,37 @@ } +void +BButton::InvalidateLayout(bool descendants) +{ + // invalidate cached preferred size + fPreferredSize.Set(-1, -1); + + BControl::InvalidateLayout(descendants); +} + + BSize +BButton::MinSize() +{ + return BLayoutUtils::ComposeSize(ExplicitMinSize(), + _ValidatePreferredSize()); +} + + +BSize BButton::MaxSize() { - float width, height; - GetPreferredSize(&width, &height); + return BLayoutUtils::ComposeSize(ExplicitMaxSize(), + _ValidatePreferredSize()); +} - return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height)); + +BSize +BButton::PreferredSize() +{ + return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), + _ValidatePreferredSize()); } @@ -844,3 +846,31 @@ // White Line StrokeLine(BPoint(x, y + 1.0f), BPoint(x + width, y + 1.0f)); } + + +BSize +BButton::_ValidatePreferredSize() +{ + if (fPreferredSize.width < 0) { + // width + float width = 20.0f + (float)ceil(StringWidth(Label())); + if (width < 75.0f) + width = 75.0f; + + if (fDrawAsDefault) + width += 6.0f; + + fPreferredSize.width = width; + + // height + font_height fontHeight; + GetFontHeight(&fontHeight); + + fPreferredSize.height + = ceilf((fontHeight.ascent + fontHeight.descent) * 1.8) + + (fDrawAsDefault ? 6.0f : 0); + } + + return fPreferredSize; +} + From bonefish at mail.berlios.de Sat Jun 9 12:52:37 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 12:52:37 +0200 Subject: [Haiku-commits] r21365 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200706091052.l59Aqb0L009944@sheep.berlios.de> Author: bonefish Date: 2007-06-09 12:52:36 +0200 (Sat, 09 Jun 2007) New Revision: 21365 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21365&view=rev Modified: haiku/trunk/headers/os/interface/CheckBox.h haiku/trunk/src/kits/interface/CheckBox.cpp Log: Added layout-friendly constructors and implemented Min/Max/PreferredSize(). Modified: haiku/trunk/headers/os/interface/CheckBox.h =================================================================== --- haiku/trunk/headers/os/interface/CheckBox.h 2007-06-09 10:51:15 UTC (rev 21364) +++ haiku/trunk/headers/os/interface/CheckBox.h 2007-06-09 10:52:36 UTC (rev 21365) @@ -51,6 +51,12 @@ BMessage *message, uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW | B_NAVIGABLE); + BCheckBox(const char *name, + const char *label, + BMessage *message, + uint32 flags = B_WILL_DRAW | B_NAVIGABLE); + BCheckBox(const char *label, + BMessage *message = NULL); virtual ~BCheckBox(); /* Archiving */ @@ -88,6 +94,12 @@ virtual status_t Perform(perform_code d, void *arg); +virtual void InvalidateLayout(bool descendants = false); + +virtual BSize MinSize(); +virtual BSize MaxSize(); +virtual BSize PreferredSize(); + private: virtual void _ReservedCheckBox1(); @@ -95,11 +107,12 @@ virtual void _ReservedCheckBox3(); BRect _CheckBoxFrame() const; + BSize _ValidatePreferredSize(); BCheckBox &operator=(const BCheckBox &); + BSize fPreferredSize; bool fOutlined; - uint32 _reserved[2]; }; //------------------------------------------------------------------------------ Modified: haiku/trunk/src/kits/interface/CheckBox.cpp =================================================================== --- haiku/trunk/src/kits/interface/CheckBox.cpp 2007-06-09 10:51:15 UTC (rev 21364) +++ haiku/trunk/src/kits/interface/CheckBox.cpp 2007-06-09 10:52:36 UTC (rev 21365) @@ -10,13 +10,16 @@ #include + +#include #include BCheckBox::BCheckBox(BRect frame, const char *name, const char *label, BMessage *message, uint32 resizingMode, uint32 flags) : BControl(frame, name, label, message, resizingMode, flags), - fOutlined(false) + fPreferredSize(-1, -1), + fOutlined(false) { // Resize to minimum height if needed font_height fontHeight; @@ -28,6 +31,23 @@ } +BCheckBox::BCheckBox(const char *name, const char *label, BMessage *message, + uint32 flags) + : BControl(name, label, message, flags | B_WILL_DRAW | B_NAVIGABLE), + fPreferredSize(-1, -1), + fOutlined(false) +{ +} + + +BCheckBox::BCheckBox(const char *label, BMessage *message) + : BControl(NULL, label, message, B_WILL_DRAW | B_NAVIGABLE), + fPreferredSize(-1, -1), + fOutlined(false) +{ +} + + BCheckBox::~BCheckBox() { } @@ -434,6 +454,40 @@ } +void +BCheckBox::InvalidateLayout(bool descendants) +{ + // invalidate cached preferred size + fPreferredSize.Set(-1, -1); + + BControl::InvalidateLayout(descendants); +} + + +BSize +BCheckBox::MinSize() +{ + return BLayoutUtils::ComposeSize(ExplicitMinSize(), + _ValidatePreferredSize()); +} + + +BSize +BCheckBox::MaxSize() +{ + return BLayoutUtils::ComposeSize(ExplicitMaxSize(), + BSize(B_SIZE_UNLIMITED, _ValidatePreferredSize().height)); +} + + +BSize +BCheckBox::PreferredSize() +{ + return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), + _ValidatePreferredSize()); +} + + void BCheckBox::_ReservedCheckBox1() {} void BCheckBox::_ReservedCheckBox2() {} void BCheckBox::_ReservedCheckBox3() {} @@ -455,3 +509,25 @@ return BRect(1.0f, 3.0f, ceilf(3.0f + fontHeight.ascent), ceilf(5.0f + fontHeight.ascent)); } + + +BSize +BCheckBox::_ValidatePreferredSize() +{ + if (fPreferredSize.width < 0) { + font_height fontHeight; + GetFontHeight(&fontHeight); + + float width = 12.0f + fontHeight.ascent; + + if (Label()) + width += StringWidth(Label()); + + fPreferredSize.width = (float)ceil(width); + + fPreferredSize.height = (float)ceil(6.0f + fontHeight.ascent + + fontHeight.descent); + } + + return fPreferredSize; +} From bonefish at mail.berlios.de Sat Jun 9 12:55:39 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 12:55:39 +0200 Subject: [Haiku-commits] r21366 - haiku/trunk/src/tests/kits/interface/layout/widget_layout_test Message-ID: <200706091055.l59AtdhY011199@sheep.berlios.de> Author: bonefish Date: 2007-06-09 12:55:32 +0200 (Sat, 09 Jun 2007) New Revision: 21366 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21366&view=rev Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.cpp haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.h haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.cpp haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.h Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.cpp haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.h haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Test.h haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp Log: * Pulled most of the implementation of ButtonTest into a new super class ControlTest. * Added a test for BCheckBox. Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.cpp 2007-06-09 10:52:36 UTC (rev 21365) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.cpp 2007-06-09 10:55:32 UTC (rev 21366) @@ -8,30 +8,15 @@ #include #include -#include -#include -#include "CheckBox.h" #include "GroupView.h" -#include "StringView.h" -enum { - MSG_CHANGE_BUTTON_TEXT = 'chbt', - MSG_CHANGE_BUTTON_FONT = 'chbf' -}; - - // constructor ButtonTest::ButtonTest() - : Test("Button", NULL), - fButton(new BButton("test button", "", (BMessage*)NULL)), - fLongTextCheckBox(NULL), - fBigFontCheckBox(NULL), - fDefaultFont(NULL), - fBigFont(NULL) + : ControlTest("Button"), + fButton(new BButton("")) { - _SetButtonText(false); SetView(fButton); } @@ -39,8 +24,6 @@ // destructor ButtonTest::~ButtonTest() { - delete fDefaultFont; - delete fBigFont; } @@ -50,23 +33,11 @@ { GroupView* group = new GroupView(B_VERTICAL); group->SetFrame(controls->Bounds()); - group->SetSpacing(0, 8); controls->AddChild(group); - // long button text - fLongTextCheckBox = new LabeledCheckBox("Long Button Text", - new BMessage(MSG_CHANGE_BUTTON_TEXT), this); - group->AddChild(fLongTextCheckBox); + ControlTest::ActivateTest(group); - // big font - fBigFontCheckBox = new LabeledCheckBox("Big Button Font", - new BMessage(MSG_CHANGE_BUTTON_FONT), this); - group->AddChild(fBigFontCheckBox); - group->AddChild(new Glue()); - - _SetButtonText(false); - _SetButtonFont(false); } @@ -75,56 +46,3 @@ ButtonTest::DectivateTest() { } - - -// MessageReceived -void -ButtonTest::MessageReceived(BMessage* message) -{ - switch (message->what) { - case MSG_CHANGE_BUTTON_TEXT: - _SetButtonText(fLongTextCheckBox->IsSelected()); - break; - case MSG_CHANGE_BUTTON_FONT: - _SetButtonFont(fBigFontCheckBox->IsSelected()); - break; - default: - Test::MessageReceived(message); - break; - } -} - - -// _SetButtonText -void -ButtonTest::_SetButtonText(bool longText) -{ - if (fLongTextCheckBox) - fLongTextCheckBox->SetSelected(longText); - fButton->SetLabel(longText ? "very long text for a simple button" - : "Ooh, press me!"); -} - - -// _SetButtonFont -void -ButtonTest::_SetButtonFont(bool bigFont) -{ - if (fBigFontCheckBox) - fBigFontCheckBox->SetSelected(bigFont); - if (fButton->Window()) { - // get default font lazily - if (!fDefaultFont) { - fDefaultFont = new BFont; - fButton->GetFont(fDefaultFont); - - fBigFont = new BFont(fDefaultFont); - fBigFont->SetSize(20); - } - - // set font - fButton->SetFont(bigFont ? fBigFont : fDefaultFont); - fButton->InvalidateLayout(); - fButton->Invalidate(); - } -} Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.h 2007-06-09 10:52:36 UTC (rev 21365) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.h 2007-06-09 10:55:32 UTC (rev 21366) @@ -6,16 +6,13 @@ #define WIDGET_LAYOUT_TEST_BUTTON_TEST_H -#include "Test.h" +#include "ControlTest.h" class BButton; -class BFont; -class LabeledCheckBox; -class View; -class ButtonTest : public Test { +class ButtonTest : public ControlTest { public: ButtonTest(); virtual ~ButtonTest(); @@ -23,18 +20,8 @@ virtual void ActivateTest(View* controls); virtual void DectivateTest(); - virtual void MessageReceived(BMessage* message); - private: - void _SetButtonText(bool longText); - void _SetButtonFont(bool bigFont); - -private: BButton* fButton; - LabeledCheckBox* fLongTextCheckBox; - LabeledCheckBox* fBigFontCheckBox; - BFont* fDefaultFont; - BFont* fBigFont; }; Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.cpp 2007-06-09 10:52:36 UTC (rev 21365) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.cpp 2007-06-09 10:55:32 UTC (rev 21366) @@ -0,0 +1,54 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#include "CheckBoxTest.h" + +#include + +#include + +#include "GroupView.h" + + +// constructor +CheckBoxTest::CheckBoxTest() + : ControlTest("CheckBox"), + fCheckBox(new BCheckBox("")) +{ + SetView(fCheckBox); +} + + +// destructor +CheckBoxTest::~CheckBoxTest() +{ +} + + +// ActivateTest +void +CheckBoxTest::ActivateTest(View* controls) +{ + // BControl sets its background color to that of its parent in + // AttachedToWindow(). Override. + rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR); + fControl->SetViewColor(background); + fControl->SetLowColor(background); + + GroupView* group = new GroupView(B_VERTICAL); + group->SetFrame(controls->Bounds()); + controls->AddChild(group); + + ControlTest::ActivateTest(group); + + group->AddChild(new Glue()); +} + + +// DectivateTest +void +CheckBoxTest::DectivateTest() +{ +} Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.h 2007-06-09 10:52:36 UTC (rev 21365) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.h 2007-06-09 10:55:32 UTC (rev 21366) @@ -0,0 +1,28 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef WIDGET_LAYOUT_TEST_CHECK_BOX_TEST_H +#define WIDGET_LAYOUT_TEST_CHECK_BOX_TEST_H + + +#include "ControlTest.h" + + +class BCheckBox; + + +class CheckBoxTest : public ControlTest { +public: + CheckBoxTest(); + virtual ~CheckBoxTest(); + + virtual void ActivateTest(View* controls); + virtual void DectivateTest(); + +private: + BCheckBox* fCheckBox; +}; + + +#endif // WIDGET_LAYOUT_TEST_CHECK_BOX_TEST_H Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.cpp 2007-06-09 10:52:36 UTC (rev 21365) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.cpp 2007-06-09 10:55:32 UTC (rev 21366) @@ -0,0 +1,132 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#include "ControlTest.h" + +#include + +#include +#include +#include + +#include "CheckBox.h" +#include "GroupView.h" +#include "StringView.h" + + + +// constructor +ControlTest::ControlTest(const char* name) + : Test(name, NULL), + fControl(NULL), + fLongTextCheckBox(NULL), + fBigFontCheckBox(NULL), + fDefaultFont(NULL), + fBigFont(NULL) +{ +} + + +// destructor +ControlTest::~ControlTest() +{ + delete fDefaultFont; + delete fBigFont; +} + + +// SetView +void +ControlTest::SetView(BView* view) +{ + Test::SetView(view); + fControl = dynamic_cast(view); +} + + +// ActivateTest +void +ControlTest::ActivateTest(View* controls) +{ + GroupView* group = new GroupView(B_VERTICAL); + group->SetFrame(controls->Bounds()); + group->SetSpacing(0, 8); + controls->AddChild(group); + + // long text + fLongTextCheckBox = new LabeledCheckBox("Long label text", + new BMessage(MSG_CHANGE_CONTROL_TEXT), this); + group->AddChild(fLongTextCheckBox); + + // big font + fBigFontCheckBox = new LabeledCheckBox("Big label font", + new BMessage(MSG_CHANGE_CONTROL_FONT), this); + group->AddChild(fBigFontCheckBox); + + UpdateControlText(); + UpdateControlFont(); +} + + +// DectivateTest +void +ControlTest::DectivateTest() +{ +} + + +// MessageReceived +void +ControlTest::MessageReceived(BMessage* message) +{ + switch (message->what) { + case MSG_CHANGE_CONTROL_TEXT: + UpdateControlText(); + break; + case MSG_CHANGE_CONTROL_FONT: + UpdateControlFont(); + break; + default: + Test::MessageReceived(message); + break; + } +} + + +// UpdateControlText +void +ControlTest::UpdateControlText() +{ + if (!fLongTextCheckBox || !fControl) + return; + + fControl->SetLabel(fLongTextCheckBox->IsSelected() + ? "Very long label for a simple control" + : "Short label"); +} + + +// UpdateControlFont +void +ControlTest::UpdateControlFont() +{ + if (!fBigFontCheckBox || !fControl || !fControl->Window()) + return; + + // get default font lazily + if (!fDefaultFont) { + fDefaultFont = new BFont; + fControl->GetFont(fDefaultFont); + + fBigFont = new BFont(fDefaultFont); + fBigFont->SetSize(20); + } + + // set font + fControl->SetFont(fBigFontCheckBox->IsSelected() + ? fBigFont : fDefaultFont); + fControl->InvalidateLayout(); + fControl->Invalidate(); +} Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.h 2007-06-09 10:52:36 UTC (rev 21365) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.h 2007-06-09 10:55:32 UTC (rev 21366) @@ -0,0 +1,49 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef WIDGET_LAYOUT_TEST_CONTROL_TEST_H +#define WIDGET_LAYOUT_TEST_CONTROL_TEST_H + + +#include "Test.h" + + +class BButton; +class BFont; +class LabeledCheckBox; +class View; + + +class ControlTest : public Test { +public: + ControlTest(const char* name); + virtual ~ControlTest(); + + virtual void SetView(BView* view); + + virtual void ActivateTest(View* controls); + virtual void DectivateTest(); + + virtual void MessageReceived(BMessage* message); + +protected: + enum { + MSG_CHANGE_CONTROL_TEXT = 'chct', + MSG_CHANGE_CONTROL_FONT = 'chcf' + }; + +protected: + void UpdateControlText(); + void UpdateControlFont(); + +protected: + BControl* fControl; + LabeledCheckBox* fLongTextCheckBox; + LabeledCheckBox* fBigFontCheckBox; + BFont* fDefaultFont; + BFont* fBigFont; +}; + + +#endif // WIDGET_LAYOUT_TEST_CONTROL_TEST_H Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile 2007-06-09 10:52:36 UTC (rev 21365) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile 2007-06-09 10:55:32 UTC (rev 21366) @@ -9,6 +9,8 @@ BoxTest.cpp ButtonTest.cpp CheckBox.cpp + CheckBoxTest.cpp + ControlTest.cpp GroupView.cpp RadioButton.cpp StringView.cpp Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Test.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Test.h 2007-06-09 10:52:36 UTC (rev 21365) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Test.h 2007-06-09 10:55:32 UTC (rev 21366) @@ -24,7 +24,7 @@ const char* Description() const; virtual BView* GetView() const; - void SetView(BView* view); + virtual void SetView(BView* view); virtual void ActivateTest(View* controls); virtual void DectivateTest(); Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp 2007-06-09 10:52:36 UTC (rev 21365) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp 2007-06-09 10:55:32 UTC (rev 21366) @@ -11,6 +11,7 @@ #include "BoxTest.h" #include "ButtonTest.h" #include "CheckBox.h" +#include "CheckBoxTest.h" #include "GroupView.h" #include "StringView.h" #include "Test.h" @@ -273,6 +274,8 @@ test = new BoxTest; } else if (strcmp(testName, "button") == 0) { test = new ButtonTest; + } else if (strcmp(testName, "checkbox") == 0) { + test = new CheckBoxTest; } else { fprintf(stderr, "Error: Invalid test name: \"%s\"\n", testName); exit(1); From korli at mail.berlios.de Sat Jun 9 12:59:51 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 9 Jun 2007 12:59:51 +0200 Subject: [Haiku-commits] r21367 - in haiku/trunk: headers/libs/png src/libs/png Message-ID: <200706091059.l59Axp0r017664@sheep.berlios.de> Author: korli Date: 2007-06-09 12:59:46 +0200 (Sat, 09 Jun 2007) New Revision: 21367 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21367&view=rev Removed: haiku/trunk/src/libs/png/png.h haiku/trunk/src/libs/png/pngconf.h Modified: haiku/trunk/headers/libs/png/png.h haiku/trunk/headers/libs/png/pngconf.h haiku/trunk/src/libs/png/Jamfile haiku/trunk/src/libs/png/png.c haiku/trunk/src/libs/png/pngerror.c haiku/trunk/src/libs/png/pnggccrd.c haiku/trunk/src/libs/png/pngget.c haiku/trunk/src/libs/png/pngmem.c haiku/trunk/src/libs/png/pngpread.c haiku/trunk/src/libs/png/pngread.c haiku/trunk/src/libs/png/pngrio.c haiku/trunk/src/libs/png/pngrtran.c haiku/trunk/src/libs/png/pngrutil.c haiku/trunk/src/libs/png/pngset.c haiku/trunk/src/libs/png/pngtrans.c haiku/trunk/src/libs/png/pngwio.c haiku/trunk/src/libs/png/pngwrite.c haiku/trunk/src/libs/png/pngwutil.c Log: updated libpng to 1.2.18, thanks Fredrik! Modified: haiku/trunk/headers/libs/png/png.h =================================================================== --- haiku/trunk/headers/libs/png/png.h 2007-06-09 10:55:32 UTC (rev 21366) +++ haiku/trunk/headers/libs/png/png.h 2007-06-09 10:59:46 UTC (rev 21367) @@ -1,15 +1,15 @@ /* png.h - header file for PNG reference library * - * libpng version 1.2.12 - June 27, 2006 - * Copyright (c) 1998-2006 Glenn Randers-Pehrson + * libpng version 1.2.18 - May 15, 2007 + * Copyright (c) 1998-2007 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.2.12 - June 27, 2006: Glenn + * libpng versions 0.97, January 1998, through 1.2.18 - May 15, 2007: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -126,6 +126,30 @@ * 1.2.11 13 10211 12.so.0.11[.0] * 1.0.20 10 10020 10.so.0.20[.0] * 1.2.12 13 10212 12.so.0.12[.0] + * 1.2.13beta1 13 10213 12.so.0.13[.0] + * 1.0.21 10 10021 10.so.0.21[.0] + * 1.2.13 13 10213 12.so.0.13[.0] + * 1.2.14beta1-2 13 10214 12.so.0.14[.0] + * 1.0.22rc1 10 10022 10.so.0.22[.0] + * 1.2.14rc1 13 10214 12.so.0.14[.0] + * 1.0.22 10 10022 10.so.0.22[.0] + * 1.2.14 13 10214 12.so.0.14[.0] + * 1.2.15beta1-6 13 10215 12.so.0.15[.0] + * 1.0.23rc1-5 10 10023 10.so.0.23[.0] + * 1.2.15rc1-5 13 10215 12.so.0.15[.0] + * 1.0.23 10 10023 10.so.0.23[.0] + * 1.2.15 13 10215 12.so.0.15[.0] + * 1.2.16beta1-2 13 10216 12.so.0.16[.0] + * 1.2.16rc1 13 10216 12.so.0.16[.0] + * 1.0.24 10 10024 10.so.0.24[.0] + * 1.2.16 13 10216 12.so.0.16[.0] + * 1.2.17beta1-2 13 10217 12.so.0.17[.0] + * 1.0.25rc1 10 10025 10.so.0.25[.0] + * 1.2.17rc1-3 13 10217 12.so.0.17[.0] + * 1.0.25 10 10025 10.so.0.25[.0] + * 1.2.17 13 10217 12.so.0.17[.0] + * 1.0.26 10 10026 10.so.0.26[.0] + * 1.2.18 13 10218 12.so.0.18[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -155,8 +179,8 @@ * If you modify libpng you may insert additional notices immediately following * this sentence. * - * libpng versions 1.2.6, August 15, 2004, through 1.2.12, June 27, 2006, are - * Copyright (c) 2004, 2006 Glenn Randers-Pehrson, and are + * libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are + * Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: * @@ -267,13 +291,13 @@ * Y2K compliance in libpng: * ========================= * - * June 27, 2006 + * May 15, 2007 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.2.12 are Y2K compliant. It is my belief that earlier + * upward through 1.2.18 are Y2K compliant. It is my belief that earlier * versions were also Y2K compliant. * * Libpng only has three year fields. One is a 2-byte unsigned integer @@ -329,9 +353,9 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.2.12" +#define PNG_LIBPNG_VER_STRING "1.2.18" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.2.12 - June 27, 2006 (header)\n" + " libpng version 1.2.18 - May 15, 2007 (header)\n" #define PNG_LIBPNG_VER_SONUM 0 #define PNG_LIBPNG_VER_DLLNUM 13 @@ -339,7 +363,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 2 -#define PNG_LIBPNG_VER_RELEASE 12 +#define PNG_LIBPNG_VER_RELEASE 18 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ @@ -367,7 +391,7 @@ * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ -#define PNG_LIBPNG_VER 10212 /* 1.2.12 */ +#define PNG_LIBPNG_VER 10218 /* 1.2.18 */ #ifndef PNG_VERSION_INFO_ONLY /* include the compression library's header */ @@ -1334,10 +1358,14 @@ #endif /* New members added in libpng-1.2.0 */ -#if !defined(PNG_1_0_X) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +# if !defined(PNG_1_0_X) +# if defined(PNG_MMX_CODE_SUPPORTED) png_byte mmx_bitdepth_threshold; png_uint_32 mmx_rowbytes_threshold; +# endif png_uint_32 asm_flags; +# endif #endif /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ @@ -1367,13 +1395,18 @@ png_uint_32 user_height_max; #endif +/* New member added in libpng-1.0.25 and 1.2.17 */ +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) + /* storage for unknown chunk that the library doesn't recognize. */ + png_unknown_chunk unknown_chunk; +#endif }; /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef png_structp version_1_2_12; +typedef png_structp version_1_2_18; typedef png_struct FAR * FAR * png_structpp; @@ -2369,7 +2402,7 @@ handling or default unknown chunk handling is not desired. Any chunks not listed will be handled in the default manner. The IHDR and IEND chunks must not be listed. - keep = 0: follow default behavour + keep = 0: follow default behaviour = 1: do not keep = 2: keep only if safe-to-copy = 3: keep even if unsafe-to-copy @@ -2479,6 +2512,7 @@ /* Added to version 1.2.0 */ #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if defined(PNG_MMX_CODE_SUPPORTED) #define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */ #define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */ #define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04 @@ -2504,6 +2538,7 @@ #define PNG_SELECT_READ 1 #define PNG_SELECT_WRITE 2 +#endif /* PNG_MMX_CODE_SUPPORTED */ #if !defined(PNG_1_0_X) /* pngget.c */ @@ -2536,11 +2571,11 @@ png_uint_32 mmx_rowbytes_threshold)); #endif /* PNG_1_0_X */ -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ #if !defined(PNG_1_0_X) /* png.c, pnggccrd.c, or pngvcrd.c */ extern PNG_EXPORT(int,png_mmx_support) PNGARG((void)); +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ /* Strip the prepended error numbers ("#nnn ") from error and warning * messages before passing them to the error or warning handler. */ @@ -2648,16 +2683,21 @@ * be found in the files where the functions are located. */ -#if defined(PNG_INTERNAL) -/* Various modes of operation. Note that after an init, mode is set to - * zero automatically when the structure is created. +/* Various modes of operation, that are visible to applications because + * they are used for unknown chunk location. */ #define PNG_HAVE_IHDR 0x01 #define PNG_HAVE_PLTE 0x02 #define PNG_HAVE_IDAT 0x04 #define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */ #define PNG_HAVE_IEND 0x10 + +#if defined(PNG_INTERNAL) + +/* More modes of operation. Note that after an init, mode is set to + * zero automatically when the structure is created. + */ #define PNG_HAVE_gAMA 0x20 #define PNG_HAVE_cHRM 0x40 #define PNG_HAVE_sRGB 0x80 @@ -3442,9 +3482,11 @@ #endif #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if defined(PNG_MMX_CODE_SUPPORTED) /* png.c */ /* PRIVATE */ PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr)); #endif +#endif #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr, Modified: haiku/trunk/headers/libs/png/pngconf.h =================================================================== --- haiku/trunk/headers/libs/png/pngconf.h 2007-06-09 10:55:32 UTC (rev 21366) +++ haiku/trunk/headers/libs/png/pngconf.h 2007-06-09 10:59:46 UTC (rev 21367) @@ -1,9 +1,9 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.2.12 - June 27, 2006 + * libpng version 1.2.18 - May 15, 2007 * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2005 Glenn Randers-Pehrson + * Copyright (c) 1998-2007 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ @@ -721,11 +721,22 @@ #endif /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 - even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */ + * even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined. + * + * PNG_NO_ASSEMBLER_CODE disables use of all assembler code and optimized C, + * and removes or includes several functions in the API. + * + * PNG_NO_MMX_CODE disables the use of MMX code without changing the API. + * When MMX code is off, then optimized C replacement functions are used. +*/ #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE) # ifndef PNG_ASSEMBLER_CODE_SUPPORTED # define PNG_ASSEMBLER_CODE_SUPPORTED # endif +# if defined(XP_MACOSX) && !defined(PNG_NO_MMX_CODE) + /* work around Intel-Mac compiler bug */ +# define PNG_NO_MMX_CODE +# endif # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) && \ defined(__MMX__) # define PNG_MMX_CODE_SUPPORTED @@ -1447,9 +1458,9 @@ * MMX will be detected at run time and used if present. */ #ifdef PNG_USE_PNGVCRD -# define PNG_HAVE_ASSEMBLER_COMBINE_ROW -# define PNG_HAVE_ASSEMBLER_READ_INTERLACE -# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW +# define PNG_HAVE_MMX_COMBINE_ROW +# define PNG_HAVE_MMX_READ_INTERLACE +# define PNG_HAVE_MMX_READ_FILTER_ROW #endif /* Set this in the makefile for gcc/as on Pentium, not here. */ @@ -1457,9 +1468,9 @@ * MMX will be detected at run time and used if present. */ #ifdef PNG_USE_PNGGCCRD -# define PNG_HAVE_ASSEMBLER_COMBINE_ROW -# define PNG_HAVE_ASSEMBLER_READ_INTERLACE -# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW +# define PNG_HAVE_MMX_COMBINE_ROW +# define PNG_HAVE_MMX_READ_INTERLACE +# define PNG_HAVE_MMX_READ_FILTER_ROW #endif /* - see pnggccrd.c for info about what is currently enabled */ Modified: haiku/trunk/src/libs/png/Jamfile =================================================================== --- haiku/trunk/src/libs/png/Jamfile 2007-06-09 10:55:32 UTC (rev 21366) +++ haiku/trunk/src/libs/png/Jamfile 2007-06-09 10:59:46 UTC (rev 21367) @@ -3,7 +3,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; AddSubDirSupportedPlatforms libbe_test ; -UseLibraryHeaders zlib ; +UseLibraryHeaders png zlib ; local shared_files = png.c Modified: haiku/trunk/src/libs/png/png.c =================================================================== --- haiku/trunk/src/libs/png/png.c 2007-06-09 10:55:32 UTC (rev 21366) +++ haiku/trunk/src/libs/png/png.c 2007-06-09 10:59:46 UTC (rev 21367) @@ -1,9 +1,9 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.2.9 April 14, 2006 + * Last changed in libpng 1.2.17 May 15, 2007 * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2006 Glenn Randers-Pehrson + * Copyright (c) 1998-2007 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ @@ -13,7 +13,7 @@ #include "png.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_2_12 Your_png_h_is_not_version_1_2_12; +typedef version_1_2_18 Your_png_h_is_not_version_1_2_18; /* Version information for C files. This had better match the version * string defined in png.h. */ @@ -68,7 +68,7 @@ const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; /* width of interlace block (used in assembler routines only) */ -#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW +#ifdef PNG_HAVE_MMX_COMBINE_ROW const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; #endif @@ -97,6 +97,7 @@ void PNGAPI png_set_sig_bytes(png_structp png_ptr, int num_bytes) { + if(png_ptr == NULL) return; png_debug(1, "in png_set_sig_bytes\n"); if (num_bytes > 8) png_error(png_ptr, "Too many bytes for PNG signature."); @@ -153,13 +154,14 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size) { png_voidp ptr; - png_structp p=png_ptr; + png_structp p=(png_structp)png_ptr; png_uint_32 save_flags=p->flags; png_uint_32 num_bytes; + if(png_ptr == NULL) return (NULL); if (items > PNG_UINT_32_MAX/size) { - png_warning (png_ptr, "Potential overflow in png_zalloc()"); + png_warning (p, "Potential overflow in png_zalloc()"); return (NULL); } num_bytes = (png_uint_32)items * size; @@ -266,6 +268,7 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr) { png_infop info_ptr = NULL; + if(png_ptr == NULL) return; png_debug(1, "in png_destroy_info_struct\n"); if (info_ptr_ptr != NULL) @@ -304,6 +307,8 @@ { png_infop info_ptr = *ptr_ptr; + if(info_ptr == NULL) return; + png_debug(1, "in png_info_init_3\n"); if(png_sizeof(png_info) > png_info_struct_size) @@ -485,6 +490,11 @@ #endif #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) + if(png_ptr->unknown_chunk.data) + { + png_free(png_ptr, png_ptr->unknown_chunk.data); + png_ptr->unknown_chunk.data = NULL; + } #ifdef PNG_FREE_ME_SUPPORTED if ((mask & PNG_FREE_UNKN) & info_ptr->free_me) #else @@ -611,6 +621,7 @@ png_voidp PNGAPI png_get_io_ptr(png_structp png_ptr) { + if(png_ptr == NULL) return (NULL); return (png_ptr->io_ptr); } @@ -626,6 +637,7 @@ png_init_io(png_structp png_ptr, png_FILE_p fp) { png_debug(1, "in png_init_io\n"); + if(png_ptr == NULL) return; png_ptr->io_ptr = (png_voidp)fp; } #endif @@ -641,6 +653,7 @@ {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + if(png_ptr == NULL) return (NULL); if (png_ptr->time_buffer == NULL) { png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29* @@ -693,8 +706,8 @@ png_get_copyright(png_structp png_ptr) { if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */ - return ((png_charp) "\n libpng version 1.2.12 - June 27, 2006\n\ - Copyright (c) 1998-2006 Glenn Randers-Pehrson\n\ + return ((png_charp) "\n libpng version 1.2.18 - May 15, 2007\n\ + Copyright (c) 1998-2007 Glenn Randers-Pehrson\n\ Copyright (c) 1996-1997 Andreas Dilger\n\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n"); return ((png_charp) ""); @@ -757,6 +770,7 @@ int PNGAPI png_reset_zstream(png_structp png_ptr) { + if (png_ptr == NULL) return Z_STREAM_ERROR; return (inflateReset(&png_ptr->zstream)); } #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ @@ -770,14 +784,14 @@ } -#if defined(PNG_READ_SUPPORTED) +#if defined(PNG_READ_SUPPORTED) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) #if !defined(PNG_1_0_X) -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) - /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */ +#if defined(PNG_MMX_CODE_SUPPORTED) /* this INTERNAL function was added to libpng 1.2.0 */ void /* PRIVATE */ png_init_mmx_flags (png_structp png_ptr) { + if(png_ptr == NULL) return; png_ptr->mmx_rowbytes_threshold = 0; png_ptr->mmx_bitdepth_threshold = 0; @@ -787,13 +801,13 @@ if (png_mmx_support() > 0) { png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU -# ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW +# ifdef PNG_HAVE_MMX_COMBINE_ROW | PNG_ASM_FLAG_MMX_READ_COMBINE_ROW # endif -# ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE +# ifdef PNG_HAVE_MMX_READ_INTERLACE | PNG_ASM_FLAG_MMX_READ_INTERLACE # endif -# ifndef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW +# ifndef PNG_HAVE_MMX_READ_FILTER_ROW ; # else | PNG_ASM_FLAG_MMX_READ_FILTER_SUB @@ -810,7 +824,7 @@ | PNG_MMX_WRITE_FLAGS ); } -# else /* !((PNGVCRD || PNGGCCRD) && PNG_ASSEMBLER_CODE_SUPPORTED)) */ +# else /* !(PNGVCRD || PNGGCCRD) */ /* clear all MMX flags; no support is compiled in */ png_ptr->asm_flags &= ~( PNG_MMX_FLAGS ); @@ -818,18 +832,18 @@ # endif /* ?(PNGVCRD || PNGGCCRD) */ } -#endif /* !(PNG_ASSEMBLER_CODE_SUPPORTED) */ +#endif /* !(PNG_MMX_CODE_SUPPORTED) */ /* this function was added to libpng 1.2.0 */ #if !defined(PNG_USE_PNGGCCRD) && \ - !(defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD)) + !(defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD)) int PNGAPI png_mmx_support(void) { return -1; } #endif -#endif /* PNG_1_0_X */ +#endif /* PNG_1_0_X && PNG_ASSEMBLER_CODE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */ #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) Deleted: haiku/trunk/src/libs/png/png.h Deleted: haiku/trunk/src/libs/png/pngconf.h Modified: haiku/trunk/src/libs/png/pngerror.c =================================================================== --- haiku/trunk/src/libs/png/pngerror.c 2007-06-09 10:55:32 UTC (rev 21366) +++ haiku/trunk/src/libs/png/pngerror.c 2007-06-09 10:59:46 UTC (rev 21367) @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.2.9 April 14, 2006 + * Last changed in libpng 1.2.13 November 13, 2006 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2006 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -113,7 +113,7 @@ * if the character is invalid. */ #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) -static PNG_CONST char png_digit[16] = { +const static PNG_CONST char png_digit[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; @@ -157,8 +157,11 @@ char msg[18+64]; if (png_ptr == NULL) png_error(png_ptr, error_message); - png_format_buffer(png_ptr, msg, error_message); - png_error(png_ptr, msg); + else + { + png_format_buffer(png_ptr, msg, error_message); + png_error(png_ptr, msg); + } } void PNGAPI @@ -167,8 +170,11 @@ char msg[18+64]; if (png_ptr == NULL) png_warning(png_ptr, warning_message); - png_format_buffer(png_ptr, msg, warning_message); - png_warning(png_ptr, msg); + else + { + png_format_buffer(png_ptr, msg, warning_message); + png_warning(png_ptr, msg); + } } /* This is the default error handling function. Note that replacements for @@ -206,6 +212,8 @@ #endif #ifdef PNG_SETJMP_SUPPORTED + if (png_ptr) + { # ifdef USE_FAR_KEYWORD { jmp_buf jmpbuf; @@ -214,10 +222,9 @@ } # else longjmp(png_ptr->jmpbuf, 1); -# endif +# endif + } #else - /* make compiler happy */ ; - if (png_ptr) PNG_ABORT(); #endif #ifdef PNG_NO_CONSOLE_IO Modified: haiku/trunk/src/libs/png/pnggccrd.c =================================================================== --- haiku/trunk/src/libs/png/pnggccrd.c 2007-06-09 10:55:32 UTC (rev 21366) +++ haiku/trunk/src/libs/png/pnggccrd.c 2007-06-09 10:59:46 UTC (rev 21367) @@ -7,9 +7,9 @@ * and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm * for Intel's performance analysis of the MMX vs. non-MMX code. * - * Last changed in libpng 1.2.9 April 14, 2006 + * Last changed in libpng 1.2.15 January 5, 2007 * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2006 Glenn Randers-Pehrson + * Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998, Intel Corporation * * Based on MSVC code contributed by Nirav Chhatrapati, Intel Corp., 1998. @@ -245,17 +245,17 @@ #define PNG_INTERNAL #include "png.h" -#if defined(PNG_USE_PNGGCCRD) +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGGCCRD) int PNGAPI png_mmx_support(void); #ifdef PNG_USE_LOCAL_ARRAYS -static const int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; -static const int FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; -static const int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1}; +const static int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; +const static int FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; +const static int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1}; #endif -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if defined(PNG_MMX_CODE_SUPPORTED) /* djgpp, Win32, Cygwin, and OS2 add their own underscores to global variables, * so define them without: */ #if defined(__DJGPP__) || defined(WIN32) || defined(__CYGWIN__) || \ @@ -311,30 +311,30 @@ static int _unmask; #endif -static unsigned long long _mask8_0 = 0x0102040810204080LL; +const static unsigned long long _mask8_0 = 0x0102040810204080LL; -static unsigned long long _mask16_1 = 0x0101020204040808LL; -static unsigned long long _mask16_0 = 0x1010202040408080LL; +const static unsigned long long _mask16_1 = 0x0101020204040808LL; +const static unsigned long long _mask16_0 = 0x1010202040408080LL; -static unsigned long long _mask24_2 = 0x0101010202020404LL; -static unsigned long long _mask24_1 = 0x0408080810101020LL; -static unsigned long long _mask24_0 = 0x2020404040808080LL; +const static unsigned long long _mask24_2 = 0x0101010202020404LL; +const static unsigned long long _mask24_1 = 0x0408080810101020LL; +const static unsigned long long _mask24_0 = 0x2020404040808080LL; -static unsigned long long _mask32_3 = 0x0101010102020202LL; -static unsigned long long _mask32_2 = 0x0404040408080808LL; -static unsigned long long _mask32_1 = 0x1010101020202020LL; -static unsigned long long _mask32_0 = 0x4040404080808080LL; +const static unsigned long long _mask32_3 = 0x0101010102020202LL; +const static unsigned long long _mask32_2 = 0x0404040408080808LL; +const static unsigned long long _mask32_1 = 0x1010101020202020LL; +const static unsigned long long _mask32_0 = 0x4040404080808080LL; -static unsigned long long _mask48_5 = 0x0101010101010202LL; -static unsigned long long _mask48_4 = 0x0202020204040404LL; -static unsigned long long _mask48_3 = 0x0404080808080808LL; -static unsigned long long _mask48_2 = 0x1010101010102020LL; -static unsigned long long _mask48_1 = 0x2020202040404040LL; -static unsigned long long _mask48_0 = 0x4040808080808080LL; +const static unsigned long long _mask48_5 = 0x0101010101010202LL; +const static unsigned long long _mask48_4 = 0x0202020204040404LL; +const static unsigned long long _mask48_3 = 0x0404080808080808LL; +const static unsigned long long _mask48_2 = 0x1010101010102020LL; +const static unsigned long long _mask48_1 = 0x2020202040404040LL; +const static unsigned long long _mask48_0 = 0x4040808080808080LL; -static unsigned long long _const4 = 0x0000000000FFFFFFLL; -//static unsigned long long _const5 = 0x000000FFFFFF0000LL; // NOT USED -static unsigned long long _const6 = 0x00000000000000FFLL; +const static unsigned long long _const4 = 0x0000000000FFFFFFLL; +//const static unsigned long long _const5 = 0x000000FFFFFF0000LL; // NOT USED +const static unsigned long long _const6 = 0x00000000000000FFLL; // These are used in the row-filter routines and should/would be local // variables if not for gcc addressing limitations. @@ -378,7 +378,7 @@ _mask48_1 = _mask48_1; _mask48_0 = _mask48_0; } -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ static int _mmx_supported = 2; @@ -389,7 +389,7 @@ /* */ /*===========================================================================*/ -#if defined(PNG_HAVE_ASSEMBLER_COMBINE_ROW) +#if defined(PNG_HAVE_MMX_COMBINE_ROW) #define BPP2 2 #define BPP3 3 /* bytes per pixel (a.k.a. pixel_bytes) */ @@ -416,7 +416,7 @@ { png_debug(1, "in png_combine_row (pnggccrd.c)\n"); -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if defined(PNG_MMX_CODE_SUPPORTED) if (_mmx_supported == 2) { #if !defined(PNG_1_0_X) /* this should have happened in png_init_mmx_flags() already */ @@ -607,7 +607,7 @@ png_bytep srcptr; png_bytep dstptr; -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if !defined(PNG_1_0_X) if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) /* && _mmx_supported */ ) @@ -700,7 +700,7 @@ ); } else /* mmx _not supported - Use modified C routine */ -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ { register png_uint_32 i; png_uint_32 initial_val = png_pass_start[png_ptr->pass]; @@ -745,7 +745,7 @@ png_bytep srcptr; png_bytep dstptr; -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if !defined(PNG_1_0_X) if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) /* && _mmx_supported */ ) @@ -854,7 +854,7 @@ ); } else /* mmx _not supported - Use modified C routine */ -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ { register png_uint_32 i; png_uint_32 initial_val = BPP2 * png_pass_start[png_ptr->pass]; @@ -898,7 +898,7 @@ png_bytep srcptr; png_bytep dstptr; -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if !defined(PNG_1_0_X) if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) /* && _mmx_supported */ ) @@ -1022,7 +1022,7 @@ ); } else /* mmx _not supported - Use modified C routine */ -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ { register png_uint_32 i; png_uint_32 initial_val = BPP3 * png_pass_start[png_ptr->pass]; @@ -1066,7 +1066,7 @@ png_bytep srcptr; png_bytep dstptr; -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if !defined(PNG_1_0_X) if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) /* && _mmx_supported */ ) @@ -1197,7 +1197,7 @@ ); } else /* mmx _not supported - Use modified C routine */ -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ { register png_uint_32 i; png_uint_32 initial_val = BPP4 * png_pass_start[png_ptr->pass]; @@ -1241,7 +1241,7 @@ png_bytep srcptr; png_bytep dstptr; -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if !defined(PNG_1_0_X) if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) /* && _mmx_supported */ ) @@ -1389,7 +1389,7 @@ ); } else /* mmx _not supported - Use modified C routine */ -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ { register png_uint_32 i; png_uint_32 initial_val = BPP6 * png_pass_start[png_ptr->pass]; @@ -1480,7 +1480,7 @@ } /* end png_combine_row() */ -#endif /* PNG_HAVE_ASSEMBLER_COMBINE_ROW */ +#endif /* PNG_HAVE_MMX_COMBINE_ROW */ @@ -1492,7 +1492,7 @@ /*===========================================================================*/ #if defined(PNG_READ_INTERLACING_SUPPORTED) -#if defined(PNG_HAVE_ASSEMBLER_READ_INTERLACE) +#if defined(PNG_HAVE_MMX_READ_INTERLACE) /* png_do_read_interlace() is called after any 16-bit to 8-bit conversion * has taken place. [GRR: what other steps come before and/or after?] @@ -1510,7 +1510,7 @@ png_debug(1, "in png_do_read_interlace (pnggccrd.c)\n"); -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if defined(PNG_MMX_CODE_SUPPORTED) if (_mmx_supported == 2) { #if !defined(PNG_1_0_X) /* this should have happened in png_init_mmx_flags() already */ @@ -1723,7 +1723,7 @@ /* New code by Nirav Chhatrapati - Intel Corporation */ -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if defined(PNG_MMX_CODE_SUPPORTED) #if !defined(PNG_1_0_X) if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE) /* && _mmx_supported */ ) @@ -2628,7 +2628,7 @@ /* GRR 19991007: does it? or should pixel_bytes in each * block be replaced with immediate value (e.g., 1)? */ /* GRR 19991017: replaced with constants in each case */ -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ { if (pixel_bytes == 1) { @@ -2753,13 +2753,13 @@ } /* end png_do_read_interlace() */ -#endif /* PNG_HAVE_ASSEMBLER_READ_INTERLACE */ +#endif /* PNG_HAVE_MMX_READ_INTERLACE */ #endif /* PNG_READ_INTERLACING_SUPPORTED */ -#if defined(PNG_HAVE_ASSEMBLER_READ_FILTER_ROW) -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if defined(PNG_HAVE_MMX_READ_FILTER_ROW) +#if defined(PNG_MMX_CODE_SUPPORTED) // These variables are utilized in the functions below. They are declared // globally here to ensure alignment on 8-byte boundaries. @@ -5066,7 +5066,7 @@ } // end of png_read_filter_row_mmx_up() -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ @@ -5088,7 +5088,7 @@ char filnm[10]; #endif -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if defined(PNG_MMX_CODE_SUPPORTED) /* GRR: these are superseded by png_ptr->asm_flags: */ #define UseMMX_sub 1 // GRR: converted 20000730 #define UseMMX_up 1 // GRR: converted 20000729 @@ -5102,7 +5102,7 @@ #endif png_mmx_support(); } -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ #ifdef PNG_DEBUG png_debug(1, "in png_read_filter_row (pnggccrd.c)\n"); @@ -5111,7 +5111,7 @@ case 0: sprintf(filnm, "none"); break; case 1: sprintf(filnm, "sub-%s", -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if !defined(PNG_1_0_X) (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" : #endif @@ -5119,7 +5119,7 @@ "x86"); break; case 2: sprintf(filnm, "up-%s", -#ifdef PNG_ASSEMBLER_CODE_SUPPORTED +#ifdef PNG_MMX_CODE_SUPPORTED #if !defined(PNG_1_0_X) (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "MMX" : #endif @@ -5127,7 +5127,7 @@ "x86"); break; case 3: sprintf(filnm, "avg-%s", -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if !defined(PNG_1_0_X) (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "MMX" : #endif @@ -5135,7 +5135,7 @@ "x86"); break; case 4: sprintf(filnm, "Paeth-%s", -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if !defined(PNG_1_0_X) (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX": #endif @@ -5158,7 +5158,7 @@ break; case PNG_FILTER_VALUE_SUB: -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if !defined(PNG_1_0_X) if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) && (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && @@ -5170,7 +5170,7 @@ png_read_filter_row_mmx_sub(row_info, row); } else -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ { png_uint_32 i; png_uint_32 istop = row_info->rowbytes; @@ -5187,7 +5187,7 @@ break; case PNG_FILTER_VALUE_UP: -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if defined(PNG_MMX_CODE_SUPPORTED) #if !defined(PNG_1_0_X) if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) && (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && @@ -5199,7 +5199,7 @@ png_read_filter_row_mmx_up(row_info, row, prev_row); } else -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ { png_uint_32 i; png_uint_32 istop = row_info->rowbytes; @@ -5215,7 +5215,7 @@ break; case PNG_FILTER_VALUE_AVG: -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if !defined(PNG_1_0_X) if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) && (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && @@ -5227,7 +5227,7 @@ png_read_filter_row_mmx_avg(row_info, row, prev_row); } else -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ { png_uint_32 i; png_bytep rp = row; @@ -5253,7 +5253,7 @@ break; case PNG_FILTER_VALUE_PAETH: -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) #if !defined(PNG_1_0_X) if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) && (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && @@ -5265,7 +5265,7 @@ png_read_filter_row_mmx_paeth(row_info, row, prev_row); } else -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ +#endif /* PNG_MMX_CODE_SUPPORTED */ { png_uint_32 i; png_bytep rp = row; @@ -5326,7 +5326,7 @@ } } -#endif /* PNG_HAVE_ASSEMBLER_READ_FILTER_ROW */ +#endif /* PNG_HAVE_MMX_READ_FILTER_ROW */ /*===========================================================================*/ Modified: haiku/trunk/src/libs/png/pngget.c =================================================================== --- haiku/trunk/src/libs/png/pngget.c 2007-06-09 10:55:32 UTC (rev 21366) +++ haiku/trunk/src/libs/png/pngget.c 2007-06-09 10:59:46 UTC (rev 21367) @@ -1,9 +1,9 @@ /* pngget.c - retrieval of values from info struct * [... truncated: 1282 lines follow ...] From bonefish at mail.berlios.de Sat Jun 9 13:21:18 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 9 Jun 2007 13:21:18 +0200 Subject: [Haiku-commits] r21368 - haiku/trunk/src/kits/interface Message-ID: <200706091121.l59BLIxq023442@sheep.berlios.de> Author: bonefish Date: 2007-06-09 13:21:17 +0200 (Sat, 09 Jun 2007) New Revision: 21368 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21368&view=rev Modified: haiku/trunk/src/kits/interface/View.cpp Log: Removed incorrect parameter validation in ResizeBy(). Resizing a view to a negative size is perfectly fine. Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2007-06-09 10:59:46 UTC (rev 21367) +++ haiku/trunk/src/kits/interface/View.cpp 2007-06-09 11:21:17 UTC (rev 21368) @@ -3605,13 +3605,6 @@ { // TODO: this doesn't look like it would work correctly with scrolled views - // NOTE: I think this check makes sense, but I didn't - // test what R5 does. - if (fBounds.right + deltaWidth < 0) - deltaWidth = -fBounds.right; - if (fBounds.bottom + deltaHeight < 0) - deltaHeight = -fBounds.bottom; - // BeBook says we should do this. And it makes sense. deltaWidth = roundf(deltaWidth); deltaHeight = roundf(deltaHeight); From stippi at mail.berlios.de Sat Jun 9 13:37:14 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 9 Jun 2007 13:37:14 +0200 Subject: [Haiku-commits] r21369 - haiku/trunk/src/kits/interface Message-ID: <200706091137.l59BbEDB026159@sheep.berlios.de> Author: stippi Date: 2007-06-09 13:37:13 +0200 (Sat, 09 Jun 2007) New Revision: 21369 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21369&view=rev Modified: haiku/trunk/src/kits/interface/Alert.cpp Log: * implemented icon size and layout to depend on the system plain font size (currently, a font size above 16pt will make the icon 64x64, TODO: some of the other insets could depend on that value too) Modified: haiku/trunk/src/kits/interface/Alert.cpp =================================================================== --- haiku/trunk/src/kits/interface/Alert.cpp 2007-06-09 11:21:17 UTC (rev 21368) +++ haiku/trunk/src/kits/interface/Alert.cpp 2007-06-09 11:37:13 UTC (rev 21369) @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -61,10 +62,18 @@ static const int kIconStripeWidth = 30; -static const int kTextIconOffset = kWindowIconOffset + kIconStripeWidth - 2; static const int kTextButtonOffset = 10; +static inline int32 +icon_layout_scale() +{ +#ifdef __HAIKU__ + return max_c(1, ((int32)be_plain_font->Size() + 15) / 16); +#endif + return 1; +} + class TAlertView : public BView { public: TAlertView(BRect frame); @@ -498,11 +507,12 @@ // Adjust the window's width, if necessary + int32 iconLayoutScale = icon_layout_scale(); float totalWidth = kRightOffset + fButtons[buttonCount - 1]->Frame().right - defaultButtonFrameWidth - fButtons[0]->Frame().left; - if (view->Bitmap()) - totalWidth += kIconStripeWidth + kWindowIconOffset; - else + if (view->Bitmap()) { + totalWidth += (kIconStripeWidth + kWindowIconOffset) * iconLayoutScale; + } else totalWidth += kWindowMinOffset; float width = (spacing == B_OFFSET_SPACING @@ -516,7 +526,8 @@ Bounds().right - kRightOffset, fButtons[0]->Frame().top - kTextButtonOffset); if (view->Bitmap()) - textViewRect.left = kTextIconOffset; + textViewRect.left = (kWindowIconOffset + + kIconStripeWidth) * iconLayoutScale - 2; fTextView = new BTextView(textViewRect, "_tv_", textViewRect.OffsetByCopy(B_ORIGIN), @@ -600,8 +611,7 @@ return NULL; } - int32 iconSize = 32; - + int32 iconSize = 32 * icon_layout_scale(); // Allocate the icon bitmap icon = new (std::nothrow) BBitmap(BRect(0, 0, iconSize - 1, iconSize - 1), 0, B_RGBA32); @@ -732,17 +742,21 @@ void TAlertView::Draw(BRect updateRect) { + if (!fIconBitmap) + return; + // Here's the fun stuff - if (fIconBitmap) { - BRect stripeRect = Bounds(); - stripeRect.right = kIconStripeWidth; - SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); - FillRect(stripeRect); + BRect stripeRect = Bounds(); + int32 iconLayoutScale = icon_layout_scale(); + stripeRect.right = kIconStripeWidth * iconLayoutScale; + SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); + FillRect(stripeRect); - SetDrawingMode(B_OP_ALPHA); - SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); - DrawBitmapAsync(fIconBitmap, BPoint(18, 6)); - } + SetDrawingMode(B_OP_ALPHA); + SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); + DrawBitmapAsync(fIconBitmap, BPoint(18 * iconLayoutScale, + 6 * iconLayoutScale)); + } From stippi at mail.berlios.de Sat Jun 9 13:58:09 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 9 Jun 2007 13:58:09 +0200 Subject: [Haiku-commits] r21370 - haiku/trunk/src/apps/glteapot Message-ID: <200706091158.l59Bw9Qo027108@sheep.berlios.de> Author: stippi Date: 2007-06-09 13:58:08 +0200 (Sat, 09 Jun 2007) New Revision: 21370 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21370&view=rev Modified: haiku/trunk/src/apps/glteapot/GLTeapot.rdef Log: * vector icon, work mostly by zuMi and tweaks myself Modified: haiku/trunk/src/apps/glteapot/GLTeapot.rdef =================================================================== --- haiku/trunk/src/apps/glteapot/GLTeapot.rdef 2007-06-09 11:37:13 UTC (rev 21369) +++ haiku/trunk/src/apps/glteapot/GLTeapot.rdef 2007-06-09 11:58:08 UTC (rev 21370) @@ -18,6 +18,37 @@ resource app_flags B_SINGLE_LAUNCH; +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + +resource vector_icon { + $"6E6369660B03010000020106043E00000000000000003E080049000049D80000" + $"FBC5C56DE40606E2AC0404FFBC0505010100006A02000603B5CB8E350988B67F" + $"D5B71F7E460B814AB4CC00FF979776FF0606FFC60505020106023C48E73CA6BF" + $"BAE5393A7EBE4946264A64C600FF0606FF7B0303020106023D00000000000000" + $"003D0000490000498000003C0101FFBB050502010602BD21B238F3913879B63C" + $"A0664A85B34759DC00AC0404FFFFC0C0020106033C534938199BB595BF39F836" + $"4772DF4A854900FFC0C07DD80505FFAE0E0E02000603B6EA1238A5F9B98129B7" + $"DB464BDC1248E78400FFB3B373FF0606FFA7040402000602B61A7F37E00AB983" + $"F5B7D1074B96C7488C9102FFB3B3FFDC050502000602B61A7F37E00AB983F5B7" + $"D1074B96C7488C91016D0202FFBA05050A020440BB1146BB113ABB1136BCA936" + $"BBDD36BD7540BE413ABE4146BE414ABCA94ABD754ABBDD0206405A3C5A445A4A" + $"584A5A4E5856485652563940324A3236322A482A392A5238583458385A02054A" + $"5840584E5856485652563940324A3236322A482A392A4832483248374802052A" + $"482A502A483248324837484A5840584A5A405A445A3C5A3858385A3458020432" + $"542C543A55324536462E4426462B462446224B224826510202234B264B234827" + $"472447274A0404BE503758325532CA66325B345B345B3A54430606AE0B503958" + $"32C82FBABB5A315C33593152B986C7EDB90550B9EC4B360604EB5C335C335C39" + $"5443513F583258385A31020A4642C4834246422C512C512CC7B130C9B5B85CC8" + $"C92D5A2ACB8CB68DCAEB2D62BD32CBC6355FBEA9CC3B4660C05960C7DB606051" + $"60C9D160C5A4CB94C40ECC2BC4CFCB34C3945F4562475C43C872C1C7C914C20F" + $"C6B3C1010D0A020109000A00020708301E1E01178422040A0A0108201E1E0A09" + $"0107201E1E0A080106301E1E01178100040A000201041001178400040A010102" + $"000A0601001001178400040A050100000A040103000A070104000A0301051001" + $"178200040A00010500" +}; + +#else // HAIKU_TARGET_PLATFORM_HAIKU + resource large_icon array { $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" @@ -71,3 +102,5 @@ $"FFFFFFFFFF0000302F2F3000000F0FFF" $"FFFFFFFFFFFFFF000000000E0F0FFFFF" }; + +#endif // HAIKU_TARGET_PLATFORM_HAIKU From stippi at mail.berlios.de Sat Jun 9 13:59:00 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 9 Jun 2007 13:59:00 +0200 Subject: [Haiku-commits] r21371 - haiku/trunk/src/apps/icon-o-matic/document Message-ID: <200706091159.l59Bx0sA027192@sheep.berlios.de> Author: stippi Date: 2007-06-09 13:58:59 +0200 (Sat, 09 Jun 2007) New Revision: 21371 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21371&view=rev Modified: haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp haiku/trunk/src/apps/icon-o-matic/document/Defines.h Log: * move include of SupportDefs.h to header, since the types are used there Modified: haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp 2007-06-09 11:58:08 UTC (rev 21370) +++ haiku/trunk/src/apps/icon-o-matic/document/Defines.cpp 2007-06-09 11:58:59 UTC (rev 21371) @@ -5,7 +5,6 @@ * Authors: * Stephan A?mus */ -#include #include "Defines.h" const uint32 kNativeIconMagicNumber = 'GSMI'; Modified: haiku/trunk/src/apps/icon-o-matic/document/Defines.h =================================================================== --- haiku/trunk/src/apps/icon-o-matic/document/Defines.h 2007-06-09 11:58:08 UTC (rev 21370) +++ haiku/trunk/src/apps/icon-o-matic/document/Defines.h 2007-06-09 11:58:59 UTC (rev 21371) @@ -8,6 +8,9 @@ #ifndef DEFINES_H #define DEFINES_H +#include + + extern const uint32 kNativeIconMagicNumber; extern const char* kNativeIconMimeType; From korli at mail.berlios.de Sat Jun 9 14:00:07 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 9 Jun 2007 14:00:07 +0200 Subject: [Haiku-commits] r21372 - haiku/trunk/src/data/etc/timezones Message-ID: <200706091200.l59C0760027358@sheep.berlios.de> Author: korli Date: 2007-06-09 14:00:06 +0200 (Sat, 09 Jun 2007) New Revision: 21372 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21372&view=rev Modified: haiku/trunk/src/data/etc/timezones/africa haiku/trunk/src/data/etc/timezones/asia haiku/trunk/src/data/etc/timezones/australasia haiku/trunk/src/data/etc/timezones/europe haiku/trunk/src/data/etc/timezones/leapseconds haiku/trunk/src/data/etc/timezones/northamerica haiku/trunk/src/data/etc/timezones/southamerica haiku/trunk/src/data/etc/timezones/zone.tab Log: updated to tzdata2007f Modified: haiku/trunk/src/data/etc/timezones/africa =================================================================== --- haiku/trunk/src/data/etc/timezones/africa 2007-06-09 11:58:59 UTC (rev 21371) +++ haiku/trunk/src/data/etc/timezones/africa 2007-06-09 12:00:06 UTC (rev 21372) @@ -1,4 +1,4 @@ -# @(#)africa 8.7 +# @(#)africa 8.8 #
 
 # This data is by no means authoritative; if you think you know better,
@@ -416,6 +416,20 @@
 # Namibia
 # The 1994-04-03 transition is from Shanks & Pottenger.
 # Shanks & Pottenger report no DST after 1998-04; go with IATA.
+
+# From Petronella Sibeene (2007-03-30) in
+# :
+# While the entire country changes its time, Katima Mulilo and other
+# settlements in Caprivi unofficially will not because the sun there
+# rises and sets earlier compared to other regions.  Chief of
+# Forecasting Riaan van Zyl explained that the far eastern parts of
+# the country are close to 40 minutes earlier in sunrise than the rest
+# of the country.
+# 
+# From Paul Eggert (2007-03-31):
+# Apparently the Caprivi Strip informally observes Botswana time, but
+# we have no details.  In the meantime people there can use Africa/Gaborone.
+
 # RULE	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Namibia	1994	max	-	Sep	Sun>=1	2:00	1:00	S
 Rule	Namibia	1995	max	-	Apr	Sun>=1	2:00	0	-

Modified: haiku/trunk/src/data/etc/timezones/asia
===================================================================
--- haiku/trunk/src/data/etc/timezones/asia	2007-06-09 11:58:59 UTC (rev 21371)
+++ haiku/trunk/src/data/etc/timezones/asia	2007-06-09 12:00:06 UTC (rev 21372)
@@ -1,4 +1,4 @@
-# @(#)asia	8.8
+# @(#)asia	8.11
 # 
 
 # This data is by no means authoritative; if you think you know better,
@@ -217,7 +217,7 @@
 # BTW, I did some research on-line and found some info regarding these five
 # historic timezones from some Taiwan websites.  And yes, there are official
 # Chinese names for these locales (before 1949).
-# 
+#
 # From Jesper Norgaard Welen (2006-07-14):
 # I have investigated the timezones around 1970 on the
 # http://www.astro.com/atlas site [with provinces and county
@@ -413,6 +413,8 @@
 
 # East Timor
 
+# See Indonesia for the 1945 transition.
+
 # From Joao Carrascalao, brother of the former governor of East Timor, in
 # 
 # East Timor may be late for its millennium
@@ -437,7 +439,7 @@
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dili	8:22:20 -	LMT	1912
 			8:00	-	TLT	1942 Feb 21 23:00 # E Timor Time
-			9:00	-	JST	1945 Aug
+			9:00	-	JST	1945 Sep 23
 			9:00	-	TLT	1976 May  3
 			8:00	-	CIT	2000 Sep 17 00:00
 			9:00	-	TLT
@@ -463,6 +465,19 @@
 # time zone maps, I think that must refer to Western Borneo (Kalimantan Barat
 # and Kalimantan Tengah) switching from UTC+8 to UTC+7.
 #
+# From Paul Eggert (2007-03-10):
+# Here is another correction to Shanks & Pottenger.
+# JohnTWB writes that Japanese forces did not surrender control in
+# Indonesia until 1945-09-01 00:00 at the earliest (in Jakarta) and
+# other formal surrender ceremonies were September 9, 11, and 13, plus
+# September 12 for the regional surrender to Mountbatten in Singapore.
+# These would be the earliest possible times for a change.
+# Regimes horaires pour le monde entier, by Henri Le Corre, (Editions
+# Traditionnelles, 1987, Paris) says that Java and Madura switched
+# from JST to UTC+07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura
+# (Hollandia).  For now, assume all Indonesian locations other than Jayapura
+# switched on 1945-09-23.
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Asia/Jakarta	7:07:12 -	LMT	1867 Aug 10
 # Shanks & Pottenger say the next transition was at 1924 Jan 1 0:13,
@@ -470,7 +485,7 @@
 			7:07:12	-	JMT	1923 Dec 31 23:47:12 # Jakarta
 			7:20	-	JAVT	1932 Nov	 # Java Time
 			7:30	-	WIT	1942 Mar 23
-			9:00	-	JST	1945 Aug
+			9:00	-	JST	1945 Sep 23
 			7:30	-	WIT	1948 May
 			8:00	-	WIT	1950 May
 			7:30	-	WIT	1964
@@ -478,7 +493,7 @@
 Zone Asia/Pontianak	7:17:20	-	LMT	1908 May
 			7:17:20	-	PMT	1932 Nov    # Pontianak MT
 			7:30	-	WIT	1942 Jan 29
-			9:00	-	JST	1945 Aug
+			9:00	-	JST	1945 Sep 23
 			7:30	-	WIT	1948 May
 			8:00	-	WIT	1950 May
 			7:30	-	WIT	1964
@@ -487,10 +502,10 @@
 Zone Asia/Makassar	7:57:36 -	LMT	1920
 			7:57:36	-	MMT	1932 Nov    # Macassar MT
 			8:00	-	CIT	1942 Feb  9
-			9:00	-	JST	1945 Aug
+			9:00	-	JST	1945 Sep 23
 			8:00	-	CIT
 Zone Asia/Jayapura	9:22:48 -	LMT	1932 Nov
-			9:00	-	EIT	1944
+			9:00	-	EIT	1944 Sep  1
 			9:30	-	CST	1964
 			9:00	-	EIT
 
@@ -614,7 +629,7 @@
 Rule	Iraq	1986	1990	-	Mar	lastSun	1:00s	1:00	D
 # IATA SSIM (1991/1996) says Apr 1 12:01am UTC; guess the `:01' is a typo.
 # Shanks & Pottenger say Iraq did not observe DST 1992/1997; ignore this.
-# 
+#
 Rule	Iraq	1991	max	-	Apr	 1	3:00s	1:00	D
 Rule	Iraq	1991	max	-	Oct	 1	3:00s	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1146,6 +1161,14 @@
 
 # Kuwait
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
+# From the Arab Times (2007-03-14):
+# The Civil Service Commission (CSC) has approved a proposal forwarded
+# by MP Ahmad Baqer on implementing the daylight saving time (DST) in
+# Kuwait starting from April until the end of Sept this year, reports Al-Anba.
+# .
+# From Paul Eggert (2007-03-29):
+# We don't know the details, or whether the approval means it'll happen,
+# so for now we assume no DST.
 Zone	Asia/Kuwait	3:11:56 -	LMT	1950
 			3:00	-	AST
 
@@ -1293,6 +1316,11 @@
 # parliament passed during the tumultuous winter session."
 # For now, let's ignore this information, until we have more confirmation.
 
+# From Ganbold Ts. (2007-02-26):
+# Parliament of Mongolia has just changed the daylight-saving rule in February.
+# They decided not to adopt daylight-saving time....
+# http://www.mongolnews.mn/index.php?module=unuudur&sec=view&id=15742
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Mongol	1983	1984	-	Apr	1	0:00	1:00	S
 Rule	Mongol	1983	only	-	Oct	1	0:00	0	-
@@ -1311,8 +1339,8 @@
 Rule	Mongol	1984	1998	-	Sep	lastSun	0:00	0	-
 # IATA SSIM (1999-09) says Mongolia no longer observes DST.
 Rule	Mongol	2001	only	-	Apr	lastSat	2:00	1:00	S
-Rule	Mongol	2001	max	-	Sep	lastSat	2:00	0	-
-Rule	Mongol	2002	max	-	Mar	lastSat	2:00	1:00	S
+Rule	Mongol	2001	2006	-	Sep	lastSat	2:00	0	-
+Rule	Mongol	2002	2006	-	Mar	lastSat	2:00	1:00	S
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Hovd, a.k.a. Chovd, Dund-Us, Dzhargalant, Khovd, Jirgalanta
@@ -1690,11 +1718,17 @@
 Rule	Syria	1994	1996	-	Apr	 1	0:00	1:00	S
 Rule	Syria	1994	2005	-	Oct	 1	0:00	0	-
 Rule	Syria	1997	1998	-	Mar	lastMon	0:00	1:00	S
-Rule	Syria	1999	max	-	Apr	 1	0:00	1:00	S
+Rule	Syria	1999	2006	-	Apr	 1	0:00	1:00	S
 # From Stephen Colebourne (2006-09-18):
 # According to IATA data, Syria will change DST on 21st September [21:00 UTC]
 # this year [only]....  This is probably related to Ramadan, like Egypt.
 Rule	Syria	2006	only	-	Sep	22	0:00	0	-
+# From Paul Eggert (2007-03-29):
+# Today the AP reported "Syria will switch to summertime at midnight Thursday."
+# http://www.iht.com/articles/ap/2007/03/29/africa/ME-GEN-Syria-Time-Change.php
+# For lack of better info, assume the rule changed to "last Friday in March"
+# this year.
+Rule	Syria	2007	max	-	Mar	lastFri	0:00	1:00	S
 Rule	Syria	2007	max	-	Oct	 1	0:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Damascus	2:25:12 -	LMT	1920	# Dimashq

Modified: haiku/trunk/src/data/etc/timezones/australasia
===================================================================
--- haiku/trunk/src/data/etc/timezones/australasia	2007-06-09 11:58:59 UTC (rev 21371)
+++ haiku/trunk/src/data/etc/timezones/australasia	2007-06-09 12:00:06 UTC (rev 21372)
@@ -1,4 +1,4 @@
-# @(#)australasia	8.5
+# @(#)australasia	8.7
 # 
 
 # This file also includes Pacific islands.
@@ -348,10 +348,14 @@
 Rule	Chatham	1976	1989	-	Mar	Sun>=1	2:45s	0	S
 Rule	NZ	1989	only	-	Oct	Sun>=8	2:00s	1:00	D
 Rule	Chatham	1989	only	-	Oct	Sun>=8	2:45s	1:00	D
-Rule	NZ	1990	max	-	Oct	Sun>=1	2:00s	1:00	D
-Rule	Chatham	1990	max	-	Oct	Sun>=1	2:45s	1:00	D
-Rule	NZ	1990	max	-	Mar	Sun>=15	2:00s	0	S
-Rule	Chatham	1990	max	-	Mar	Sun>=15	2:45s	0	S
+Rule	NZ	1990	2006	-	Oct	Sun>=1	2:00s	1:00	D
+Rule	Chatham	1990	2006	-	Oct	Sun>=1	2:45s	1:00	D
+Rule	NZ	1990	2007	-	Mar	Sun>=15	2:00s	0	S
+Rule	Chatham	1990	2007	-	Mar	Sun>=15	2:45s	0	S
+Rule	NZ	2007	max	-	Sep	lastSun	2:00s	1:00	D
+Rule	Chatham	2007	max	-	Sep	lastSun	2:45s	1:00	D
+Rule	NZ	2008	max	-	Apr	Sun>=1	2:00s	0	S
+Rule	Chatham	2008	max	-	Apr	Sun>=1	2:45s	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Pacific/Auckland	11:39:04 -	LMT	1868 Nov  2
 			11:30	NZ	NZ%sT	1946 Jan  1
@@ -818,7 +822,7 @@
 
 # From Christopher Hunt (2006-11-21), after an advance warning
 # from Jesper Norgaard Welen (2006-11-01):
-# WA are trialing DST for three years. 
+# WA are trialing DST for three years.
 # 
 
 # From Rives McDow (2002-04-09):
@@ -850,7 +854,7 @@
 # question arose whether this part of the state would follow suit. I
 # just called the border village and confirmed that indeed they have,
 # meaning that they are now observing UTC+09:45.
-# 
+#
 # (2006-12-09):
 # I personally doubt that either experimentation with daylight saving
 # in WA or its introduction in SA had anything to do with the genesis
@@ -1146,6 +1150,12 @@
 # transitions at 2:45 local standard time; this confirms that Chatham
 # is always exactly 45 minutes ahead of Auckland.
 
+# From Colin Sharples (2007-04-30):
+# DST will now start on the last Sunday in September, and end on the
+# first Sunday in April.  The changes take effect this year, meaning
+# that DST will begin on 2007-09-30 2008-04-06.
+# http://www.dia.govt.nz/diawebsite.nsf/wpg_URL/Services-Daylight-Saving-Daylight-saving-to-be-extended
+
 ###############################################################################
 
 

Modified: haiku/trunk/src/data/etc/timezones/europe
===================================================================
--- haiku/trunk/src/data/etc/timezones/europe	2007-06-09 11:58:59 UTC (rev 21371)
+++ haiku/trunk/src/data/etc/timezones/europe	2007-06-09 12:00:06 UTC (rev 21372)
@@ -1,4 +1,4 @@
-# @(#)europe	8.7
+# @(#)europe	8.10
 # 
 
 # This data is by no means authoritative; if you think you know better,
@@ -259,32 +259,32 @@
 #   -- James Joyce, Ulysses
 
 # From Joseph S. Myers (2005-01-26):
-# Irish laws are available online at www.irishstatutebook.ie.  These include 
+# Irish laws are available online at www.irishstatutebook.ie.  These include
 # various relating to legal time, for example:
-# 
+#
 # ZZA13Y1923.html ZZA12Y1924.html ZZA8Y1925.html ZZSIV20PG1267.html
-# 
+#
 # ZZSI71Y1947.html ZZSI128Y1948.html ZZSI23Y1949.html ZZSI41Y1950.html
 # ZZSI27Y1951.html ZZSI73Y1952.html
-# 
+#
 # ZZSI11Y1961.html ZZSI232Y1961.html ZZSI182Y1962.html
 # ZZSI167Y1963.html ZZSI257Y1964.html ZZSI198Y1967.html
 # ZZA23Y1968.html ZZA17Y1971.html
-# 
+#
 # ZZSI67Y1981.html ZZSI212Y1982.html ZZSI45Y1986.html
 # ZZSI264Y1988.html ZZSI52Y1990.html ZZSI371Y1992.html
 # ZZSI395Y1994.html ZZSI484Y1997.html ZZSI506Y2001.html
 #
 # [These are all relative to the root, e.g., the first is
 # .]
-# 
-# (These are those I found, but there could be more.  In any case these 
-# should allow various updates to the comments in the europe file to cover 
+#
+# (These are those I found, but there could be more.  In any case these
+# should allow various updates to the comments in the europe file to cover
 # the laws applicable in Ireland.)
-# 
-# (Note that the time in the Republic of Ireland since 1968 has been defined 
-# in terms of standard time being GMT+1 with a period of winter time when it 
-# is GMT, rather than standard time being GMT with a period of summer time 
+#
+# (Note that the time in the Republic of Ireland since 1968 has been defined
+# in terms of standard time being GMT+1 with a period of winter time when it
+# is GMT, rather than standard time being GMT with a period of summer time
 # being GMT+1.)
 
 # From Paul Eggert (1999-03-28):
@@ -2278,6 +2278,34 @@
 			1:00	EU	CE%sT
 
 # Turkey
+
+# From Amar Devegowda (2007-01-03):
+# The time zone rules for Istanbul, Turkey have not been changed for years now.
+# ... The latest rules are available at -
+# http://www.timeanddate.com/worldclock/timezone.html?n=107
+# From Steffen Thorsen (2007-01-03):
+# I have been able to find press records back to 1996 which all say that
+# DST started 01:00 local time and end at 02:00 local time.  I am not sure
+# what happened before that.  One example for each year from 1996 to 2001:
+# http://newspot.byegm.gov.tr/arsiv/1996/21/N4.htm
+# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING97/03/97X03X25.TXT
+# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING98/03/98X03X02.HTM
+# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING99/10/99X10X26.HTM#%2016
+# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING2000/03/00X03X06.HTM#%2021
+# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING2001/03/23x03x01.HTM#%2027
+# From Paul Eggert (2007-01-03):
+# Prefer the above source to Shanks & Pottenger for time stamps after 1990.
+
+# From Steffen Thorsen (2007-03-09):
+# Starting 2007 though, it seems that they are adopting EU's 1:00 UTC
+# start/end time, according to the following page (2007-03-07):
+# http://www.ntvmsnbc.com/news/402029.asp
+# The official document is located here - it is in Turkish...:
+# http://rega.basbakanlik.gov.tr/eskiler/2007/03/20070307-7.htm
+# I was able to locate the following seemingly official document
+# (on a non-government server though) describing dates between 2002 and 2006:
+# http://www.alomaliye.com/bkk_2002_3769.htm
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Turkey	1916	only	-	May	 1	0:00	1:00	S
 Rule	Turkey	1916	only	-	Oct	 1	0:00	0	-
@@ -2332,13 +2360,17 @@
 Rule	Turkey	1983	only	-	Oct	 2	0:00	0	-
 Rule	Turkey	1985	only	-	Apr	20	0:00	1:00	S
 Rule	Turkey	1985	only	-	Sep	28	0:00	0	-
+Rule	Turkey	1986	1990	-	Mar	lastSun	2:00s	1:00	S
+Rule	Turkey	1986	1990	-	Sep	lastSun	2:00s	0	-
+Rule	Turkey	1991	2006	-	Mar	lastSun	1:00s	1:00	S
+Rule	Turkey	1991	1995	-	Sep	lastSun	1:00s	0	-
+Rule	Turkey	1996	2006	-	Oct	lastSun	1:00s	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Europe/Istanbul	1:55:52 -	LMT	1880
 			1:56:56	-	IMT	1910 Oct # Istanbul Mean Time?
 			2:00	Turkey	EE%sT	1978 Oct 15
 			3:00	Turkey	TR%sT	1985 Apr 20 # Turkey Time
-			2:00	Turkey	EE%sT	1986
-			2:00	C-Eur	EE%sT	1991
+			2:00	Turkey	EE%sT	2007
 			2:00	EU	EE%sT
 Link	Europe/Istanbul	Asia/Istanbul	# Istanbul is in both continents.
 

Modified: haiku/trunk/src/data/etc/timezones/leapseconds
===================================================================
--- haiku/trunk/src/data/etc/timezones/leapseconds	2007-06-09 11:58:59 UTC (rev 21371)
+++ haiku/trunk/src/data/etc/timezones/leapseconds	2007-06-09 12:00:06 UTC (rev 21372)
@@ -1,4 +1,4 @@
-# @(#)leapseconds	8.1
+# @(#)leapseconds	8.3
 
 # Allowance for leapseconds added to each timezone file.
 
@@ -45,48 +45,38 @@
 Leap	1998	Dec	31	23:59:60	+	S
 Leap	2005	Dec	31	23:59:60	+	S
 
-#	INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)
+# ...
+# Sent: Thursday, February 01, 2007 9:49 AM
+# ...
+# Subject: Bulletin C number 33
 #
+# 	INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)
+#
 # SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE
 #
 # SERVICE DE LA ROTATION TERRESTRE
 # OBSERVATOIRE DE PARIS
 # 61, Av. de l'Observatoire 75014 PARIS (France)
-# Tel.      : 33 (0) 1 40 51 22 26
-# FAX       : 33 (0) 1 40 51 22 91
 # ...
-# http://hpiers.obspm.fr/eop-pc
 #
-#						Paris, 4 July 2005
-#							
-#						Bulletin C 30
+#                                                Paris, 1 February 2007
+#                                                Bulletin C 33
+#                                                To authorities responsible
+#                                                for the measurement and
+#                                                distribution of time
 #
-#						To authorities responsible
-#						for the measurement and
-#						distribution of time
+#                           INFORMATION ON UTC - TAI
 #
+# NO positive leap second will be introduced at the end of June 2007.
+# The difference between Coordinated Universal Time UTC and the
+# International Atomic Time TAI is:
+#      from 2006 January 1, 0h UTC, until further notice : UTC-TAI = -33 s
+# Leap seconds can be introduced in UTC at the end of the months of
+# December  or June,  depending on the evolution of UT1-TAI. Bulletin C is
+# mailed every  six months, either to announce a time step in UTC, or to
+# confirm that there  will be no time step at the next possible date.
 #
-#                                    UTC TIME STEP
-#                             on the 1st of January 2006
-#
-# A positive leap second will be introduced at the end of December 2005.
-# The sequence of dates of the UTC second markers will be:
-#
-#			2005 December 31,     23h 59m 59s
-#			2005 December 31,     23h 59m 60s
-#			2006 January   1,      0h  0m  0s
-#
-# The difference between UTC and the International Atomic Time TAI is:
-#
-# from 1999 January 1, 0h UTC, to 2006 January 1  0h UTC  : UTC-TAI = - 32s
-# from 2006 January 1, 0h UTC, until further notice       : UTC-TAI = - 33s
-#
-# Leap seconds can be introduced in UtC at the end of the months of December
-# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
-# six months, either to announce a time step in UTC or to confirm that there
-# will be no time step at the next possible date.
-#
-#					Daniel GAMBIS
-#					Head
-#					Earth Orientation Center of IERS
-#					Observatoire de Paris, France
+# 				Daniel GAMBIS
+# 				Director
+# 				Earth Orientation Center of IERS
+# 				Observatoire de Paris, France

Modified: haiku/trunk/src/data/etc/timezones/northamerica
===================================================================
--- haiku/trunk/src/data/etc/timezones/northamerica	2007-06-09 11:58:59 UTC (rev 21371)
+++ haiku/trunk/src/data/etc/timezones/northamerica	2007-06-09 12:00:06 UTC (rev 21372)
@@ -1,4 +1,4 @@
-# @(#)northamerica	8.11
+# @(#)northamerica	8.17
 # 
 
 # also includes Central America and the Caribbean
@@ -307,6 +307,11 @@
 # "bar time" in the state corresponds to 02:00, a number of citations
 # are issued for the "sale of class 'B' alcohol after prohibited
 # hours" within the deviated hour of this change every year....
+#
+# From Douglas R. Bomberg (2007-03-12):
+# Wisconsin has enacted (nearly eleventh-hour) legislation to get WI
+# Statue 175 closer in synch with the US Congress' intent....
+# http://www.legis.state.wi.us/2007/data/acts/07Act3.pdf
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule	Chicago	1920	only	-	Jun	13	2:00	1:00	D
@@ -583,6 +588,11 @@
 # clocks twice that night, but this obviously is in error.  The intent
 # is that 01:59:59 EST be followed by 02:00:00 CDT.
 
+# From Gwillim Law (2007-02-10):
+# The Associated Press has been reporting that Pulaski County, Indiana is
+# going to switch from Central to Eastern Time on March 11, 2007....
+# http://www.indystar.com/apps/pbcs.dll/article?AID=/20070207/LOCAL190108/702070524/0/LOCAL
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule Indianapolis 1941	only	-	Jun	22	2:00	1:00	D
 Rule Indianapolis 1941	1954	-	Sep	lastSun	2:00	0	S
@@ -618,7 +628,7 @@
 			-5:00	-	EST	2006
 			-5:00	US	E%sT
 #
-# Daviess, Dubois, Knox, Martin, Perry, and Pulaski Counties, Indiana,
+# Daviess, Dubois, Knox, Martin, and Perry Counties, Indiana,
 # switched from eastern to central time in April 2006.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule Vincennes	1946	only	-	Apr	lastSun	2:00	1:00	D
@@ -676,6 +686,23 @@
 			-5:00	-	EST	2006 Apr  2 2:00
 			-6:00	US	C%sT
 #
+# Pulaski County, Indiana, switched from eastern to central time in
+# April 2006 and then switched back in March 2007.
+# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
+Rule	Pulaski	1946	1960	-	Apr	lastSun	2:00	1:00	D
+Rule	Pulaski	1946	1954	-	Sep	lastSun	2:00	0	S
+Rule	Pulaski	1955	1956	-	Oct	lastSun	2:00	0	S
+Rule	Pulaski	1957	1960	-	Sep	lastSun	2:00	0	S
+# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
+Zone America/Indiana/Winamac -5:46:25 - LMT	1883 Nov 18 12:13:35
+			-6:00	US	C%sT	1946
+			-6:00	Pulaski	C%sT	1961 Apr 30 2:00
+			-5:00	-	EST	1969
+			-5:00	US	E%sT	1971
+			-5:00	-	EST	2006 Apr  2 2:00
+			-6:00	US	C%sT	2007 Mar 11 2:00
+			-5:00	US	E%sT
+#
 # Switzerland County, Indiana, did not observe DST from 1973 through 2005.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Indiana/Vevay -5:40:16 -	LMT	1883 Nov 18 12:19:44
@@ -894,18 +921,17 @@
 # Unless otherwise specified, the data for Canada are all from Shanks
 # & Pottenger.
 
-# From Chris Walton (2006-04-01):
+# From Chris Walton (2006-04-01, 2006-04-25, 2006-06-26, 2007-01-31,
+# 2007-03-01):
 # The British Columbia government announced yesterday that it will
 # adjust daylight savings next year to align with changes in the
 # U.S. and the rest of Canada....
 # http://www2.news.gov.bc.ca/news_releases_2005-2009/2006AG0014-000330.htm
-
-# From Chris Walton (2006-04-25):
+# ...
+# Nova Scotia
 # Daylight saving time will be extended by four weeks starting in 2007....
-# Here is a news release which was issued today by the Nova Scotia government:
-# http://www.gov.ns.ca/news/details.asp?id=20060425004
-
-# From Chris Walton (2006-06-26):
+# http://www.gov.ns.ca/just/regulations/rg2/2006/ma1206.pdf
+#
 # [For New Brunswick] the new legislation dictates that the time change is to
 # be done at 02:00 instead of 00:01.
 # http://www.gnb.ca/0062/acts/BBA-2006/Chap-19.pdf
@@ -915,26 +941,30 @@
 # http://web2.gov.mb.ca/laws/statutes/ccsm/o030e.php
 # ...
 # [Alberta, Ontario, Quebec] will follow US rules.
-# http://www.qp.gov.ab.ca/documents/Acts/2006CH03_UNPR.cfm?frm_isbn=0779744934
+# http://www.qp.gov.ab.ca/documents/spring/CH03_06.CFM
 # http://www.e-laws.gov.on.ca/DBLaws/Source/Regs/English/2006/R06111_e.htm
-# http://www.assnat.qc.ca/eng/37legislature2/Projets-loi/Publics/06-a002.htm
+# http://www2.publicationsduquebec.gouv.qc.ca/dynamicSearch/telecharge.php?type=5&file=2006C39A.PDF
 # ...
-# P.E.I. will follow US rules.  The new legislation is not law yet.
-# It passed first reading on April 20....
-# http://www.assembly.pe.ca/bills/pdf_first/62/3/bill-101.pdf
+# P.E.I. will follow US rules....
+# http://www.assembly.pe.ca/bills/pdf_chapter/62/3/chapter-41.pdf
 # ...
-# Province of Newfoundland and Labrador.... The change is being considered.
-# http://www.releases.gov.nl.ca/releases/2006/mpa/0331n01.htm
+# Province of Newfoundland and Labrador....
+# http://www.hoa.gov.nl.ca/hoa/bills/Bill0634.htm
 # ...
+# Yukon
+# http://www.gov.yk.ca/legislation/regs/oic2006_127.pdf
+# ...
 # N.W.T. will follow US rules.  Whoever maintains the government web site
 # does not seem to believe in bookmarks.  To see the news release, click the
 # following link and search for "Daylight Savings Time Change".  Press the
 # "Daylight Savings Time Change" link; it will fire off a popup using
 # JavaScript.
 # http://www.exec.gov.nt.ca/currentnews/currentPR.asp?mode=archive
+# ...
+# Nunavut
+# An amendment to the Interpretation Act was registered on February 19/2007....
+# http://action.attavik.ca/home/justice-gn/attach/2007/gaz02part2.pdf
 
-
-
 # From Paul Eggert (2006-04-25):
 # H. David Matthews and Mary Vincent's map
 # 
@@ -1100,11 +1130,11 @@
 
 # New Brunswick
 
-# From Paul Eggert (2006-01-20):
-# New Brunswick's Time Definition Act
-#  says they change at 00:01, and
+# From Paul Eggert (2007-01-31):
+# The Time Definition Act 
+# says they changed at 00:01 through 2006, and
 #  makes it
-# clear that this has been the case since at least 1993.
+# clear that this was the case since at least 1993.
 # For now, assume it started in 1993.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
@@ -1676,10 +1706,24 @@
 # For lack of better information, assume that Southampton Island observed
 # daylight saving only during wartime.
 
-# From Chris Walton (2006-07-19):
-# The government of Yukon Territory ... recently announced it will extend
-# daylight saving in 2007....  http://www.gov.yk.ca/news/2006/06-164.html
+# From Chris Walton (2007-03-01):
+# ... the community of Resolute (located on Cornwallis Island in
+# Nunavut) moved from Central Time to Eastern Time last November.
+# Basically the community did not change its clocks at the end of
+# daylight saving....
+# http://www.nnsl.com/frames/newspapers/2006-11/nov13_06none.html
 
+# From Chris Walton (2007-03-14):
+# Today I phoned the "hamlet office" to find out what Resolute was doing with
+# its clocks.
+#
+# The individual that answered the phone confirmed that the clocks did not
+# move at the end of daylight saving on October 29/2006.  He also told me that
+# the clocks did not move this past weekend (March 11/2007)....
+#
+# America/Resolute should use the "Canada" Rule up to October 29/2006.
+# After that it should be fixed on Eastern Standard Time until further notice.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	NT_YK	1918	only	-	Apr	14	2:00	1:00	D
 Rule	NT_YK	1918	only	-	Oct	27	2:00	0	S
@@ -1694,33 +1738,39 @@
 Rule	NT_YK	1980	2006	-	Oct	lastSun	2:00	0	S
 Rule	NT_YK	1987	2006	-	Apr	Sun>=1	2:00	1:00	D
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone America/Pangnirtung -4:22:56 -	LMT	1884
+# aka Panniqtuuq
+Zone America/Pangnirtung 0	-	zzz	1921 # trading post est.
 			-4:00	NT_YK	A%sT	1995 Apr Sun>=1 2:00
 			-5:00	Canada	E%sT	1999 Oct 31 2:00
 			-6:00	Canada	C%sT	2000 Oct 29 2:00
 			-5:00	Canada	E%sT
-Zone America/Iqaluit	-4:33:52 -	LMT	1884 # Frobisher Bay before 1987
+# formerly Frobisher Bay
+Zone America/Iqaluit	0	-	zzz	1942 Aug # Frobisher Bay est.
 			-5:00	NT_YK	E%sT	1999 Oct 31 2:00
 			-6:00	Canada	C%sT	2000 Oct 29 2:00
 			-5:00	Canada	E%sT
-# Now subsumed by America/Atikokan.
-#Zone America/Coral_Harbour -5:32:40 -	LMT	1884
-#			-5:00	NT_YK	E%sT	1946
-#			-5:00	-	EST
-Zone America/Rankin_Inlet -6:08:20 -	LMT	1884
+# aka Qausuittuq
+Zone America/Resolute	0	-	zzz	1947 Aug 31 # Resolute founded
 			-6:00	NT_YK	C%sT	2000 Oct 29 2:00
 			-5:00	-	EST	2001 Apr  1 3:00
+			-6:00	Canada	C%sT	2006 Oct 29 2:00
+			-5:00	-	EST
+# aka Kangiqiniq
+Zone America/Rankin_Inlet 0	-	zzz	1957 # Rankin Inlet founded
+			-6:00	NT_YK	C%sT	2000 Oct 29 2:00
+			-5:00	-	EST	2001 Apr  1 3:00
 			-6:00	Canada	C%sT
-Zone America/Cambridge_Bay -7:00:20 -	LMT	1884
+# aka Iqaluktuuttiaq
+Zone America/Cambridge_Bay 0	-	zzz	1920 # trading post est.?
 			-7:00	NT_YK	M%sT	1999 Oct 31 2:00
 			-6:00	Canada	C%sT	2000 Oct 29 2:00
 			-5:00	-	EST	2000 Nov  5 0:00
 			-6:00	-	CST	2001 Apr  1 3:00
 			-7:00	Canada	M%sT
-Zone America/Yellowknife -7:37:24 -	LMT	1884
+Zone America/Yellowknife 0	-	zzz	1935 # Yellowknife founded?
 			-7:00	NT_YK	M%sT	1980
 			-7:00	Canada	M%sT
-Zone America/Inuvik	-8:54:52 -	LMT	1884
+Zone America/Inuvik	0	-	zzz	1953 # Inuvik founded
 			-8:00	NT_YK	P%sT	1979 Apr lastSun 2:00
 			-7:00	NT_YK	M%sT	1980
 			-7:00	Canada	M%sT
@@ -1999,7 +2049,7 @@
 # Bahamas
 #
 # From Sue Williams (2006-12-07):
-# The Bahamas announced about a month ago that they plan to change their DST 
+# The Bahamas announced about a month ago that they plan to change their DST
 # rules to sync with the U.S. starting in 2007....
 # http://www.jonesbahamas.com/?c=45&a=10412
 
@@ -2110,6 +2160,12 @@
 # watches should be set back one hour -- going back to 00:00 hours -- returning
 # to the normal schedule....
 
+# From Paul Eggert (2007-03-02):
+# http://www.granma.cubaweb.cu/english/news/art89.html, dated yesterday,
+# says Cuban clocks will advance at midnight on March 10.
+# For lack of better information, assume Cuba will use US rules,
+# except that it switches at midnight standard time as usual.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Cuba	1928	only	-	Jun	10	0:00	1:00	D
 Rule	Cuba	1928	only	-	Oct	10	0:00	0	S
@@ -2139,8 +2195,10 @@
 Rule	Cuba	1997	only	-	Oct	12	0:00s	0	S
 Rule	Cuba	1998	1999	-	Mar	lastSun	0:00s	1:00	D
 Rule	Cuba	1998	2003	-	Oct	lastSun	0:00s	0	S
-Rule	Cuba	2000	max	-	Apr	Sun>=1	0:00s	1:00	D
-Rule	Cuba	2006	max	-	Oct	lastSun	0:00s	0	S
+Rule	Cuba	2000	2006	-	Apr	Sun>=1	0:00s	1:00	D
+Rule	Cuba	2006	only	-	Oct	lastSun	0:00s	0	S
+Rule	Cuba	2007	max	-	Mar	Sun>=8	0:00s	1:00	D
+Rule	Cuba	2007	max	-	Nov	Sun>=1	0:00s	0	S
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	America/Havana	-5:29:28 -	LMT	1890
@@ -2267,7 +2325,10 @@
 #
 # The reason seems to be an energy crisis.
 
+# From Stephen Colebourne (2007-02-22):
+# Some IATA info: Haiti won't be having DST in 2007.
 
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Haiti	1983	only	-	May	8	0:00	1:00	D
 Rule	Haiti	1984	1987	-	Apr	lastSun	0:00	1:00	D
@@ -2276,8 +2337,8 @@
 # Go with IATA.
 Rule	Haiti	1988	1997	-	Apr	Sun>=1	1:00s	1:00	D
 Rule	Haiti	1988	1997	-	Oct	lastSun	1:00s	0	S
-Rule	Haiti	2005	max	-	Apr	Sun>=1	0:00	1:00	D
-Rule	Haiti	2005	max	-	Oct	lastSun	0:00	0	S
+Rule	Haiti	2005	2006	-	Apr	Sun>=1	0:00	1:00	D
+Rule	Haiti	2005	2006	-	Oct	lastSun	0:00	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Port-au-Prince -4:49:20 -	LMT	1890
 			-4:49	-	PPMT	1917 Jan 24 12:00 # P-a-P MT
@@ -2308,11 +2369,15 @@
 # published, I have located this authoritative source:
 # http://www.presidencia.gob.hn/noticia.aspx?nId=47
 
+# From Steffen Thorsen (2007-03-30):
+# http://www.laprensahn.com/pais_nota.php?id04962=7386
+# So it seems that Honduras will not enter DST this year....
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Hond	1987	1988	-	May	Sun>=1	0:00	1:00	D
 Rule	Hond	1987	1988	-	Sep	lastSun	0:00	0	S
-Rule	Hond	2006	2009	-	May	Sun>=1	0:00	1:00	D
-Rule	Hond	2006	2009	-	Aug	Mon>=1	0:00	0	S
+Rule	Hond	2006	only	-	May	Sun>=1	0:00	1:00	D
+Rule	Hond	2006	only	-	Aug	Mon>=1	0:00	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Tegucigalpa -5:48:52 -	LMT	1921 Apr
 			-6:00	Hond	C%sT
@@ -2456,13 +2521,31 @@
 			-4:00	-	AST
 
 # Turks and Caicos
-# From Paul Eggert (2006-03-22):
+#
+# From Chris Dunn in
+# 
+# (2007-03-15): In the Turks & Caicos Islands (America/Grand_Turk) the
+# daylight saving dates for time changes have been adjusted to match
+# the recent U.S. change of dates.
+#
+# From Brian Inglis (2007-04-28):
+# http://www.turksandcaicos.tc/calendar/index.htm [2007-04-26]
+# there is an entry for Nov 4 "Daylight Savings Time Ends 2007" and three
+# rows before that there is an out of date entry for Oct:
+# "Eastern Standard Times Begins 2007
+# Clocks are set back one hour at 2:00 a.m. local Daylight Saving Time"
+# indicating that the normal ET rules are followed.
+#
+# From Paul Eggert (2006-05-01):
 # Shanks & Pottenger say they use US DST rules, but IATA SSIM (1991/1998)
-# says they switch at midnight.  Go with IATA SSIM.
+# says they switch at midnight.  Go with Shanks & Pottenger.
+#
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-Rule	TC	1979	1986	-	Apr	lastSun	0:00	1:00	D
-Rule	TC	1979	max	-	Oct	lastSun	0:00	0	S
-Rule	TC	1987	max	-	Apr	Sun>=1	0:00	1:00	D
+Rule	TC	1979	1986	-	Apr	lastSun	2:00	1:00	D
+Rule	TC	1979	2006	-	Oct	lastSun	2:00	0	S
+Rule	TC	1987	2006	-	Apr	Sun>=1	2:00	1:00	D
+Rule	TC	2007	max	-	Mar	Sun>=8	2:00	1:00	D
+Rule	TC	2007	max	-	Nov	Sun>=1	2:00	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Grand_Turk	-4:44:32 -	LMT	1890
 			-5:07:12 -	KMT	1912 Feb    # Kingston Mean Time

Modified: haiku/trunk/src/data/etc/timezones/southamerica
===================================================================
--- haiku/trunk/src/data/etc/timezones/southamerica	2007-06-09 11:58:59 UTC (rev 21371)
+++ haiku/trunk/src/data/etc/timezones/southamerica	2007-06-09 12:00:06 UTC (rev 21372)
@@ -1,4 +1,4 @@
-# @(#)southamerica	8.8
+# @(#)southamerica	8.11
 # 
 
 # This data is by no means authoritative; if you think you know better,
@@ -765,7 +765,7 @@
 			-5:00	Chile	CL%sT	1947 May 22 # Chile Time
 			-4:00	Chile	CL%sT
 Zone Pacific/Easter	-7:17:44 -	LMT	1890
-			-7:17:44 -	EMT	1932 Sep    # Easter Mean Time
+			-7:17:28 -	EMT	1932 Sep    # Easter Mean Time
 			-7:00	Chile	EAS%sT	1982 Mar 13 21:00 # Easter I Time
 			-6:00	Chile	EAS%sT
 #
@@ -786,26 +786,33 @@
 
 # Curacao
 #
-# From Paul Eggert (2006-03-22): 
+# From Paul Eggert (2006-03-22):
 # Shanks & Pottenger say that The Bottom and Philipsburg have been at
 # -4:00 since standard time was introduced on 1912-03-02; and that
 # Kralendijk and Rincon used Kralendijk Mean Time (-4:33:08) from
 # 1912-02-02 to 1965-01-01.  The former is dubious, since S&P also say
 # Saba Island has been like Curacao.
-# This all predates our 1970 cutoff, though.  
+# This all predates our 1970 cutoff, though.
 #
 # By July 2007 Curacao and St Maarten are planned to become
 # associated states within the Netherlands, much like Aruba;
 # Bonaire, Saba and St Eustatius would become directly part of the
 # Netherlands as Kingdom Islands.  This won't affect their time zones
 # though, as far as we know.
-# 
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	America/Curacao	-4:35:44 -	LMT	1912 Feb 12	# Willemstad
 			-4:30	-	ANT	1965 # Netherlands Antilles Time
 			-4:00	-	AST
 
 # Ecuador
+#
+# From Paul Eggert (2007-03-04):
+# Apparently Ecuador had a failed experiment with DST in 1992.
+#  (2007-02-27) and
+#  (2006-11-06) both
+# talk about "hora Sixto".  Leave this alone for now, as we have no data.
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Guayaquil	-5:19:20 -	LMT	1890
 			-5:14:00 -	QMT	1931 # Quito Mean Time

Modified: haiku/trunk/src/data/etc/timezones/zone.tab
===================================================================
--- haiku/trunk/src/data/etc/timezones/zone.tab	2007-06-09 11:58:59 UTC (rev 21371)
+++ haiku/trunk/src/data/etc/timezones/zone.tab	2007-06-09 12:00:06 UTC (rev 21372)
@@ -1,4 +1,4 @@
-# @(#)zone.tab	8.8
+# @(#)zone.tab	8.10
 #
 # TZ zone descriptions
 #
@@ -110,8 +110,9 @@
 CA	+4339-07923	America/Toronto	Eastern Time - Ontario - most locations
 CA	+4901-08816	America/Nipigon	Eastern Time - Ontario & Quebec - places that did not observe DST 1967-1973
 CA	+4823-08915	America/Thunder_Bay	Eastern Time - Thunder Bay, Ontario
+CA	+6344-06828	America/Iqaluit	Eastern Time - east Nunavut - most locations
 CA	+6608-06544	America/Pangnirtung	Eastern Time - Pangnirtung, Nunavut
-CA	+6344-06828	America/Iqaluit	Eastern Time - east Nunavut
+CA	+744144-0944945	America/Resolute	Eastern Time - Resolute, Nunavut
 CA	+484531-0913718	America/Atikokan	Eastern Standard Time - Atikokan, Ontario and Southampton I, Nunavut
 CA	+624900-0920459	America/Rankin_Inlet	Central Time - central Nunavut
 CA	+4953-09709	America/Winnipeg	Central Time - Manitoba & west Ontario
@@ -379,11 +380,12 @@
 US	+381515-0854534	America/Kentucky/Louisville	Eastern Time - Kentucky - Louisville area
 US	+364947-0845057	America/Kentucky/Monticello	Eastern Time - Kentucky - Wayne County
 US	+394606-0860929	America/Indiana/Indianapolis	Eastern Time - Indiana - most locations
+US	+411745-0863730	America/Indiana/Knox	Eastern Time - Indiana - Starke County
+US	+410305-0863611	America/Indiana/Winamac	Eastern Time - Indiana - Pulaski County
 US	+382232-0862041	America/Indiana/Marengo	Eastern Time - Indiana - Crawford County
-US	+411745-0863730	America/Indiana/Knox	Eastern Time - Indiana - Starke County
 US	+384452-0850402	America/Indiana/Vevay	Eastern Time - Indiana - Switzerland County
 US	+415100-0873900	America/Chicago	Central Time
-US	+384038-0873143	America/Indiana/Vincennes	Central Time - Indiana - Daviess, Dubois, Knox, Martin, Perry & Pulaski Counties
+US	+384038-0873143	America/Indiana/Vincennes	Central Time - Indiana - Daviess, Dubois, Knox, Martin & Perry Counties
 US	+382931-0871643	America/Indiana/Petersburg	Central Time - Indiana - Pike County
 US	+450628-0873651	America/Menominee	Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties
 US	+470659-1011757	America/North_Dakota/Center	Central Time - North Dakota - Oliver County



From stippi at mail.berlios.de  Sat Jun  9 14:01:41 2007
From: stippi at mail.berlios.de (stippi at BerliOS)
Date: Sat, 9 Jun 2007 14:01:41 +0200
Subject: [Haiku-commits] r21373 - in haiku/trunk/src/apps: . launchbox
Message-ID: <200706091201.l59C1fwk027464@sheep.berlios.de>

Author: stippi
Date: 2007-06-09 14:01:39 +0200 (Sat, 09 Jun 2007)
New Revision: 21373
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21373&view=rev

Added:
   haiku/trunk/src/apps/launchbox/
   haiku/trunk/src/apps/launchbox/App.cpp
   haiku/trunk/src/apps/launchbox/App.h
   haiku/trunk/src/apps/launchbox/IconButton.cpp
   haiku/trunk/src/apps/launchbox/IconButton.h
   haiku/trunk/src/apps/launchbox/Jamfile
   haiku/trunk/src/apps/launchbox/LaunchBox.rdef
   haiku/trunk/src/apps/launchbox/LaunchButton.cpp
   haiku/trunk/src/apps/launchbox/LaunchButton.h
   haiku/trunk/src/apps/launchbox/MainWindow.cpp
   haiku/trunk/src/apps/launchbox/MainWindow.h
   haiku/trunk/src/apps/launchbox/NamePanel.cpp
   haiku/trunk/src/apps/launchbox/NamePanel.h
   haiku/trunk/src/apps/launchbox/PadView.cpp
   haiku/trunk/src/apps/launchbox/PadView.h
   haiku/trunk/src/apps/launchbox/Panel.cpp
   haiku/trunk/src/apps/launchbox/Panel.h
   haiku/trunk/src/apps/launchbox/main.cpp
   haiku/trunk/src/apps/launchbox/run
   haiku/trunk/src/apps/launchbox/support.cpp
   haiku/trunk/src/apps/launchbox/support.h
Modified:
   haiku/trunk/src/apps/Jamfile
Log:
* added LaunchBox, an application launcher with drag&drop support
* it has been rewritten from using liblayout to use the new Haiku
  layout framework
* TODO: it should come with default settings
* TODO: the minimum window size is not yet set by the layout framework (?)


Modified: haiku/trunk/src/apps/Jamfile
===================================================================
--- haiku/trunk/src/apps/Jamfile	2007-06-09 12:00:06 UTC (rev 21372)
+++ haiku/trunk/src/apps/Jamfile	2007-06-09 12:01:39 UTC (rev 21373)
@@ -13,6 +13,7 @@
 SubInclude HAIKU_TOP src apps glteapot ;
 SubInclude HAIKU_TOP src apps icon-o-matic ;
 SubInclude HAIKU_TOP src apps installer ;
+SubInclude HAIKU_TOP src apps launchbox ;
 SubInclude HAIKU_TOP src apps magnify ;
 SubInclude HAIKU_TOP src apps mail ;
 SubInclude HAIKU_TOP src apps mandelbrot ;

Added: haiku/trunk/src/apps/launchbox/App.cpp
===================================================================
--- haiku/trunk/src/apps/launchbox/App.cpp	2007-06-09 12:00:06 UTC (rev 21372)
+++ haiku/trunk/src/apps/launchbox/App.cpp	2007-06-09 12:01:39 UTC (rev 21373)
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2006, Haiku.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *		Stephan A?mus 
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "support.h"
+
+#include "MainWindow.h"
+
+#include "App.h"
+
+// constructor
+App::App()
+	: BApplication("application/x.vnd-YellowBites.LaunchBox")
+{
+}
+
+// destructor
+App::~App()
+{
+}
+
+// QuitRequested
+bool
+App::QuitRequested()
+{
+	BMessage settings('sett');
+	for (int32 i = 0; BWindow* window = WindowAt(i); i++) {
+		if (MainWindow* padWindow = dynamic_cast(window)) {
+			BMessage* windowSettings = padWindow->Settings();
+			if (windowSettings && padWindow->Lock()) {
+				padWindow->SaveSettings(windowSettings);
+				padWindow->Unlock();
+				settings.AddMessage("window", windowSettings);
+			}
+		}
+	}
+	save_settings(&settings, "main_settings", "LaunchBox");
+	return true;
+}
+
+// ReadyToRun
+void
+App::ReadyToRun()
+{
+	bool windowAdded = false;
+	BRect frame(50.0, 50.0, 65.0, 100.0);
+
+	BMessage settings('sett');
+	status_t status = load_settings(&settings, "main_settings", "LaunchBox");
+	if (status >= B_OK) {
+		BMessage windowMessage;
+		for (int32 i = 0; settings.FindMessage("window", i, &windowMessage) >= B_OK; i++) {
+			BString name("Pad ");
+			name << i + 1;
+			BMessage* windowSettings = new BMessage(windowMessage);
+			MainWindow* window = new MainWindow(name.String(), frame, windowSettings);
+			window->Show();
+			windowAdded = true;
+			frame.OffsetBy(10.0, 10.0);
+			windowMessage.MakeEmpty();
+		}
+	}
+	
+	if (!windowAdded) {
+		MainWindow* window = new MainWindow("Pad 1", frame);
+		window->Show();
+	}
+}
+
+// MessageReceived
+void
+App::MessageReceived(BMessage* message)
+{
+	switch (message->what) {
+		case MSG_ADD_WINDOW: {
+			BMessage* settings = new BMessage('sett');
+			message->FindMessage("window", settings);
+			BString name("Pad ");
+			name << CountWindows() + 1;
+			MainWindow* window = new MainWindow(name.String(),
+												BRect(50.0, 50.0, 65.0, 100.0), settings);
+			window->Show();
+			break;
+		}
+		default:
+			BApplication::MessageReceived(message);
+			break;
+	}
+}
+
+// AboutRequested
+void
+App::AboutRequested()
+{
+	(new BAlert("about", "LaunchBox by stippi\n\n"
+						 "for bonefish\n\n\n"
+						 "v1.1.0",
+						 "Neat", NULL, NULL))->Go(NULL);
+}

Added: haiku/trunk/src/apps/launchbox/App.h
===================================================================
--- haiku/trunk/src/apps/launchbox/App.h	2007-06-09 12:00:06 UTC (rev 21372)
+++ haiku/trunk/src/apps/launchbox/App.h	2007-06-09 12:01:39 UTC (rev 21373)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006, Haiku.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *		Stephan A?mus 
+ */
+#ifndef APP_H
+#define APP_H
+
+#include 
+#include 
+
+class MainWindow;
+
+class App : public BApplication {
+ public:
+								App();
+	virtual						~App();
+
+	virtual	bool				QuitRequested();
+	virtual	void				ReadyToRun();
+	virtual	void				MessageReceived(BMessage* message);
+	virtual	void				AboutRequested();
+
+ private:
+};
+
+#endif // APP_H

Added: haiku/trunk/src/apps/launchbox/IconButton.cpp
===================================================================
--- haiku/trunk/src/apps/launchbox/IconButton.cpp	2007-06-09 12:00:06 UTC (rev 21372)
+++ haiku/trunk/src/apps/launchbox/IconButton.cpp	2007-06-09 12:01:39 UTC (rev 21373)
@@ -0,0 +1,760 @@
+/*
+ * Copyright 2006, Haiku.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *		Stephan A?mus 
+ */
+
+// NOTE: this file is a duplicate of the version in Icon-O-Matic/generic
+// it should be placed into a common folder for generic useful stuff
+
+#include "IconButton.h"
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+using std::nothrow;
+
+// constructor
+IconButton::IconButton(const char* name, uint32 id, const char* label,
+					   BMessage* message, BHandler* target)
+	: BView(BRect(0.0, 0.0, 10.0, 10.0), name, B_FOLLOW_NONE, B_WILL_DRAW),
+	  BInvoker(message, target),
+	  fButtonState(STATE_ENABLED),
+	  fID(id),
+	  fNormalBitmap(NULL),
+	  fDisabledBitmap(NULL),
+	  fClickedBitmap(NULL),
+	  fDisabledClickedBitmap(NULL),
+	  fLabel(label),
+	  fTargetCache(target)
+{
+	SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+	SetViewColor(B_TRANSPARENT_32_BIT);
+}
+
+// destructor
+IconButton::~IconButton()
+{
+	_DeleteBitmaps();
+}
+
+// MessageReceived
+void
+IconButton::MessageReceived(BMessage* message)
+{
+	switch (message->what) {
+		default:
+			BView::MessageReceived(message);
+			break;
+	}
+}
+
+// AttachedToWindow
+void
+IconButton::AttachedToWindow()
+{
+	SetTarget(fTargetCache);
+	if (!Target()) {
+		SetTarget(Window());
+	}
+}
+
+// Draw
+void
+IconButton::Draw(BRect area)
+{
+	rgb_color background = LowColor();
+	if (BView* parent = Parent())
+		background = parent->ViewColor();
+	rgb_color lightShadow, shadow, darkShadow, light;
+	BRect r(Bounds());
+	BBitmap* bitmap = fNormalBitmap;
+	// adjust colors and bitmap according to flags
+	if (IsEnabled()) {
+		lightShadow = tint_color(background, B_DARKEN_1_TINT);
+		shadow = tint_color(background, B_DARKEN_2_TINT);
+		darkShadow = tint_color(background, B_DARKEN_4_TINT);
+		light = tint_color(background, B_LIGHTEN_MAX_TINT);
+		SetHighColor(0, 0, 0, 255);
+	} else {
+		lightShadow = tint_color(background, 1.11);
+		shadow = tint_color(background, B_DARKEN_1_TINT);
+		darkShadow = tint_color(background, B_DARKEN_2_TINT);
+		light = tint_color(background, B_LIGHTEN_2_TINT);
+		bitmap = fDisabledBitmap;
+		SetHighColor(tint_color(background, B_DISABLED_LABEL_TINT));
+	}
+	if (_HasFlags(STATE_PRESSED) || _HasFlags(STATE_FORCE_PRESSED)) {
+		if (IsEnabled())  {
+//			background = tint_color(background, B_DARKEN_2_TINT);
+//			background = tint_color(background, B_LIGHTEN_1_TINT);
+			background = tint_color(background, B_DARKEN_1_TINT);
+			bitmap = fClickedBitmap;
+		} else {
+//			background = tint_color(background, B_DARKEN_1_TINT);
+//			background = tint_color(background, (B_NO_TINT + B_LIGHTEN_1_TINT) / 2.0);
+			background = tint_color(background, (B_NO_TINT + B_DARKEN_1_TINT) / 2.0);
+			bitmap = fDisabledClickedBitmap;
+		}
+		// background
+		SetLowColor(background);
+		r.InsetBy(2.0, 2.0);
+		StrokeLine(r.LeftBottom(), r.LeftTop(), B_SOLID_LOW);
+		StrokeLine(r.LeftTop(), r.RightTop(), B_SOLID_LOW);
+		r.InsetBy(-2.0, -2.0);
+	}
+	// draw frame only if tracking
+	if (DrawBorder()) {
+		if (_HasFlags(STATE_PRESSED) || _HasFlags(STATE_FORCE_PRESSED))
+			DrawPressedBorder(r, background, shadow, darkShadow, lightShadow, light);
+		else
+			DrawNormalBorder(r, background, shadow, darkShadow, lightShadow, light);
+		r.InsetBy(2.0, 2.0);
+	} else
+		_DrawFrame(r, background, background, background, background);
+	float width = Bounds().Width();
+	float height = Bounds().Height();
+	// bitmap
+	BRegion originalClippingRegion;
+	if (bitmap && bitmap->IsValid()) {
+		float x = floorf((width - bitmap->Bounds().Width()) / 2.0 + 0.5);
+		float y = floorf((height - bitmap->Bounds().Height()) / 2.0 + 0.5);
+		BPoint point(x, y);
+		if (_HasFlags(STATE_PRESSED) || _HasFlags(STATE_FORCE_PRESSED))
+			point += BPoint(1.0, 1.0);
+		if (bitmap->ColorSpace() == B_RGBA32 || bitmap->ColorSpace() == B_RGBA32_BIG) {
+			FillRect(r, B_SOLID_LOW);
+			SetDrawingMode(B_OP_ALPHA);
+			SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
+		}
+		DrawBitmap(bitmap, point);
+		// constrain clipping region
+		BRegion region= originalClippingRegion;
+		GetClippingRegion(®ion);
+		region.Exclude(bitmap->Bounds().OffsetByCopy(point));
+		ConstrainClippingRegion(®ion);
+	}
+	// background
+	SetDrawingMode(B_OP_COPY);
+	FillRect(r, B_SOLID_LOW);
+	ConstrainClippingRegion(&originalClippingRegion);
+	// label
+	if (fLabel.CountChars() > 0) {
+		SetDrawingMode(B_OP_COPY);
+		font_height fh;
+		GetFontHeight(&fh);
+		float y = Bounds().bottom - 4.0;
+		y -= fh.descent;
+		float x = (width - StringWidth(fLabel.String())) / 2.0;
+		DrawString(fLabel.String(), BPoint(x, y));
+	}
+}
+
+// MouseDown
+void
+IconButton::MouseDown(BPoint where)
+{
+	if (IsValid()) {
+		if (_HasFlags(STATE_ENABLED)/* && !_HasFlags(STATE_FORCE_PRESSED)*/) {
+			if (Bounds().Contains(where)) {
+				SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
+				_AddFlags(STATE_PRESSED | STATE_TRACKING);
+			} else {
+				_ClearFlags(STATE_PRESSED | STATE_TRACKING);
+			}
+		}
+	}
+}
+
+// MouseUp
+void
+IconButton::MouseUp(BPoint where)
+{
+	if (IsValid()) {
+//		if (!_HasFlags(STATE_FORCE_PRESSED)) {
+			if (_HasFlags(STATE_ENABLED) && _HasFlags(STATE_PRESSED) && Bounds().Contains(where))
+				Invoke();
+			else if (Bounds().Contains(where))
+				_AddFlags(STATE_INSIDE);
+			_ClearFlags(STATE_PRESSED | STATE_TRACKING);
+//		}
+	}
+}
+
+// MouseMoved
+void
+IconButton::MouseMoved(BPoint where, uint32 transit, const BMessage* message)
+{
+	if (IsValid()) {
+		uint32 buttons = 0;
+		Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons);
+		// catch a mouse up event that we might have missed
+		if (!buttons && _HasFlags(STATE_PRESSED)) {
+			MouseUp(where);
+			return;
+		}
+		if (buttons && !_HasFlags(STATE_TRACKING))
+			return;
+		if ((transit == B_INSIDE_VIEW || transit == B_ENTERED_VIEW)
+			&& _HasFlags(STATE_ENABLED))
+			_AddFlags(STATE_INSIDE);
+		else 
+			_ClearFlags(STATE_INSIDE);
+		if (_HasFlags(STATE_TRACKING)) {
+			if (Bounds().Contains(where))
+				_AddFlags(STATE_PRESSED);
+			else
+				_ClearFlags(STATE_PRESSED);
+		}
+	}
+}
+
+#define MIN_SPACE 15.0
+
+// GetPreferredSize
+void
+IconButton::GetPreferredSize(float* width, float* height)
+{
+	float minWidth = 0.0;
+	float minHeight = 0.0;
+	if (IsValid()) {
+		minWidth += fNormalBitmap->Bounds().IntegerWidth() + 1.0;
+		minHeight += fNormalBitmap->Bounds().IntegerHeight() + 1.0;
+	} else {
+		minWidth += MIN_SPACE;
+		minHeight += MIN_SPACE;
+	}
+	if (minWidth < MIN_SPACE)
+		minWidth = MIN_SPACE;
+	if (minHeight < MIN_SPACE)
+		minHeight = MIN_SPACE;
+	if (fLabel.CountChars() > 0) {
+		font_height fh;
+		GetFontHeight(&fh);
+		minHeight += ceilf(fh.ascent + fh.descent) + 4.0;
+		minWidth += StringWidth(fLabel.String()) + 4.0;
+	}
+
+	if (width)
+		*width = minWidth + 4.0;
+	if (height)
+		*height = minHeight + 4.0;
+}
+
+// Invoke
+status_t
+IconButton::Invoke(BMessage* message)
+{
+	if (!message)
+		message = Message();
+	if (message) {
+		BMessage clone(*message);
+		clone.AddInt64("be:when", system_time());
+		clone.AddPointer("be:source", (BView*)this);
+		clone.AddInt32("be:value", Value());
+		clone.AddInt32("id", ID());
+		return BInvoker::Invoke(&clone);
+	}
+	return BInvoker::Invoke(message);
+}
+
+// SetPressed
+void
+IconButton::SetPressed(bool pressed)
+{
+	if (pressed)
+		_AddFlags(STATE_FORCE_PRESSED);
+	else
+		_ClearFlags(STATE_FORCE_PRESSED);
+}
+
+// IsPressed
+bool
+IconButton::IsPressed() const
+{
+	return _HasFlags(STATE_FORCE_PRESSED);
+}
+
+// SetIcon
+status_t
+IconButton::SetIcon(const char* pathToBitmap)
+{
+	status_t status = B_BAD_VALUE;
+	if (pathToBitmap) {
+		BBitmap* fileBitmap = NULL;
+		// try to load bitmap from either relative or absolute path
+		BEntry entry(pathToBitmap, true);
+		if (!entry.Exists()) {
+			app_info info;
+			status = be_app->GetAppInfo(&info);
+			if (status == B_OK) {
+				BEntry app_entry(&info.ref, true);
+				BPath path;
+				app_entry.GetPath(&path);
+				status = path.InitCheck();
+				if (status == B_OK) {
+					status = path.GetParent(&path);
+					if (status == B_OK) {
+						status = path.Append(pathToBitmap, true);
+						if (status == B_OK)
+							fileBitmap = BTranslationUtils::GetBitmap(path.Path());
+						else 
+							printf("IconButton::SetIcon() - path.Append() failed: %s\n", strerror(status));
+					} else
+						printf("IconButton::SetIcon() - path.GetParent() failed: %s\n", strerror(status));
+				} else
+					printf("IconButton::SetIcon() - path.InitCheck() failed: %s\n", strerror(status));
+			} else
+				printf("IconButton::SetIcon() - be_app->GetAppInfo() failed: %s\n", strerror(status));
+		} else
+			fileBitmap = BTranslationUtils::GetBitmap(pathToBitmap);
+		if (fileBitmap) {
+			status = _MakeBitmaps(fileBitmap);
+			delete fileBitmap;
+		} else
+			status = B_ERROR;
+	}
+	return status;
+}
+
+// SetIcon
+status_t
+IconButton::SetIcon(const BBitmap* bitmap)
+{
+	if (bitmap && bitmap->ColorSpace() == B_CMAP8) {
+		status_t status = bitmap->InitCheck();
+		if (status >= B_OK) {
+			if (BBitmap* rgb32Bitmap = _ConvertToRGB32(bitmap)) {
+				status = _MakeBitmaps(rgb32Bitmap);
+				delete rgb32Bitmap;
+			} else
+				status = B_NO_MEMORY;
+		}
+		return status;
+	} else
+		return _MakeBitmaps(bitmap);
+}
+
+// SetIcon
+status_t
+IconButton::SetIcon(const BMimeType* fileType, bool small)
+{
+	status_t status = fileType ? fileType->InitCheck() : B_BAD_VALUE;
+	if (status >= B_OK) {
+		BBitmap* mimeBitmap = new(nothrow) BBitmap(BRect(0.0, 0.0, 15.0, 15.0), B_CMAP8);
+		if (mimeBitmap && mimeBitmap->IsValid()) {
+			status = fileType->GetIcon(mimeBitmap, small ? B_MINI_ICON : B_LARGE_ICON);
+			if (status >= B_OK) {
+				if (BBitmap* bitmap = _ConvertToRGB32(mimeBitmap)) {
+					status = _MakeBitmaps(bitmap);
+					delete bitmap;
+				} else
+					printf("IconButton::SetIcon() - B_RGB32 bitmap is not valid\n");
+			} else
+				printf("IconButton::SetIcon() - fileType->GetIcon() failed: %s\n", strerror(status));
+		} else
+			printf("IconButton::SetIcon() - B_CMAP8 bitmap is not valid\n");
+		delete mimeBitmap;
+	} else
+		printf("IconButton::SetIcon() - fileType is not valid: %s\n", strerror(status));
+	return status;
+}
+
+// SetIcon
+status_t
+IconButton::SetIcon(const unsigned char* bitsFromQuickRes,
+					uint32 width, uint32 height, color_space format, bool convertToBW)
+{
+	status_t status = B_BAD_VALUE;
+	if (bitsFromQuickRes && width > 0 && height > 0) {
+		BBitmap* quickResBitmap = new(nothrow) BBitmap(BRect(0.0, 0.0, width - 1.0, height - 1.0), format);
+		status = quickResBitmap ? quickResBitmap->InitCheck() : B_ERROR;
+		if (status >= B_OK) {
+			// It doesn't look right to copy BitsLength() bytes, but bitmaps
+			// exported from QuickRes still contain their padding, so it is alright.
+			memcpy(quickResBitmap->Bits(), bitsFromQuickRes, quickResBitmap->BitsLength());
+			if (format != B_RGB32 && format != B_RGBA32 && format != B_RGB32_BIG && format != B_RGBA32_BIG) {
+				// colorspace needs conversion
+				BBitmap* bitmap = new(nothrow) BBitmap(quickResBitmap->Bounds(), B_RGB32, true);
+				if (bitmap && bitmap->IsValid()) {
+					BView* helper = new BView(bitmap->Bounds(), "helper",
+											  B_FOLLOW_NONE, B_WILL_DRAW);
+					if (bitmap->Lock()) {
+						bitmap->AddChild(helper);
+						helper->SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+						helper->FillRect(helper->Bounds());
+						helper->SetDrawingMode(B_OP_OVER);
+						helper->DrawBitmap(quickResBitmap, BPoint(0.0, 0.0));
+						helper->Sync();
+						bitmap->Unlock();
+					}
+					status = _MakeBitmaps(bitmap);
+				} else
+					printf("IconButton::SetIcon() - B_RGB32 bitmap is not valid\n");
+				delete bitmap;
+			} else {
+				// native colorspace (32 bits)
+				if (convertToBW) {
+					// convert to gray scale icon
+					uint8* bits = (uint8*)quickResBitmap->Bits();
+					uint32 bpr = quickResBitmap->BytesPerRow();
+					for (uint32 y = 0; y < height; y++) {
+						uint8* handle = bits;
+						uint8 gray;
+						for (uint32 x = 0; x < width; x++) {
+							gray = uint8((116 * handle[0] + 600 * handle[1] + 308 * handle[2]) / 1024);
+							handle[0] = gray;
+							handle[1] = gray;
+							handle[2] = gray;
+							handle += 4;
+						}
+						bits += bpr;
+					}
+				}
+				status = _MakeBitmaps(quickResBitmap);
+			}
+		} else
+			printf("IconButton::SetIcon() - error allocating bitmap: %s\n", strerror(status));
+		delete quickResBitmap;
+	}
+	return status;
+}
+
+// ClearIcon
+void
+IconButton::ClearIcon()
+{
+	_DeleteBitmaps();
+	_Update();
+}
+
+// Bitmap
+BBitmap*
+IconButton::Bitmap() const
+{
+	BBitmap* bitmap = NULL;
+	if (fNormalBitmap && fNormalBitmap->IsValid()) {
+		bitmap = new(nothrow) BBitmap(fNormalBitmap);
+		if (bitmap->IsValid()) {
+			// TODO: remove this functionality when we use real transparent bitmaps
+			uint8* bits = (uint8*)bitmap->Bits();
+			uint32 bpr = bitmap->BytesPerRow();
+			uint32 width = bitmap->Bounds().IntegerWidth() + 1;
+			uint32 height = bitmap->Bounds().IntegerHeight() + 1;
+			color_space format = bitmap->ColorSpace();
+			if (format == B_CMAP8) {
+				// replace gray with magic transparent index
+			} else if (format == B_RGB32) {
+				for (uint32 y = 0; y < height; y++) {
+					uint8* bitsHandle = bits;
+					for (uint32 x = 0; x < width; x++) {
+						if (bitsHandle[0] == 216
+							&& bitsHandle[1] == 216
+							&& bitsHandle[2] == 216) {
+							bitsHandle[3] = 0;	// make this pixel completely transparent
+						}
+						bitsHandle += 4;
+					}
+					bits += bpr;
+				}
+			}
+		} else {
+			delete bitmap;
+			bitmap = NULL;
+		}
+	}
+	return bitmap;
+}
+
+// DrawBorder
+bool
+IconButton::DrawBorder() const
+{
+	return (IsEnabled() && (_HasFlags(STATE_INSIDE) || _HasFlags(STATE_TRACKING))
+			|| _HasFlags(STATE_FORCE_PRESSED));
+}
+
+// DrawNormalBorder
+void
+IconButton::DrawNormalBorder(BRect r, rgb_color background,
+							 rgb_color shadow, rgb_color darkShadow,
+							 rgb_color lightShadow, rgb_color light)
+{
+	_DrawFrame(r, shadow, darkShadow, light, lightShadow);
+}
+
+// DrawPressedBorder
+void
+IconButton::DrawPressedBorder(BRect r, rgb_color background,
+							rgb_color shadow, rgb_color darkShadow,
+							rgb_color lightShadow, rgb_color light)
+{
+	_DrawFrame(r, shadow, light, darkShadow, background);
+}
+
+// IsValid
+bool
+IconButton::IsValid() const
+{
+	return (fNormalBitmap && fDisabledBitmap && fClickedBitmap && fDisabledClickedBitmap
+		&& fNormalBitmap->IsValid()
+		&& fDisabledBitmap->IsValid()
+		&& fClickedBitmap->IsValid()
+		&& fDisabledClickedBitmap->IsValid());
+}
+
+// Value
+int32
+IconButton::Value() const
+{
+	return _HasFlags(STATE_PRESSED) ? B_CONTROL_ON : B_CONTROL_OFF;
+}
+
+// SetValue
+void
+IconButton::SetValue(int32 value)
+{
+	if (value)
+		_AddFlags(STATE_PRESSED);
+	else
+		_ClearFlags(STATE_PRESSED);
+}
+
+// IsEnabled
+bool
+IconButton::IsEnabled() const
+{
+	return _HasFlags(STATE_ENABLED) ? B_CONTROL_ON : B_CONTROL_OFF;
+}
+
+// SetEnabled
+void
+IconButton::SetEnabled(bool enabled)
+{
+	if (enabled)
+		_AddFlags(STATE_ENABLED);
+	else
+		_ClearFlags(STATE_ENABLED | STATE_TRACKING | STATE_INSIDE);
+}
+
+// _ConvertToRGB32
+BBitmap*
+IconButton::_ConvertToRGB32(const BBitmap* bitmap) const
+{
+	BBitmap* convertedBitmap = new(nothrow) BBitmap(bitmap->Bounds(), B_BITMAP_ACCEPTS_VIEWS, B_RGBA32);
+	if (convertedBitmap && convertedBitmap->IsValid()) {
+		memset(convertedBitmap->Bits(), 0, convertedBitmap->BitsLength());
+		BView* helper = new BView(bitmap->Bounds(), "helper",
+								  B_FOLLOW_NONE, B_WILL_DRAW);
+		if (convertedBitmap->Lock()) {
+			convertedBitmap->AddChild(helper);
+			helper->SetDrawingMode(B_OP_OVER);
+			helper->DrawBitmap(bitmap, BPoint(0.0, 0.0));
+			helper->Sync();
+			convertedBitmap->Unlock();
+		}
+	} else {
+		delete convertedBitmap;
+		convertedBitmap = NULL;
+	}
+	return convertedBitmap;
+}
+
+// _MakeBitmaps
+status_t
+IconButton::_MakeBitmaps(const BBitmap* bitmap)
+{
+	status_t status = bitmap ? bitmap->InitCheck() : B_BAD_VALUE;
+	if (status >= B_OK) {
+		// make our own versions of the bitmap
+		BRect b(bitmap->Bounds());
+		_DeleteBitmaps();
+		color_space format = bitmap->ColorSpace();
+		fNormalBitmap = new(nothrow) BBitmap(b, format);
+		fDisabledBitmap = new(nothrow) BBitmap(b, format);
+		fClickedBitmap = new(nothrow) BBitmap(b, format);
+		fDisabledClickedBitmap = new(nothrow) BBitmap(b, format);
+		if (IsValid()) {
+			// copy bitmaps from file bitmap
+			uint8* nBits = (uint8*)fNormalBitmap->Bits();
+			uint8* dBits = (uint8*)fDisabledBitmap->Bits();
+			uint8* cBits = (uint8*)fClickedBitmap->Bits();
+			uint8* dcBits = (uint8*)fDisabledClickedBitmap->Bits();
+			uint8* fBits = (uint8*)bitmap->Bits();
+			int32 nbpr = fNormalBitmap->BytesPerRow();
+			int32 fbpr = bitmap->BytesPerRow();
+			int32 pixels = b.IntegerWidth() + 1;
+			int32 lines = b.IntegerHeight() + 1;
+			// nontransparent version:
+			if (format == B_RGB32 || format == B_RGB32_BIG) {
+				// iterate over color components
+				for (int32 y = 0; y < lines; y++) {
+					for (int32 x = 0; x < pixels; x++) {
+						int32 nOffset = 4 * x;
+						int32 fOffset = 4 * x;
+						nBits[nOffset + 0] = fBits[fOffset + 0];
+						nBits[nOffset + 1] = fBits[fOffset + 1];
+						nBits[nOffset + 2] = fBits[fOffset + 2];
+						nBits[nOffset + 3] = 255;
+						// clicked bits are darker (lame method...)
+						cBits[nOffset + 0] = (uint8)((float)nBits[nOffset + 0] * 0.8);
+						cBits[nOffset + 1] = (uint8)((float)nBits[nOffset + 1] * 0.8);
+						cBits[nOffset + 2] = (uint8)((float)nBits[nOffset + 2] * 0.8);
+						cBits[nOffset + 3] = 255;
+						// disabled bits have less contrast (lame method...)
+						uint8 grey = 216;
+						float dist = (nBits[nOffset + 0] - grey) * 0.4;
+						dBits[nOffset + 0] = (uint8)(grey + dist);
+						dist = (nBits[nOffset + 1] - grey) * 0.4;
+						dBits[nOffset + 1] = (uint8)(grey + dist);
+						dist = (nBits[nOffset + 2] - grey) * 0.4;
+						dBits[nOffset + 2] = (uint8)(grey + dist);
+						dBits[nOffset + 3] = 255;
+						// disabled bits have less contrast (lame method...)
+						grey = 188;
+						dist = (nBits[nOffset + 0] - grey) * 0.4;
+						dcBits[nOffset + 0] = (uint8)(grey + dist);
+						dist = (nBits[nOffset + 1] - grey) * 0.4;
+						dcBits[nOffset + 1] = (uint8)(grey + dist);
+						dist = (nBits[nOffset + 2] - grey) * 0.4;
+						dcBits[nOffset + 2] = (uint8)(grey + dist);
+						dcBits[nOffset + 3] = 255;
+					}
+					nBits += nbpr;
+					dBits += nbpr;
+					cBits += nbpr;
+					dcBits += nbpr;
+					fBits += fbpr;
+				}
+			// transparent version:
+			} else if (format == B_RGBA32 || format == B_RGBA32_BIG) {
+				// iterate over color components
+				for (int32 y = 0; y < lines; y++) {
+					for (int32 x = 0; x < pixels; x++) {
+						int32 nOffset = 4 * x;
+						int32 fOffset = 4 * x;
+						nBits[nOffset + 0] = fBits[fOffset + 0];
+						nBits[nOffset + 1] = fBits[fOffset + 1];
+						nBits[nOffset + 2] = fBits[fOffset + 2];
+						nBits[nOffset + 3] = fBits[fOffset + 3];
+						// clicked bits are darker (lame method...)
+						cBits[nOffset + 0] = (uint8)(nBits[nOffset + 0] * 0.8);
+						cBits[nOffset + 1] = (uint8)(nBits[nOffset + 1] * 0.8);
+						cBits[nOffset + 2] = (uint8)(nBits[nOffset + 2] * 0.8);
+						cBits[nOffset + 3] = fBits[fOffset + 3];
+						// disabled bits have less opacity
+						dBits[nOffset + 0] = fBits[fOffset + 0];
+						dBits[nOffset + 1] = fBits[fOffset + 1];
+						dBits[nOffset + 2] = fBits[fOffset + 2];
+						dBits[nOffset + 3] = (uint8)(fBits[fOffset + 3] * 0.5);
+						// disabled bits have less contrast (lame method...)
+						dcBits[nOffset + 0] = (uint8)(nBits[nOffset + 0] * 0.8);
+						dcBits[nOffset + 1] = (uint8)(nBits[nOffset + 1] * 0.8);
+						dcBits[nOffset + 2] = (uint8)(nBits[nOffset + 2] * 0.8);
+						dcBits[nOffset + 3] = (uint8)(fBits[fOffset + 3] * 0.5);
+					}
+					nBits += nbpr;
+					dBits += nbpr;
+					cBits += nbpr;
+					dcBits += nbpr;
+					fBits += fbpr;
+				}
+			// unsupported format
+			} else {
+				printf("IconButton::_MakeBitmaps() - bitmap has unsupported colorspace\n");
+				status = B_MISMATCHED_VALUES;
+				_DeleteBitmaps();
+			}
+		} else {
+			printf("IconButton::_MakeBitmaps() - error allocating local bitmaps\n");
+			status = B_NO_MEMORY;
+			_DeleteBitmaps();
+		}
+	} else
+		printf("IconButton::_MakeBitmaps() - bitmap is not valid\n");
+	return status;
+}
+
+// _DeleteBitmaps
+void
+IconButton::_DeleteBitmaps()
+{
+	delete fNormalBitmap;
+	fNormalBitmap = NULL;
+	delete fDisabledBitmap;
+	fDisabledBitmap = NULL;
+	delete fClickedBitmap;
+	fClickedBitmap = NULL;
+	delete fDisabledClickedBitmap;
+	fDisabledClickedBitmap = NULL;
+}
+
+// _Update
+void
+IconButton::_Update()
+{
+	if (LockLooper()) {
+		Invalidate();
+		UnlockLooper();
+	}
+}
+
+// _AddFlags
+void
+IconButton::_AddFlags(uint32 flags)
+{
+	if (!(fButtonState & flags)) {
+		fButtonState |= flags;
+		_Update();
+	}
+}
+
+// _ClearFlags
+void
+IconButton::_ClearFlags(uint32 flags)
+{
+	if (fButtonState & flags) {
+		fButtonState &= ~flags;
+		_Update();
+	}
+}
+
+// _HasFlags
+bool
+IconButton::_HasFlags(uint32 flags) const
+{
+	return (fButtonState & flags);
+}
+
+// _DrawFrame
+void
+IconButton::_DrawFrame(BRect r, rgb_color col1, rgb_color col2,
+					   rgb_color col3, rgb_color col4)
+{
+	BeginLineArray(8);
+		AddLine(BPoint(r.left, r.bottom), BPoint(r.left, r.top), col1);
+		AddLine(BPoint(r.left + 1.0, r.top), BPoint(r.right, r.top), col1);
+		AddLine(BPoint(r.right, r.top + 1.0), BPoint(r.right, r.bottom), col2);
+		AddLine(BPoint(r.right - 1.0, r.bottom), BPoint(r.left + 1.0, r.bottom), col2);
+		r.InsetBy(1.0, 1.0);
+		AddLine(BPoint(r.left, r.bottom), BPoint(r.left, r.top), col3);
+		AddLine(BPoint(r.left + 1.0, r.top), BPoint(r.right, r.top), col3);
+		AddLine(BPoint(r.right, r.top + 1.0), BPoint(r.right, r.bottom), col4);
+		AddLine(BPoint(r.right - 1.0, r.bottom), BPoint(r.left + 1.0, r.bottom), col4);
+	EndLineArray();
+}

Added: haiku/trunk/src/apps/launchbox/IconButton.h
===================================================================
--- haiku/trunk/src/apps/launchbox/IconButton.h	2007-06-09 12:00:06 UTC (rev 21372)
+++ haiku/trunk/src/apps/launchbox/IconButton.h	2007-06-09 12:01:39 UTC (rev 21373)
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2006, Haiku.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *		Stephan A?mus 
+ */
+
+/** gui class that loads an image from disk and shows it
+    as clickable button */
+
+// TODO: inherit from BControl?
+
+// NOTE: this file is a duplicate of the version in Icon-O-Matic/generic
+// it should be placed into a common folder for generic useful stuff
+
+#ifndef ICON_BUTTON_H
+#define ICON_BUTTON_H
+
+#include 
+#include 
+#include 
+
+class BBitmap;
+class BMimeType;
+
+class IconButton : public BView, public BInvoker {
+ public:
+								IconButton(const char* name,
+										   uint32 id,
+										   const char* label = NULL,
+										   BMessage* message = NULL,
+										   BHandler* target = NULL);
+	virtual						~IconButton();
+
+	// BView interface
+	virtual	void				MessageReceived(BMessage* message);
+	virtual	void				AttachedToWindow();
+	virtual	void				Draw(BRect updateRect);
+	virtual	void				MouseDown(BPoint where);
+	virtual	void				MouseUp(BPoint where);
+	virtual	void				MouseMoved(BPoint where, uint32 transit,
+										   const BMessage* message);
+	virtual	void				GetPreferredSize(float* width,
+												 float* height);
+
+	// BInvoker interface
+	virtual	status_t			Invoke(BMessage* message = NULL);
+
+	// IconButton
+			bool				IsValid() const;
+
+	virtual	int32				Value() const;
+	virtual	void				SetValue(int32 value);
+
+			bool				IsEnabled() const;
+			void				SetEnabled(bool enable);
+
+			void				SetPressed(bool pressed);
+			bool				IsPressed() const;
+			uint32				ID() const
+									{ return fID; }
+
+			status_t			SetIcon(const char* pathToBitmap);
+			status_t			SetIcon(const BBitmap* bitmap);

[... truncated: 2107 lines follow ...]


From stippi at mail.berlios.de  Sat Jun  9 14:07:55 2007
From: stippi at mail.berlios.de (stippi at BerliOS)
Date: Sat, 9 Jun 2007 14:07:55 +0200
Subject: [Haiku-commits] r21374 - haiku/trunk/build/jam
Message-ID: <200706091207.l59C7tVj027813@sheep.berlios.de>

Author: stippi
Date: 2007-06-09 14:07:55 +0200 (Sat, 09 Jun 2007)
New Revision: 21374
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21374&view=rev

Modified:
   haiku/trunk/build/jam/HaikuImage
Log:
* cleanup in the Leaf menu: Applications is no longer a link to
  /boot/beos/apps, but a folder containing links to _selected_
  apps in that folder
* a new entry "Desktop Applets" has been added, which contains
  all the apps that you either do or do not start at system boot,
  but don't need frequent access to
* some apps have been hidden:
  - ShowImage and Expander are usually not
    directly started on their own, but through double clicking documents
  - AboutSystem is invoked elsewhere from the Leaf menu, so it doesn't need
    to clutter the Applications menu
* we almost introduced a third category for rarely used apps, but in the
  end it would only have contained Installer, Icon-O-Matic and Diskprobe,
  and we felt that it is ok to leave these in the Applications menu, as long
  as their number is small


Modified: haiku/trunk/build/jam/HaikuImage
===================================================================
--- haiku/trunk/build/jam/HaikuImage	2007-06-09 12:01:39 UTC (rev 21373)
+++ haiku/trunk/build/jam/HaikuImage	2007-06-09 12:07:55 UTC (rev 21374)
@@ -43,17 +43,19 @@
 	zipcloak zipgrep zipnote zipsplit zmore znew
 ;
 
-BEOS_APPS = Terminal Expander People ShowImage ProcessController
-	SoundRecorder Magnify DiskProbe AboutSystem StyledEdit Installer Workspaces
-	$(X86_ONLY)Cortex MediaPlayer DeskCalc MidiPlayer
-	Icon-O-Matic Mail CDPlayer NetworkStatus TV
+	
+BEOS_APPS = AboutSystem DeskCalc DiskProbe CDPlayer Expander Icon-O-Matic
+	Installer LaunchBox Magnify Mail MediaPlayer MidiPlayer NetworkStatus
+	People PowerStatus ProcessController ShowImage SoundRecorder StyledEdit
+	Terminal TV Workspaces
 ;
 BEOS_PREFERENCES = Appearance Backgrounds DataTranslations E-mail FileTypes
-	Fonts Media Menu Mouse Keyboard Keymap Printers Screen ScreenSaver Sounds
+	Fonts Keyboard Keymap Media Menu Mouse Printers Screen ScreenSaver Sounds
 	Time VirtualMemory
 ;
-BEOS_DEMOS = BitmapDrawing Chart Clock FontDemo $(X86_ONLY)GLDirectMode
-	$(X86_ONLY)GLTeapot Mandelbrot PictureTest Playground Pulse
+BEOS_DEMOS = BitmapDrawing Chart Clock $(X86_ONLY)Cortex FontDemo
+	$(X86_ONLY)GLDirectMode $(X86_ONLY)GLTeapot Mandelbrot PictureTest
+	Playground Pulse
 ;
 BEOS_SYSTEM_LIB = libbe.so $(HAIKU_LIBSTDC++) libmedia.so libtracker.so
 	libtranslation.so libnetwork.so libdebug.so libbsd.so libmail.so
@@ -79,6 +81,7 @@
 BEOS_ADD_ONS_TRANSLATORS = BMPTranslator GIFTranslator JPEGTranslator
 	JPEG2000Translator TIFFTranslator PNGTranslator PPMTranslator 
 	RTF-Translator SGITranslator STXTTranslator TGATranslator
+	WonderBrushTranslator
 ;
 BEOS_ADD_ONS_MEDIA = mixer.media_addon 
 	hmulti_audio.media_addon tone_producer_demo.media_addon
@@ -146,8 +149,8 @@
 AddDriversToHaikuImage				: console dprintf $(X86_ONLY)keyboard null
 									  random tty zero ;
 AddDriversToHaikuImage audio hmulti	: $(BEOS_ADD_ONS_DRIVERS_AUDIO) ;
-AddDriversToHaikuImage midi		: $(BEOS_ADD_ONS_DRIVERS_MIDI) ;
-AddDriversToHaikuImage bus		: usb_raw ;
+AddDriversToHaikuImage midi			: $(BEOS_ADD_ONS_DRIVERS_MIDI) ;
+AddDriversToHaikuImage bus			: usb_raw ;
 AddDriversToHaikuImage disk scsi	: scsi_cd scsi_dsk ;
 AddDriversToHaikuImage disk virtual	: nbd ;
 AddDriversToHaikuImage dvb			: cx23882 ;
@@ -176,12 +179,54 @@
 AddFilesToHaikuImage beos system		: runtime_loader Deskbar Tracker ;
 AddFilesToHaikuImage beos bin			: $(BEOS_BIN) consoled ;
 AddFilesToHaikuImage beos apps			: $(BEOS_APPS) ;
-AddFilesToHaikuImage beos preferences		: $(BEOS_PREFERENCES) ;
+AddFilesToHaikuImage beos preferences	: $(BEOS_PREFERENCES) ;
 AddFilesToHaikuImage beos demos			: $(BEOS_DEMOS) ;
 
 AddSymlinkToHaikuImage home Desktop : /boot/home : Home ;
 
-AddSymlinkToHaikuImage home config be : /boot/beos/apps : Applications ;
+# Deskbar Application links
+AddDirectoryToHaikuImage home config be Applications ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/CDPlayer : CDPlayer ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/DeskCalc : DeskCalc ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/DiskProbe : DiskProbe ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/Icon-O-Matic : Icon-O-Matic ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/Magnify : Magnify ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/Mail : Mail ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/MediaPlayer : MediaPlayer ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/MidiPlayer : MidiPlayer ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/People : People ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/SoundRecorder : SoundRecorder ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/StyledEdit : StyledEdit ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/Terminal : Terminal ;
+AddSymlinkToHaikuImage home config be Applications
+					: /boot/beos/apps/TV : TV ;
+
+# Deskbar Desktop Applets links
+AddDirectoryToHaikuImage home config be Desktop\ Applets ;
+AddSymlinkToHaikuImage home config be Desktop\ Applets
+					: /boot/beos/apps/LaunchBox : LaunchBox ;
+AddSymlinkToHaikuImage home config be Desktop\ Applets
+					: /boot/beos/apps/NetworkStatus : NetworkStatus ;
+AddSymlinkToHaikuImage home config be Desktop\ Applets
+					: /boot/beos/apps/PowerStatus : PowerStatus ;
+AddSymlinkToHaikuImage home config be Desktop\ Applets
+					: /boot/beos/apps/ProcessController : ProcessController ;
+AddSymlinkToHaikuImage home config be Desktop\ Applets
+					: /boot/beos/apps/Workspaces : Workspaces ;
+
+# Deskbar Preferences and Demos links
 AddSymlinkToHaikuImage home config be : /boot/beos/preferences : Preferences ;
 AddSymlinkToHaikuImage home config be : /boot/beos/demos : Demos ;
 



From darkwyrm at mail.berlios.de  Sat Jun  9 14:19:05 2007
From: darkwyrm at mail.berlios.de (darkwyrm at BerliOS)
Date: Sat, 9 Jun 2007 14:19:05 +0200
Subject: [Haiku-commits] r21375 - haiku/trunk/src/documentation/uiguidelines
Message-ID: <200706091219.l59CJ5fQ028839@sheep.berlios.de>

Author: darkwyrm
Date: 2007-06-09 14:19:05 +0200 (Sat, 09 Jun 2007)
New Revision: 21375
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21375&view=rev

Modified:
   haiku/trunk/src/documentation/uiguidelines/HaikuHIG.xml
Log:
Proofreading fixes for the last half of the document


Modified: haiku/trunk/src/documentation/uiguidelines/HaikuHIG.xml
===================================================================
--- haiku/trunk/src/documentation/uiguidelines/HaikuHIG.xml	2007-06-09 12:07:55 UTC (rev 21374)
+++ haiku/trunk/src/documentation/uiguidelines/HaikuHIG.xml	2007-06-09 12:19:05 UTC (rev 21375)
@@ -663,10 +663,10 @@
 Open... (Command + O) Open a document from disk.
 
 
-Open Recent This is a submenu in the File menu to allow fast access to recent documents. It should not open a window of any kind. The number of recent items should be limited to no more than 5 items.
+Open Recent This is a submenu in the File menu to allow fast access to recent documents. It should not open a window of any kind except if your program uses a one-window-per-document architecture. The number of recent items should be limited to no more than 5 items.
 
 
-Close (Command + W) The function of this item depends on the program architecture. In a program which has one document per window, this closes the window. If there is only one open window, this quits the program. Although it is not recommended, if   a program allows for multiple documents to be shown in the same window, this item closes one document.
+Close (Command + W) The function of this item depends on the program architecture. In a program which has one document per window, this closes the window. If there is only one open window, this quits the program. Although it is not recommended, if a program allows for multiple documents to be shown in the same window, this item closes one document.
 
 
 Save (Command + S) Save the current document. This should not show a window unless it is a new document that has not yet been saved. It does not normally show a window, so no ellipsis is necessary.
@@ -686,10 +686,10 @@
 
 
 
-Revert Undoes all changes to the document.
+Revert Undoes all changes made to the document since the last save.
 
 
-Import From... Import data from another file into the current document. Like Open, this always shows a window.
+Import From... Import data from another file format into a new document. Like Open, this always shows a window.
 
 
 Export To... Convert the data in the current document to another format. Like Save As, this always shows a window.
@@ -775,10 +775,10 @@
 NormalGeneral purpose
 Modal:SubsetOnly when you need to block all windows in a subset
 Modal:AppWhen a user decision is required to continue with the rest of the program
-Modal:AllWhen the user needs to make a system-critical decision, such as system shutdown confirmation.
+Modal:AllWhen the user needs to make a system-critical decision, such as system shutdown confirmation. Use this feel only when you absolutely have to.
 Floating:SubsetWhen a subset window needs to take priority in its subset.
 Floating:AppTool and utility windows
-Floating:AllSystem monitors and other windows which the user will always want to have visible.
+Floating:AllSystem monitors and other windows which the user will always want to have visible. Like Modal:All, use this only when absolutely necessary.
 
 
 
@@ -798,28 +798,28 @@
 
 Merely knowing what kind of window look and feel to use in a given situation is not enough: you also have to be aware of resizing, zooming, moving, closing, and minimizing because they affect your program in different ways. Once you know what kind of window you need, you should also figure out what its initial size and location are going to be. You also should not restrict the other actions a user can perform on a window unless you have a good reason that does not include "I don't want to write code to handle this."
 
-Care should be given to what name is used for a window. The main window of your program should use your program's name. Windows which were opened from a menu item should have the same name as that of the menu item without the ellipsis. Document windows should use the document's name. New documents should use the name "Untitled" with subsequent new documents appending a number. The first untitled document should not have a number. A titled window should never have an empty title bar.
+Care should be given to what name is used for a window. The main window of your program should include your program's name. Windows which were opened from a menu item should have the same name as that of the menu item without the ellipsis. Document windows should include the document's name. The first new document in the application should use the name "Untitled" with subsequent new documents appending a number. A titled window should never have an empty title bar.
 
-The size of a window depends on a number of factors. An application window should have an initial size which is the  minimum needed to see all controls in it without overcrowding. Controls should never overlap. This initial size should also be the minimum size for the window which is passed to SetSizeLimits. The initial size for a document window should be large enough to see the entire document or at least a significant portion of the document if it is larger than the screen. Do not arbitrarily restrict resizing unless it does not make sense to allow resizing in a particular direction. If a window allows resizing, its size should generally be saved when closed or the program quits and restored to that size when shown again.
+The size of a window depends on a number of factors. An application window should have an initial size which is the minimum needed to see all controls in it without overcrowding. Controls should never overlap. This initial size should also be the minimum size for the window which is passed to SetSizeLimits. The initial size for a document window should be large enough to see the entire document or at least a significant portion of the document if it is larger than the screen. Do not arbitrarily restrict resizing unless it does not make sense to allow resizing in a particular direction. If a window allows resizing, its size should generally be saved when closed or the program quits and restored to that size when shown again.
 
-Zooming is similar to resizing, but there are differences in which should permit zooming and how it should be done. Utility windows, for example, are not intended to be the main focus of the program, so they should not allow zooming even though they should allow resizing except where inappropriate. Document windows should expand to fill the largest sensible space to allow editing. Often times this is the entire screen, but it may not be. Word processors will probably move to the top of the screen, resize the width to the maximum width of the current document's view, and resize the height to the bottom of the screen.
+Zooming is similar to resizing, but there are differences in which should permit zooming and how it should be done. Utility windows, for example, are not intended to be the main focus of the program, so they should not allow zooming even though they should allow resizing except where inappropriate. Document windows should expand to fill the largest sensible space to allow editing. Often times this is the entire screen, but some for some programs, this doesn't make sense. Word processors, for example, will probably move the document window to the top of the screen, resize the width to the maximum width of the current document's view, and resize the height to the bottom of the screen.
 
 The placement of a window on the screen also varies depending on its usage. Program windows should initially either show themselves in the center of the screen or just a little above it. The same goes for the initial placement of a document window. Additional document windows should duplicate the most recent document window's frame offset by 15 pixels in both directions. As with size, a program should generally remember the screen placement of the windows and movement should not be restricted unless there is a good reason for it.
 
 A window need not always be visible. Duh. Considering that it can be hidden or closed altogether may be a bit confusing. Generally, a document should allow minimizing to make it possible for the user to get the document "out of the way" for a moment without having to close it entirely. Utility windows and program windows which are not the main window should normally not permit minimizing and just allow closing. The main window should allow minimizing. Note that when a program is not the focus, utility windows with the Floating:Subset and Floating:App behaviors will be hidden. Windows should normally be allowed to close unless there is a very good reason for it.
 
-A number of times it has been mentioned that you should not prevent something unless there is sufficient reason to do so. Particularly on other platforms, developers have been known to just disallow resizing because they didn't want to bother themselves with writing handler code. There are other instances where, for example, a window could not be closed because the code had a design flaw which would cause a crash if the window were closed. Remember: the more work you do in making your program helpful means the less work the user has to do which means that your program is easier to use.
+A number of times in this document it has been mentioned that you should not prevent something unless there is sufficient reason to do so. Particularly on other platforms, developers have been known to just disallow resizing because they didn't want to bother themselves with writing handler code. There are other instances where, for example, a window could not be closed because the code had a design flaw which would cause a crash if the window were closed. Remember: the more work you do in making your program helpful means the less work the user has to do, which means that your program is easier to use.
 
 
 
 B_ACCEPTS_FIRST_CLICK
 
-In MacOS X, the feature this flag enables is called click-through. It means that clicking on the window passes the click through to the control the mouse was under at the time even when the window does not have the focus. As a rule, this behavior should not be used, but there are times when it is quite useful, such as for system monitor programs, the Deskbar, and so forth.
+In MacOS X, the feature this flag enables is called click-through. It means that clicking on the window passes the click through to the control the mouse was under at the time even when the window does not have the focus. As a rule, this behavior should not be used, but there are times when it is quite useful, such as for system monitor programs, the Deskbar, and so forth. Typically, this flag is used for "helper" applications and utility windows.
 
 
 Modality
 
-By default, windows in BeOS operating systems are modeless, meaning that you can click on other windows besides the one with the focus. Occasionally, there is a need to force the user to make a decision before moving on. This is an appropriate time to use a modal window. The need is far less often than what most would believe, however. Most of the time the only reason to use a modal window would be if not doing so would make potential for the user to lose data and there is nothing that can be done to the code architecture to prevent it. This follows the "no restrictions for no good reason" way of thinking mentioned above -- modal windows place restrictions on what windows he can or can't click on. 
+By default, windows in BeOS operating systems are modeless, meaning that you can click on other windows besides the one with the focus. Occasionally, there is a need to force the user to make a decision before moving on. This is an appropriate time to use a modal window. The need is far less often than what many would believe, however. Most of the time the only reason to use a modal window would be if not doing so would make potential for the user to lose data and there is nothing that can be done to the code architecture to prevent it. This follows the "no restrictions for no good reason" way of thinking mentioned above -- modal windows place restrictions on what windows he can or can't click on. 
 
 
 
@@ -829,9 +829,9 @@
 
 Alert Windows
 
-Alert windows are the single easiest way to make usability mistakes. Most often, they are used to show error messages. The problem is that they are used *far* more often than they should be and the error messages that are used in them are too technical for a regular user to understand. They are also used to ask the user a question. More often than not, the question that is asked could have just as easily been answered by the developer had he thought ahead a bit. Do just about whatever it takes to gracefully handle errors without bothering the user. Only when all other options have been exhausted should you show an error message. For help on writing good error messages, see Chapter 6.
+Alert windows are the single easiest way to make usability mistakes. Most often, they are used to show error messages. The problem is that they are used *far* more often than they should be and the error messages that are used in them are too technical for a regular user to understand or are just plain useless. They are also used to ask the user a question. More often than not, the question that is asked could have just as easily been answered by the developer, had he thought ahead a bit. Do just about whatever it takes to gracefully handle errors without bothering the user. Only when all other options have been exhausted should you show an error message. For help on writing good error messages, see Chapter 6.
 
-Before you ask the user a question, be sure that it is one which you honestly can't answer yourself or can't do without possibly disturbing the way the user works. For example, it is good courtesy to ask the user if he would like your program to be the default handler for a particular kind of file when your program is installed. It is *never* acceptable to ask the user "Are you sure you want to quit?" If your program is asked to quit, handle unsaved documents and quit. "Are you sure..." questions should be asked only if the action involves the undoable destruction of data, such as deleting a file instead of moving it to the Trash. Avoiding these kinds of situations entirely is a better solution - if the confirmation is asked too often, the user will develop the habit of confirming it without a second thought.
+Before you ask the user a question, be sure that it is one which you honestly can't answer yourself or can't do without possibly disturbing the way the user works. For example, it is good courtesy to ask the user if he would like your program to be the default handler for a particular kind of file when your program is installed. It is *never* acceptable to ask the user "Are you sure you want to quit?" If your program is asked to quit, handle unsaved documents and quit. "Are you sure..." questions should be asked only if the action involves the undoable destruction of data, such as deleting a file instead of moving it to the Trash. Avoiding these kinds of situations entirely is a better solution. If the confirmation is asked too often, the user will develop the habit of confirming it without a second thought and your asking the question will be rendered moot.
 
 When you do use an alert window, please follow these guidelines:
 
@@ -847,22 +847,22 @@
 
 Find Windows
 
-Windows used to search for data in a document are not very different from others, but how they are used can help or hinder the user when searching. It only needs to be shown when the user needs to set the search characteristics. Once they are set, the window should itself disappear and the search should be performed. A find window which stays visible clutters the screen and often obscures part of the current document. It also places the program in a separate mode, which should generally be avoided. The search itself should default to case-insensitive searches with an option to allow case sensitivity. Search by regular expression is an option that should be limited to programs which have programmers as the intended audience.
+Windows used to search for data in a document are not very different from others, but how they are used can help, hinder, or annoy the user when searching. It only needs to be shown when the user needs to set the search terms. Once they are set, the window should itself disappear and the search should be performed. A find window which stays visible clutters the screen and often obscures part of the current document, even the result of the search. It also places the program in a separate mode, which should generally be avoided. The search itself should default to case-insensitive searches with an option to allow case sensitivity. Search by regular expression is an option that should normally be limited to programs which have programmers as the intended audience.
 
 
 
 Options Window Design
 
-Windows to allow the user to change various program options are another place where developers commonly commit a usability faux pas or two. The most common mistakes are poorly-chosen defaults, technical terminology, and too many choices. Here are some guidelines for making a good one:
+Windows to allow the user to change various program options are another place where developers commonly commit a usability faux pas or two. The most common mistakes are poorly-chosen defaults, inappropriate language for the target audience, and too many choices. Here are some guidelines for making a good one:
 
 
 Choose defaults which fit the most number of people.
 
 When possible, have changes take place immediately instead of requiring the user to click OK. If you do this, provide buttons to revert changes and also to set the default values.
 
-Provide options for significant features. This would include things like default file format for CD ripper, European vs American date format, or the default account in a mail client. Frivolous options include "Use Ins key for paste" and "Confirm Program Quit".
+Provide options for significant features. This would include things like default file format for CD ripper, European vs American date format, or the default account in a mail client. Unncessary options include "Use Ins key for paste" and "Confirm Program Quit".
 
-Use everyday language. For example, the web browser option "Move system caret with focus/selection changes" requires some technical knowledge. A better way to label such an option would be "Allow text to be selected with the keyboard." Both refer to the same option. The difference is how many people can understand what it does.
+Use language appropriate for the target audience as mentioned in Chapter 2. For example, the web browser option "Move system caret with focus/selection changes" requires some technical knowledge. A better way to label such an option would be "Allow text to be selected with the keyboard." Both refer to the same option. The difference is how many people can understand what it does.
 
 
 
@@ -870,7 +870,7 @@
 
 Open and Save Panels
 
-BFilePanel is used for both opening and saving files, but there is more to using them well than merely showing a list of files. Remember the location the user was viewing, and if it is inaccessible for some reason, show the Home folder. When possible, make use of file filters to eliminate files your program does not handle. By filtering out "bad" files, you eliminate errors and at the same time reduce the amount of time the user needs to find the file he wants. Offering a possible file name when saving a new document is another way to help the user. The title of the panel needs to match the task, whether it is Import, Export As, Save As, Save, Open, or something else.
+BFilePanel is used for both opening and saving files, but there is more to using them well than merely showing a list of files. Remember the location the user was viewing, and if it is inaccessible for some reason, show the Home folder. When possible, make use of file filters to eliminate files your program does not handle. By filtering out "bad" files, you eliminate errors and at the same time reduce the amount of time the user needs to find the file he wants by reducing the number of options. Offering a possible file name when saving a new document is another way to help the user. The title of the panel needs to match the task, whether it is Import, Export As, Save As, Save, Open, or something else.
 
 
 
@@ -902,10 +902,11 @@
 
 
 
-Make them too small or ridiculously large -- like 100 pixels square for the word 'OK'
+Make them too small or ridiculously large -- like 100 pixels square for the word 'OK' when the font size is 10 point.
 Leave them blank
 Show a menu with one
 Use them for labels
+Change the label font
 
 
 
@@ -931,6 +932,7 @@
 
 Label checkboxes so that the user understands ahead of time what clicking on it will do.
 Use care in calculating bounding boxes
+Carefully choose label text
 
 
 
@@ -965,12 +967,13 @@
 Label radio buttons so that the user understands ahead of time what clicking on one will do.
 Use care in calculating bounding boxes
 Set a default value
+Carefully choose label text
 
 
 
 
 Use them individually or use them the same way as checkboxes
-Use more than 5 in a group
+Use more than 5 or 6 in a group
 
 
 
@@ -1033,12 +1036,13 @@
 Show tick marks for each value if your slider has distinct increments
 Place the largest value at the right or top
 Use the appropriate orientation
+Label each slider position when the increment size changes, such as logarithmically
 
 
 
 
 Use a slider for a progress indicator or scrollbar
-Label each slider position
+Label each slider position for sliders with fixed increment sizes
 
 
 
@@ -1065,12 +1069,13 @@
 
 Label controls
 Use a separate label when layout makes it hard to use a control's built-in label.
-Associate labels with their controls via proximity
+Use proximity to associate labels with their controls
 
 
 
 
 Use a label for large amounts of static text
+Use a separate label object for controls which have label functions built-in
 
 
 
@@ -1106,6 +1111,7 @@
 Use a text control for a label
 Make them too small
 Use them for static text
+Arbitrarily limit the number of characters without a very good reason
 
 
 
@@ -1205,13 +1211,13 @@
 Use tabs to select a particular mode
 Nest tab views
 Use so many tabs that a scrolling is needed to see them all
-Place confirm / cancel buttons in tabs
+Place confirm / cancel buttons inside tabs
 Overlay toolbars by using tabs
 Use vertical text with vertical tabs
 Use tabs on more than one side at once
 Use one tab all by itself
-Just use icons to label tabs
-Use a scrollbar on a form in a tab
+Use unlabelled icons for tab titles
+Use a scrollbar to scroll a form inside a tab
 
 
 
@@ -1300,7 +1306,7 @@
 
 
 
-Allow the user to let go of the mouse button and still have them menu stay visible
+Make pop-up menus sticky
 Use pop-up menus for context menus
 
 
@@ -1367,7 +1373,7 @@
 
 
 Use them to speed up access to common functions
-Be conservative in button colors
+Avoid bright colors
 Make the function of each button obvious from the icons used
 Make toolbar buttons look like buttons and look clickable
 
@@ -1392,7 +1398,7 @@
 
 Installation and Updates
 
-It is easy to get so wrapped up in developing great software that you forget about getting it onto a user's computer. It pays to pay attention to detail in the installation of your software -- if a user can't get your program to work on his machine, you've just managed to both hurt your reputation as a developer and probably lose a user at the same time. Installation is one of those elements of software development that is given little, if any, attention when it works well but is quickly noticed when something goes wrong. As of this writing, there are two main methods of packaging and installing software on BeOS-based operating systems: zip files and Software Valet packages. 
+It is easy to get so wrapped up in developing great software that you forget about getting it onto a user's computer. It pays to pay attention to detail in the installation of your software -- if a user can't get your program to work on his machine, you've just managed to both hurt your reputation as a developer and lost a user at the same time. Installation is one of those elements of software development that is given little, if any, attention when it works well but is quickly noticed when something goes wrong. As of this writing, there are two main methods of packaging and installing software on BeOS-based operating systems: zip files and Software Valet packages. 
 
 
 Zip Files
@@ -1410,7 +1416,7 @@
 
 Getting Program Updates
 
-While there is no official support from the operating system, a conscientious developer will make a way for the user to easily update your program. Ideally, your program should automatically check for updates, ask the user if he would like to download them, download them in the background, and then install the updates when your program closes. Providing a way to roll back the updates in case of something going seriously wrong is also a very good idea. The only problem with this kind of setup is that it is a *lot* of work.
+While there is no official support from the operating system, a conscientious developer will make a way for the user to easily update his program. Ideally, your program should automatically check for updates, ask the user if he would like to download them, download them in the background, and then install the updates when your program starts up. Providing a way to roll back the updates in case of something going seriously wrong is also a very good idea. The only problem with this kind of setup is that it is a *lot* of work.
 
 Because of the popularity of BeOS download sites such as BeBits, it is relatively simple to post updates merely by releasing the new version on such sites. It places the check-download-install responsibility on the user, though. More motivated users will update their software; a great many users will not, so keep this in mind if this is the route you would choose to go.
 



From superstippi at gmx.de  Sat Jun  9 14:23:55 2007
From: superstippi at gmx.de (Stephan Assmus)
Date: Sat, 09 Jun 2007 14:23:55 +0200
Subject: [Haiku-commits] r21374 - haiku/trunk/build/jam
In-Reply-To: <200706091207.l59C7tVj027813@sheep.berlios.de>
References: <200706091207.l59C7tVj027813@sheep.berlios.de>
Message-ID: <20070609142355.563.1@stippis.WG>

Hi,

> Log:
> * cleanup in the Leaf menu: Applications is no longer a link to
>   /boot/beos/apps, but a folder containing links to _selected_
>   apps in that folder
> * a new entry "Desktop Applets" has been added, which contains
>   all the apps that you either do or do not start at system boot,
>   but don't need frequent access to
> * some apps have been hidden:
>   - ShowImage and Expander are usually not
>     directly started on their own, but through double clicking documents
>   - AboutSystem is invoked elsewhere from the Leaf menu, so it doesn't need
>     to clutter the Applications menu
> * we almost introduced a third category for rarely used apps, but in the
>   end it would only have contained Installer, Icon-O-Matic and Diskprobe,
>   and we felt that it is ok to leave these in the Applications menu, as long
>   as their number is small

forgot to mention... if you're installing Haiku onto a native partition, 
overwriting your previous install with the build script, you need to go to 
home/config/be and delete the links there. Otherwise the buildscript will 
appearently fail to create the new folders there.

Best regards,
-Stephan


From bonefish at cs.tu-berlin.de  Sat Jun  9 14:40:57 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sat, 09 Jun 2007 14:40:57 +0200
Subject: [Haiku-commits] r21373 - in haiku/trunk/src/apps: . launchbox
In-Reply-To: <200706091201.l59C1fwk027464@sheep.berlios.de>
References: <200706091201.l59C1fwk027464@sheep.berlios.de>
Message-ID: <20070609144057.5753.2@cs.tu-berlin.de>


On 2007-06-09 at 14:01:41 [+0200], stippi at BerliOS  
wrote:
> Author: stippi
> Date: 2007-06-09 14:01:39 +0200 (Sat, 09 Jun 2007)
> New Revision: 21373
> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21373&view=rev
> 
> Added:
>    haiku/trunk/src/apps/launchbox/
>    haiku/trunk/src/apps/launchbox/App.cpp
>    haiku/trunk/src/apps/launchbox/App.h
>    haiku/trunk/src/apps/launchbox/IconButton.cpp
>    haiku/trunk/src/apps/launchbox/IconButton.h
>    haiku/trunk/src/apps/launchbox/Jamfile
>    haiku/trunk/src/apps/launchbox/LaunchBox.rdef
>    haiku/trunk/src/apps/launchbox/LaunchButton.cpp
>    haiku/trunk/src/apps/launchbox/LaunchButton.h
>    haiku/trunk/src/apps/launchbox/MainWindow.cpp
>    haiku/trunk/src/apps/launchbox/MainWindow.h
>    haiku/trunk/src/apps/launchbox/NamePanel.cpp
>    haiku/trunk/src/apps/launchbox/NamePanel.h
>    haiku/trunk/src/apps/launchbox/PadView.cpp
>    haiku/trunk/src/apps/launchbox/PadView.h
>    haiku/trunk/src/apps/launchbox/Panel.cpp
>    haiku/trunk/src/apps/launchbox/Panel.h
>    haiku/trunk/src/apps/launchbox/main.cpp
>    haiku/trunk/src/apps/launchbox/run
>    haiku/trunk/src/apps/launchbox/support.cpp
>    haiku/trunk/src/apps/launchbox/support.h
> Modified:
>    haiku/trunk/src/apps/Jamfile
> Log:
> * added LaunchBox, an application launcher with drag&drop support
> * it has been rewritten from using liblayout to use the new Haiku
>   layout framework
> * TODO: it should come with default settings
> * TODO: the minimum window size is not yet set by the layout framework (?)

You have to set the B_AUTO_UPDATE_SIZE_LIMITS window flag. Then it should 
work (*crossing fingers* ;-)

CU, Ingo


From fekdahl at gmail.com  Sat Jun  9 17:00:03 2007
From: fekdahl at gmail.com (Fredrik Ekdahl)
Date: Sat, 9 Jun 2007 17:00:03 +0200
Subject: [Haiku-commits] r21374 - haiku/trunk/build/jam
In-Reply-To: <200706091207.l59C7tVj027813@sheep.berlios.de>
References: <200706091207.l59C7tVj027813@sheep.berlios.de>
Message-ID: <200706091700.03189.fekdahl@gmail.com>

On Saturday 09 June 2007 14.07.55 stippi at BerliOS wrote:
> Author: stippi
> Date: 2007-06-09 14:07:55 +0200 (Sat, 09 Jun 2007)
> New Revision: 21374
> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21374&view=rev
>
> Modified:
>    haiku/trunk/build/jam/HaikuImage
>

Some gcc 4 comments coming..

> -BEOS_APPS = Terminal Expander People ShowImage ProcessController
> -	SoundRecorder Magnify DiskProbe AboutSystem StyledEdit Installer
> Workspaces -	$(X86_ONLY)Cortex MediaPlayer DeskCalc MidiPlayer
> -	Icon-O-Matic Mail CDPlayer NetworkStatus TV
> +
> +BEOS_APPS = AboutSystem DeskCalc DiskProbe CDPlayer Expander Icon-O-Matic
> +	Installer LaunchBox Magnify Mail MediaPlayer MidiPlayer NetworkStatus
> +	People PowerStatus ProcessController ShowImage SoundRecorder StyledEdit
> +	Terminal TV Workspaces
>  ;

Launchbox is not compiling with gcc 4 yet. I'll probably take a look soon and 
see if I can figure it out.

>  BEOS_ADD_ONS_TRANSLATORS = BMPTranslator GIFTranslator JPEGTranslator
>  	JPEG2000Translator TIFFTranslator PNGTranslator PPMTranslator
>  	RTF-Translator SGITranslator STXTTranslator TGATranslator
> +	WonderBrushTranslator
>  ;

I've attached a patch that makes the wonderbrush translator compile here.

/Fredrik Ekdahl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wonderbrush.diff
Type: text/x-diff
Size: 1097 bytes
Desc: not available
URL: 

From kirilla at mail.berlios.de  Sat Jun  9 18:23:23 2007
From: kirilla at mail.berlios.de (kirilla at BerliOS)
Date: Sat, 9 Jun 2007 18:23:23 +0200
Subject: [Haiku-commits] r21376 - haiku/trunk/src/apps/processcontroller
Message-ID: <200706091623.l59GNNqj011836@sheep.berlios.de>

Author: kirilla
Date: 2007-06-09 18:23:22 +0200 (Sat, 09 Jun 2007)
New Revision: 21376
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21376&view=rev

Modified:
   haiku/trunk/src/apps/processcontroller/PCWindow.cpp
Log:
Keeping track of versions of preferences is overkill for simple applications IMO, but the logic in PCApplication::ReadyToRun() needs this, or else the BAlert pops up on every launch. I think this could be rewritten/simplified.

Modified: haiku/trunk/src/apps/processcontroller/PCWindow.cpp
===================================================================
--- haiku/trunk/src/apps/processcontroller/PCWindow.cpp	2007-06-09 12:19:05 UTC (rev 21375)
+++ haiku/trunk/src/apps/processcontroller/PCWindow.cpp	2007-06-09 16:23:22 UTC (rev 21376)
@@ -71,6 +71,7 @@
 PCWindow::QuitRequested()
 {
 	GebsPreferences tPreferences(kPreferencesFileName);
+	tPreferences.SaveInt32(kCurrentVersion, kVersionName);
 	tPreferences.SaveWindowPosition(this, kPosPrefName);
 
 	be_app->PostMessage(B_QUIT_REQUESTED);



From mphipps1 at rochester.rr.com  Sat Jun  9 18:38:28 2007
From: mphipps1 at rochester.rr.com (Michael Phipps)
Date: Sat, 09 Jun 2007 12:38:28 -0400
Subject: [Haiku-commits] Moving replys to the development list?
In-Reply-To: <200706091219.l59CJ5fQ028839@sheep.berlios.de>
References: <200706091219.l59CJ5fQ028839@sheep.berlios.de>
Message-ID: <466AD784.1020001@rochester.rr.com>

Now that we have a development list, I think that we should move replies to 
this list to it.

1) This list would become ONLY svn checkouts. This allows automated tools 
to work better/easier.
2) Theoretically, people might want to subscribe to this list that don't 
understand the details, they just want to watch Haiku's progress. The rest 
of the stuff is incomprehensible to them.
3) On the other side, some people (maybe on dialup or just people who hate 
floods of email) might well not want to be on this list but might be on the 
developer list.

Thoughts?



From kirilla at mail.berlios.de  Sat Jun  9 18:39:56 2007
From: kirilla at mail.berlios.de (kirilla at BerliOS)
Date: Sat, 9 Jun 2007 18:39:56 +0200
Subject: [Haiku-commits] r21377 - haiku/trunk/src/apps/processcontroller
Message-ID: <200706091639.l59GduJ8030616@sheep.berlios.de>

Author: kirilla
Date: 2007-06-09 18:39:47 +0200 (Sat, 09 Jun 2007)
New Revision: 21377
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21377&view=rev

Modified:
   haiku/trunk/src/apps/processcontroller/ProcessController.cpp
Log:
Fix two consequtive BSeparatorItems when Deskbar isn't running. This was due to the removal of "Use Pulse's Settings for Colors".

Modified: haiku/trunk/src/apps/processcontroller/ProcessController.cpp
===================================================================
--- haiku/trunk/src/apps/processcontroller/ProcessController.cpp	2007-06-09 16:23:22 UTC (rev 21376)
+++ haiku/trunk/src/apps/processcontroller/ProcessController.cpp	2007-06-09 16:39:47 UTC (rev 21377)
@@ -762,6 +762,7 @@
 		item->SetMarked(gInDeskbar || deskbar.HasItem(kDeskbarItemName));
 		item->SetTarget(gPCView);
 		addtopbottom(item);
+		addtopbottom(new BSeparatorItem ());
 	}
 
 #if 0
@@ -771,8 +772,6 @@
 	addtopbottom (item);
 #endif
 
-	addtopbottom(new BSeparatorItem ());
-
 	item = new IconMenuItem(gPCView->fProcessControllerIcon, "About ProcessController" B_UTF8_ELLIPSIS,
 		new BMessage(B_ABOUT_REQUESTED));
 	item->SetTarget(gPCView);



From axeld at pinc-software.de  Sat Jun  9 18:47:49 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Sat, 09 Jun 2007 18:47:49 +0200 CEST
Subject: [Haiku-commits] Moving replys to the development list?
In-Reply-To: <466AD784.1020001@rochester.rr.com>
Message-ID: <24916644361-BeMail@zon>

Michael Phipps  wrote:
> Now that we have a development list, I think that we should move 
> replies to 
> this list to it.
> 
> 1) This list would become ONLY svn checkouts. This allows automated 
> tools 
> to work better/easier.
> 2) Theoretically, people might want to subscribe to this list that 
> don't 
> understand the details, they just want to watch Haiku's progress. The 
> rest 
> of the stuff is incomprehensible to them.
> 3) On the other side, some people (maybe on dialup or just people who 
> hate 
> floods of email) might well not want to be on this list but might be 
> on the 
> developer list.
> 
> Thoughts?

-1

1) is pretty much useless; we don't need any automated tools going over 
the mailing list - it's all in there in SVN
2) so what? If the reply is incomprehensible, so is the SVN message
3) and?

It's more convenient to have the reply (that might hide details) and 
the mail the reply is about in one list - that's pretty much what 
mailing lists are for.
 
Bye,
   Axel.



From axeld at pinc-software.de  Sat Jun  9 19:08:27 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Sat, 09 Jun 2007 19:08:27 +0200 CEST
Subject: [Haiku-commits] r21376 - haiku/trunk/src/apps/processcontroller
In-Reply-To: <200706091623.l59GNNqj011836@sheep.berlios.de>
Message-ID: <26154854130-BeMail@zon>

kirilla at BerliOS  wrote:
> Log:
> Keeping track of versions of preferences is overkill for simple 
> applications IMO,
> but the logic in PCApplication::ReadyToRun() needs this, or else the 
> BAlert pops
> up on every launch. I think this could be rewritten/simplified.

Ah, thanks. I already noticed that bug, but was too lazy to look into 
it.
And agreed, I think we may want to simply put the prefs into a BMessage 
(if not already done); this format is flexible enough to survive most 
changes, anyway.

Bye,
   Axel.



From axeld at pinc-software.de  Sat Jun  9 19:12:48 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Sat, 09 Jun 2007 19:12:48 +0200 CEST
Subject: [Haiku-commits]
 =?iso-8859-15?q?r21364_-_in_haiku/trunk=3A_header?=
 =?iso-8859-15?q?s/os/interface_src/kits/interface?=
In-Reply-To: <200706091051.l59ApHAU009444@sheep.berlios.de>
Message-ID: <26415253096-BeMail@zon>

bonefish at BerliOS  wrote:
> * Added default value for message in two arguments constructor.

Does it make much sense to have a button without a message if not for 
testing?

Bye,
   Axel.



From axeld at pinc-software.de  Sat Jun  9 19:14:36 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Sat, 09 Jun 2007 19:14:36 +0200 CEST
Subject: [Haiku-commits]
 =?iso-8859-15?q?r21358_-_haiku/trunk/src/tests/ki?=
 =?iso-8859-15?q?ts/interface/layout/widget=5Flayout=5Ftest?=
In-Reply-To: <200706082343.l58NhgAG016094@sheep.berlios.de>
Message-ID: <26523555241-BeMail@zon>

bonefish at BerliOS  wrote:
> -	SetViewColor((rgb_color){0, 120, 0, 255});
> +	SetViewColor((rgb_color){255, 0, 0, 255});

But you know that there is a SetViewColor(r, g, b, a = 255) signature? 
:-)

Bye,
   Axel.



From axeld at pinc-software.de  Sat Jun  9 19:19:03 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Sat, 09 Jun 2007 19:19:03 +0200 CEST
Subject: [Haiku-commits]
 =?iso-8859-15?q?r21355_-_in_haiku/trunk=3A_header?=
 =?iso-8859-15?q?s/os/interface_src/kits/interface?=
In-Reply-To: <200706082324.l58NOnoP006095@sheep.berlios.de>
Message-ID: <26790608914-BeMail@zon>

bonefish at BerliOS  wrote:
> * Avoided ugly multi-line strings in PrintToStream().

Do we need this method anyway? It's not part of libbe.so on BeOS, at 
least, and I see little use in it (you'll never use it, because you're 
never interested in that much information).

Bye,
   Axel.



From leavengood at gmail.com  Sat Jun  9 19:33:24 2007
From: leavengood at gmail.com (Ryan Leavengood)
Date: Sat, 9 Jun 2007 13:33:24 -0400
Subject: [Haiku-commits] r21356 - in haiku/trunk: headers/os/interface
	src/kits/interface
In-Reply-To: <200706082340.l58NeI53015815@sheep.berlios.de>
References: <200706082340.l58NeI53015815@sheep.berlios.de>
Message-ID: 

On 6/8/07, bonefish at BerliOS  wrote:
>
> Modified:
>    haiku/trunk/headers/os/interface/Box.h
>    haiku/trunk/src/kits/interface/Box.cpp
> Log:
> * Added layout-friendly constructors and implemented Min/Max/PreferredSize(),
>   and DoLayout(). When the B_SUPPORTS_LAYOUT view flag is set (as is by
>   default when using one of the new constructors) the BBox completely manages
>   one true child (the first child that is not the label view).

Thanks for this, it should make my work on fixing the Screensaver
preferences much easier. I had started this a while ago, but just
didn't have enough understanding of the layout system to implement it
properly. Hopefully as I do more work with the layout system I'll
start to understand it better.

I'm going to work on my article and the "Playout" application this weekend.

Ryan


From bonefish at cs.tu-berlin.de  Sat Jun  9 20:52:01 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sat, 09 Jun 2007 20:52:01 +0200
Subject: [Haiku-commits] r21358 -
 haiku/trunk/src/tests/kits/interface/layout/widget_layout_test
In-Reply-To: <26523555241-BeMail@zon>
References: <26523555241-BeMail@zon>
Message-ID: <20070609205201.449.1@cs.tu-berlin.de>


On 2007-06-09 at 19:14:36 [+0200], Axel D?rfler  
wrote:
> bonefish at BerliOS  wrote:
> > -    SetViewColor((rgb_color){0, 120, 0, 255});
> > +    SetViewColor((rgb_color){255, 0, 0, 255});
> 
> But you know that there is a SetViewColor(r, g, b, a = 255) signature?
> :-)

I actually tend to forget that there's such a method version in BView. But 
in this case the object isn't BView derived. I rolled my very own view 
hierarchy (base class View), so that I only have a minimal number of actual 
BViews involved (the window's root view, a container view, and an instance 
of the tested class). In case anyone ran the test and wondered: that's why 
the controls look all non-standard and ugly. :-)

CU, Ingo


From bonefish at cs.tu-berlin.de  Sat Jun  9 21:04:25 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sat, 09 Jun 2007 21:04:25 +0200
Subject: [Haiku-commits] r21364 - in haiku/trunk: headers/os/interface
 src/kits/interface
In-Reply-To: <26415253096-BeMail@zon>
References: <26415253096-BeMail@zon>
Message-ID: <20070609210425.545.2@cs.tu-berlin.de>


On 2007-06-09 at 19:12:48 [+0200], Axel D?rfler  
wrote:
> bonefish at BerliOS  wrote:
> > * Added default value for message in two arguments constructor.
> 
> Does it make much sense to have a button without a message if not for
> testing?

If you implement a derived class and want to do things synchronously, you 
wouldn't need a message at all. But even if you use it synchronously, you 
might not want to set the message right at construction time. At any rate I 
see no harm in providing a default argument. This way even the header 
documents that you don't have to provide a message.

BTW, other sane GUI APIs, like Java and Qt, allow creating a button with 
just a label (JButton, QPushButton), actually even without any parameters.

CU, Ingo


From bonefish at cs.tu-berlin.de  Sat Jun  9 21:13:24 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sat, 09 Jun 2007 21:13:24 +0200
Subject: [Haiku-commits] r21355 - in haiku/trunk: headers/os/interface
 src/kits/interface
In-Reply-To: <26790608914-BeMail@zon>
References: <26790608914-BeMail@zon>
Message-ID: <20070609211324.1569.3@cs.tu-berlin.de>


On 2007-06-09 at 19:19:03 [+0200], Axel D?rfler  
wrote:
> bonefish at BerliOS  wrote:
> > * Avoided ugly multi-line strings in PrintToStream().
> 
> Do we need this method anyway? It's not part of libbe.so on BeOS, at
> least, and I see little use in it (you'll never use it, because you're
> never interested in that much information).

I've never used the method, but admittedly I haven't worked much on the 
interface kit besides the adding the layout stuff. Apparently someone found 
it useful, though. Maybe it even was while getting the basics working and 
stopped being useful at some point. If no one speaks up, we can safely 
remove it, I guess.

BTW, I'm generally not very fond of the PrintToStream() methods. I'd rather 
like to see a Java style "BString ToString()" or "void ToString(BString&)" 
method, or even a (non-member) "<<" BString operator.

CU, Ingo


From superstippi at gmx.de  Sat Jun  9 21:18:42 2007
From: superstippi at gmx.de (Stephan Assmus)
Date: Sat, 09 Jun 2007 21:18:42 +0200
Subject: [Haiku-commits] Moving replys to the development list?
In-Reply-To: <466AD784.1020001@rochester.rr.com>
References: <200706091219.l59CJ5fQ028839@sheep.berlios.de>
	<466AD784.1020001@rochester.rr.com>
Message-ID: <20070609211842.922.1@stippis.WG>


Michael Phipps wrote (2007-06-09, 18:38:28 [+0200]):
> Now that we have a development list, I think that we should move replies to
> this list to it.
> 
> 1) This list would become ONLY svn checkouts. This allows automated tools
> to work better/easier.
> 2) Theoretically, people might want to subscribe to this list that don't
> understand the details, they just want to watch Haiku's progress. The rest
> of the stuff is incomprehensible to them.
> 3) On the other side, some people (maybe on dialup or just people who hate
> floods of email) might well not want to be on this list but might be on the
> developer list.
> 
> Thoughts?

Have you had people actually complain? All your points look theoretical. If 
discussions become long and divert from the original issue, they should be 
moved, but I like it very much that discussion can take place here as well.

Best regards,
-Stephan


From bonefish at cs.tu-berlin.de  Sat Jun  9 21:22:57 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sat, 09 Jun 2007 21:22:57 +0200
Subject: [Haiku-commits] Moving replys to the development list?
In-Reply-To: <24916644361-BeMail@zon>
References: <24916644361-BeMail@zon>
Message-ID: <20070609212257.1609.4@cs.tu-berlin.de>


On 2007-06-09 at 18:47:49 [+0200], Axel D?rfler  
wrote:
> Michael Phipps  wrote:
> > Now that we have a development list, I think that we should move
> > replies to
> > this list to it.
> > 
> > 1) This list would become ONLY svn checkouts. This allows automated
> > tools
> > to work better/easier.
> > 2) Theoretically, people might want to subscribe to this list that
> > don't
> > understand the details, they just want to watch Haiku's progress. The
> > rest
> > of the stuff is incomprehensible to them.
> > 3) On the other side, some people (maybe on dialup or just people who
> > hate
> > floods of email) might well not want to be on this list but might be
> > on the
> > developer list.
> > 
> > Thoughts?
> 
> -1
> 
> 1) is pretty much useless; we don't need any automated tools going over
> the mailing list - it's all in there in SVN
> 2) so what? If the reply is incomprehensible, so is the SVN message
> 3) and?
> 
> It's more convenient to have the reply (that might hide details) and
> the mail the reply is about in one list - that's pretty much what
> mailing lists are for.

I agree partially with either of you. If it's only a comment or question to 
a commit, it's way more convenient to just reply to the list and shouldn't 
really bother people. If one is really not interested in replies, filtering 
out the "Re:..." mails is a trifle with any decent mail reader.

On the other hand, longish discussions should be moved to another list, 
IMHO. With one or two exceptions that has been the common practice anyway.

CU, Ingo


From axeld at pinc-software.de  Sat Jun  9 21:30:28 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Sat, 09 Jun 2007 21:30:28 +0200 CEST
Subject: [Haiku-commits] r21355 - in haiku/trunk: headers/os/interface
 src/kits/interface
In-Reply-To: <20070609211324.1569.3@cs.tu-berlin.de>
Message-ID: <34675574591-BeMail@zon>

Ingo Weinhold  wrote:
> On 2007-06-09 at 19:19:03 [+0200], Axel D?rfler  
> > wrote:
> > bonefish at BerliOS  wrote:
> > > * Avoided ugly multi-line strings in PrintToStream().
> > Do we need this method anyway? It's not part of libbe.so on BeOS, 
> > at
> > least, and I see little use in it (you'll never use it, because 
> > you're
> > never interested in that much information).
> I've never used the method, but admittedly I haven't worked much on 
> the 
> interface kit besides the adding the layout stuff. Apparently someone 
> found 
> it useful, though. Maybe it even was while getting the basics working 
> and 
> stopped being useful at some point. If no one speaks up, we can 
> safely 
> remove it, I guess.

IIRC Adi added it when the BView implementation started; even though I 
did much work on that class as well (later, though), I never used it 
myself (that's also why I didn't bother to reformat it :-))

> BTW, I'm generally not very fond of the PrintToStream() methods. I'd 
> rather 
> like to see a Java style "BString ToString()" or "void 
> ToString(BString&)" 
> method, or even a (non-member) "<<" BString operator.

Definitely agreed; even a PrintToStream(int fd) would be much better, 
but I like your suggestions better. The << has the disadvantage of not 
being able to access any private data - if that really is a 
disadvantage in this use case (probably not with any sane class).

Bye,
   Axel.



From axeld at pinc-software.de  Sat Jun  9 21:31:58 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Sat, 09 Jun 2007 21:31:58 +0200 CEST
Subject: [Haiku-commits] r21364 - in haiku/trunk: headers/os/interface
 src/kits/interface
In-Reply-To: <20070609210425.545.2@cs.tu-berlin.de>
Message-ID: <34765651057-BeMail@zon>

Ingo Weinhold  wrote:
> On 2007-06-09 at 19:12:48 [+0200], Axel D?rfler  
> > wrote:
> > bonefish at BerliOS  wrote:
> > > * Added default value for message in two arguments constructor.
> > Does it make much sense to have a button without a message if not 
> > for
> > testing?
> If you implement a derived class and want to do things synchronously, 
> you 
> wouldn't need a message at all. But even if you use it synchronously, 
> you 
> might not want to set the message right at construction time. At any 
> rate I 
> see no harm in providing a default argument. This way even the header 
> documents that you don't have to provide a message.

Okay, I was just interested in your reasoning behind this change :-)

> BTW, other sane GUI APIs, like Java and Qt, allow creating a button 
> with 
> just a label (JButton, QPushButton), actually even without any 
> parameters.

I believe you've just added that very constructor to BButton, too, 
didn't you?

Bye,
   Axel.



From bonefish at cs.tu-berlin.de  Sat Jun  9 22:01:38 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sat, 09 Jun 2007 22:01:38 +0200
Subject: [Haiku-commits] r21355 - in haiku/trunk: headers/os/interface
 src/kits/interface
In-Reply-To: <34675574591-BeMail@zon>
References: <34675574591-BeMail@zon>
Message-ID: <20070609220138.2946.6@cs.tu-berlin.de>


On 2007-06-09 at 21:30:28 [+0200], Axel D?rfler  
wrote:
> Ingo Weinhold  wrote:
[...]
> > BTW, I'm generally not very fond of the PrintToStream() methods. I'd
> > rather
> > like to see a Java style "BString ToString()" or "void
> > ToString(BString&)"
> > method, or even a (non-member) "<<" BString operator.
> 
> Definitely agreed; even a PrintToStream(int fd) would be much better,
> but I like your suggestions better. The << has the disadvantage of not
> being able to access any private data - if that really is a
> disadvantage in this use case (probably not with any sane class).

A member function the additional advantage, that we could make it virtual. 
This way you can get a human-readable info for an object, of which you 
don't even know the exact type.

CU, Ingo


From bonefish at cs.tu-berlin.de  Sat Jun  9 22:03:40 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sat, 09 Jun 2007 22:03:40 +0200
Subject: [Haiku-commits] r21364 - in haiku/trunk: headers/os/interface
 src/kits/interface
In-Reply-To: <34765651057-BeMail@zon>
References: <34765651057-BeMail@zon>
Message-ID: <20070609220340.2978.7@cs.tu-berlin.de>


On 2007-06-09 at 21:31:58 [+0200], Axel D?rfler  
wrote:
> Ingo Weinhold  wrote:
[...]
> > BTW, other sane GUI APIs, like Java and Qt, allow creating a button
> > with
> > just a label (JButton, QPushButton), actually even without any
> > parameters.
> 
> I believe you've just added that very constructor to BButton, too,
> didn't you?

The default constructor? Nope. At least it's not there. If I added it and 
forgot about the fact, someone must have removed it behind my back. :-P

CU, Ingo


From kirilla at mail.berlios.de  Sun Jun 10 01:08:38 2007
From: kirilla at mail.berlios.de (kirilla at BerliOS)
Date: Sun, 10 Jun 2007 01:08:38 +0200
Subject: [Haiku-commits] r21378 - haiku/trunk/src/preferences/filetypes
Message-ID: <200706092308.l59N8cjY018585@sheep.berlios.de>

Author: kirilla
Date: 2007-06-10 01:08:30 +0200 (Sun, 10 Jun 2007)
New Revision: 21378
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21378&view=rev

Modified:
   haiku/trunk/src/preferences/filetypes/ApplicationTypesWindow.cpp
   haiku/trunk/src/preferences/filetypes/ApplicationTypesWindow.h
Log:
Listview deselection fix. Edit button added. Open in Tracker renamed Show in Tracker.

Modified: haiku/trunk/src/preferences/filetypes/ApplicationTypesWindow.cpp
===================================================================
--- haiku/trunk/src/preferences/filetypes/ApplicationTypesWindow.cpp	2007-06-09 16:39:47 UTC (rev 21377)
+++ haiku/trunk/src/preferences/filetypes/ApplicationTypesWindow.cpp	2007-06-09 23:08:30 UTC (rev 21378)
@@ -51,6 +51,7 @@
 const uint32 kMsgTypeSelected = 'typs';
 const uint32 kMsgTypeInvoked = 'typi';
 const uint32 kMsgRemoveUninstalled = 'runs';
+const uint32 kMsgEdit = 'edit';
 
 
 const char*
@@ -267,7 +268,7 @@
 	rect = box->Frame();
 	rect.top = rect.bottom + 8.0f;
 	rect.bottom = rect.top + 20.0f;
-	fTrackerButton = new BButton(rect, "tracker", "Open In Tracker" B_UTF8_ELLIPSIS, NULL,
+	fTrackerButton = new BButton(rect, "tracker", "Show In Tracker" B_UTF8_ELLIPSIS, NULL,
 		B_FOLLOW_RIGHT);
 	fTrackerButton->ResizeToPreferred();
 	fTrackerButton->MoveTo(rect.right - fTrackerButton->Bounds().Width(), rect.top);
@@ -279,9 +280,16 @@
 	fLaunchButton->MoveTo(fTrackerButton->Frame().left - 6.0f
 		- fLaunchButton->Bounds().Width(), rect.top);
 	topView->AddChild(fLaunchButton);
+	
+	fEditButton = new BButton(rect, "edit", "Edit" B_UTF8_ELLIPSIS, new BMessage(kMsgEdit),
+		B_FOLLOW_RIGHT);
+	fEditButton->ResizeToPreferred();
+	fEditButton->MoveTo(fLaunchButton->Frame().left - 6.0f
+		- fEditButton->Bounds().Width(), rect.top);
+	topView->AddChild(fEditButton);
 
 	SetSizeLimits(scrollView->Frame().right + 22.0f + fTrackerButton->Frame().Width()
-		+ fLaunchButton->Frame().Width(), 32767.0f,
+		+ fLaunchButton->Frame().Width() + 6 + fEditButton->Frame().Width(), 32767.0f,
 		fTrackerButton->Frame().bottom + 8.0f, 32767.0f);
 
 	BMimeType::StartWatching(this);
@@ -417,7 +425,7 @@
 			path.GetParent(&path);
 			fPathView->SetText(path.Path());
 
-			// Set "Open In Tracker" message
+			// Set "Show In Tracker" message
 			BEntry entry(path.Path());
 			entry_ref directoryRef;
 			if (entry.GetRef(&directoryRef) == B_OK) {
@@ -456,7 +464,7 @@
 		}
 	} else {
 		fNameView->SetText(NULL);
-		fNameView->SetText(NULL);
+		fSignatureView->SetText(NULL);
 		fPathView->SetText(NULL);
 
 		fVersionView->SetText(NULL);
@@ -472,6 +480,7 @@
 
 	fTrackerButton->SetEnabled(enabled && appFound);
 	fLaunchButton->SetEnabled(enabled && appFound);
+	fEditButton->SetEnabled(enabled && appFound);
 }
 
 
@@ -519,7 +528,13 @@
 			}
 			break;
 		}
-
+		
+		case kMsgEdit:
+		{
+			fTypeListView->Invoke();
+			break;
+		}
+		
 		case kMsgRemoveUninstalled:
 			_RemoveUninstalled();
 			break;

Modified: haiku/trunk/src/preferences/filetypes/ApplicationTypesWindow.h
===================================================================
--- haiku/trunk/src/preferences/filetypes/ApplicationTypesWindow.h	2007-06-09 16:39:47 UTC (rev 21377)
+++ haiku/trunk/src/preferences/filetypes/ApplicationTypesWindow.h	2007-06-09 23:08:30 UTC (rev 21378)
@@ -53,6 +53,7 @@
 
 		BButton*		fTrackerButton;
 		BButton*		fLaunchButton;
+		BButton*		fEditButton;
 };
 
 #endif	// APPLICATION_TYPES_WINDOW_H



From revol at free.fr  Sun Jun 10 11:22:18 2007
From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol)
Date: Sun, 10 Jun 2007 11:22:18 +0200 CEST
Subject: [Haiku-commits] r21355 - in haiku/trunk: headers/os/interface
 src/kits/interface
In-Reply-To: <20070609211324.1569.3@cs.tu-berlin.de>
Message-ID: <1848846019-BeMail@laptop>

> 
> On 2007-06-09 at 19:19:03 [+0200], Axel D?rfler  
> > wrote:
> > bonefish at BerliOS  wrote:
> > > * Avoided ugly multi-line strings in PrintToStream().
> > 
> > Do we need this method anyway? It's not part of libbe.so on BeOS, 
> > at
> > least, and I see little use in it (you'll never use it, because 
> > you're
> > never interested in that much information).
> 
> I've never used the method, but admittedly I haven't worked much on 
> the 
> interface kit besides the adding the layout stuff. Apparently someone 
> found 
> it useful, though. Maybe it even was while getting the basics working 
> and 
> stopped being useful at some point. If no one speaks up, we can 
> safely 
> remove it, I guess.
> 
> BTW, I'm generally not very fond of the PrintToStream() methods. I'd 
> rather 
> like to see a Java style "BString ToString()" or "void 
> ToString(BString&)" 
> method, or even a (non-member) "<<" BString operator.
> 

The (Danoish I think) way of doing PrintToStream(BDataIO &to=gOut) 
seems more useful to me, it can be used to redirect debug output to a 
file, or a BStringIO, ... a ToString() would do either I guess.

Fran?ois.



From revol at free.fr  Sun Jun 10 11:27:07 2007
From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol)
Date: Sun, 10 Jun 2007 11:27:07 +0200 CEST
Subject: [Haiku-commits] r21355 - in haiku/trunk: headers/os/interface
 src/kits/interface
In-Reply-To: <20070609220138.2946.6@cs.tu-berlin.de>
Message-ID: <2137743594-BeMail@laptop>

> 
> On 2007-06-09 at 21:30:28 [+0200], Axel D?rfler  
> > wrote:
> > Ingo Weinhold  wrote:
> [...]
> > > BTW, I'm generally not very fond of the PrintToStream() methods. 
> > > I'd
> > > rather
> > > like to see a Java style "BString ToString()" or "void
> > > ToString(BString&)"
> > > method, or even a (non-member) "<<" BString operator.
> > 
> > Definitely agreed; even a PrintToStream(int fd) would be much 
> > better,
> > but I like your suggestions better. The << has the disadvantage of 
> > not
> > being able to access any private data - if that really is a
> > disadvantage in this use case (probably not with any sane class).
> 
> A member function the additional advantage, that we could make it 
> virtual. 
> This way you can get a human-readable info for an object, of which 
> you 
> don't even know the exact type.

Also when done consistently it can be reused to rehydrate an object.
For ex I wrote a BMessage dumper that outputs similar text than Dano's 
PrintToStream() ( something like "BMessage { fieldname type value \n 
fieldname 'GSM_' BMessage {...} }" ) and Parse that back. I used it in 
Zeta's theme engine. Makes nice human-editable files.

Fran?ois.


From kirilla at mail.berlios.de  Sun Jun 10 16:15:09 2007
From: kirilla at mail.berlios.de (kirilla at BerliOS)
Date: Sun, 10 Jun 2007 16:15:09 +0200
Subject: [Haiku-commits] r21379 - haiku/trunk/src/apps/processcontroller
Message-ID: <200706101415.l5AEF9dA004131@sheep.berlios.de>

Author: kirilla
Date: 2007-06-10 16:15:09 +0200 (Sun, 10 Jun 2007)
New Revision: 21379
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21379&view=rev

Modified:
   haiku/trunk/src/apps/processcontroller/ProcessController.cpp
   haiku/trunk/src/apps/processcontroller/ProcessController.h
Log:
Removed code for using Pulse's colors. Minor changes to About window. Renamed menuitems Launch Tracker/Deskbar to Restart Tracker/Deskbar.

Modified: haiku/trunk/src/apps/processcontroller/ProcessController.cpp
===================================================================
--- haiku/trunk/src/apps/processcontroller/ProcessController.cpp	2007-06-09 23:08:30 UTC (rev 21378)
+++ haiku/trunk/src/apps/processcontroller/ProcessController.cpp	2007-06-10 14:15:09 UTC (rev 21379)
@@ -55,13 +55,10 @@
 const char* kDeskbarItemName = "ProcessController";
 const char* kClassName = "ProcessController";
 
-const char* kMimicPulsePref = "mimic_pulse";
 const char* kFrameColorPref = "deskbar_frame_color";
 const char* kIdleColorPref = "deskbar_idle_color";
 const char* kActiveColorPref = "deskbar_active_color";
 
-const char* kPuseSettings = "Pulse_settings";
-
 const rgb_color kKernelBlue = {20, 20, 231,	255};
 const rgb_color kIdleGreen = {110, 190,110,	255};
 
@@ -80,7 +77,6 @@
 rgb_color gWhiteSelected;
 ThreadBarMenu* gCurrentThreadBarMenu;
 bool gInDeskbar = false;
-int32 gMimicPulse = 0;
 
 #define addtopbottom(x) if (top) popup->AddItem(x); else popup->AddItem(x, 0)
 
@@ -358,15 +354,6 @@
 			break;
 		}
 
-		case 'Colo':
-		{
-			GebsPreferences tPreferences(kPreferencesFileName);
-			gMimicPulse = (gMimicPulse == 0);
-			tPreferences.SaveInt32(gMimicPulse, kMimicPulsePref);
-			DefaultColors();
-			break;
-		}
-
 		case B_ABOUT_REQUESTED:
 			AboutRequested();
 			break;
@@ -380,18 +367,18 @@
 void
 ProcessController::AboutRequested()
 {
-	BAlert *alert = new BAlert("about", "ProcessController\n"
-		"\tCopyright 1997-2001,\n"
-		"\t\tGeorges-Edouard Berenger.\n\n"
-		"\tCopyright 2006, Haiku, Inc.\n\n", "Ok");
+	BAlert *alert = new BAlert("about", "ProcessController\n\n"
+		"Copyright 1997-2001,\n"
+		"Georges-Edouard Berenger.\n\n"
+		"Copyright " B_UTF8_COPYRIGHT " 2007 Haiku, Inc.\n", "Close");
 	BTextView *view = alert->TextView();
 	BFont font;
 
 	view->SetStylable(true);
 
 	view->GetFont(&font);
-	font.SetSize(18);
-	font.SetFace(B_BOLD_FACE); 			
+	font.SetSize(font.Size() * 1.5);
+	font.SetFace(B_BOLD_FACE);
 	view->SetFontAndColor(0, 17, &font);
 
 	alert->Go();
@@ -407,50 +394,6 @@
 	swap_color.alpha = 255;
 	bool set = false;
 
-	if (gMimicPulse) {
-		// TODO: remove this?
-		BPath prefpath;
-		if (find_directory(B_USER_SETTINGS_DIRECTORY, &prefpath) == B_OK) {
-			BDirectory prefdir(prefpath.Path ());
-			BEntry entry;
-			prefdir.FindEntry (kPuseSettings, &entry);
-			BFile file(&entry, B_READ_ONLY);
-			if (file.InitCheck() == B_OK) {
-				int32	f, i, a;
-				if (file.ReadAttr(kFrameColorPref, B_INT32_TYPE, 0, &f, 4) == 4
-					&& file.ReadAttr(kActiveColorPref, B_INT32_TYPE, 0, &a, 4) == 4
-					&& file.ReadAttr(kIdleColorPref, B_INT32_TYPE, 0, &i, 4) == 4) {
-					active_color.red = (a & 0xff000000) >> 24;
-					active_color.green = (a & 0x00ff0000) >> 16;
-					active_color.blue = (a & 0x0000ff00) >> 8;
-					active_color.alpha = 255;
-
-					idle_color.red = (i & 0xff000000) >> 24;
-					idle_color.green = (i & 0x00ff0000) >> 16;
-					idle_color.blue = (i & 0x0000ff00) >> 8;
-					idle_color.alpha = 255;
-
-					frame_color.red = (f & 0xff000000) >> 24;
-					frame_color.green = (f & 0x00ff0000) >> 16;
-					frame_color.blue = (f & 0x0000ff00) >> 8;
-					frame_color.alpha = 255;
-
-					mix_colors (memory_color, active_color, swap_color, 0.8);
-
-					set = true;
-				} else {
-					BAlert * alert = new BAlert("", "I couldn't read Pulse's preferences...",
-						"Sorry!", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
-					alert->Go ();
-				}
-			} else {
-				BAlert * alert = new BAlert("", "I couldn't find Pulse's preferences...",
-					"Sorry!", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
-				alert->Go ();
-			}
-		}
-	}
-
 	if (!set) {
 		active_color = kKernelBlue;
 		active_color = tint_color (active_color, B_LIGHTEN_2_TINT);
@@ -474,7 +417,6 @@
 		SetViewColor(kBlack);
 
 	GebsPreferences tPreferences(kPreferencesFileName, NULL, false);
-	tPreferences.ReadInt32(gMimicPulse, kMimicPulsePref);
 	DefaultColors();
 
 	system_info info;
@@ -740,12 +682,12 @@
 	}
 
 	if (!be_roster->IsRunning(kTrackerSig)) {
-		item = new IconMenuItem(gPCView->fTrackerIcon, "Launch Tracker", new BMessage('Trac'));
+		item = new IconMenuItem(gPCView->fTrackerIcon, "Restart Tracker", new BMessage('Trac'));
 		item->SetTarget(gPCView);
 		addtopbottom(item);
 	}
 	if (!be_roster->IsRunning(kDeskbarSig)) {
-		item = new IconMenuItem(gPCView->fDeskbarIcon, "Launch Deskbar", new BMessage('Dbar'));
+		item = new IconMenuItem(gPCView->fDeskbarIcon, "Restart Deskbar", new BMessage('Dbar'));
 		item->SetTarget(gPCView);
 		addtopbottom(item);
 	}
@@ -765,13 +707,6 @@
 		addtopbottom(new BSeparatorItem ());
 	}
 
-#if 0
-	item = new BMenuItem("Use Pulse's Settings for Colors", new BMessage ('Colo'));
-	item->SetTarget (gPCView);
-	item->SetMarked (gMimicPulse);
-	addtopbottom (item);
-#endif
-
 	item = new IconMenuItem(gPCView->fProcessControllerIcon, "About ProcessController" B_UTF8_ELLIPSIS,
 		new BMessage(B_ABOUT_REQUESTED));
 	item->SetTarget(gPCView);

Modified: haiku/trunk/src/apps/processcontroller/ProcessController.h
===================================================================
--- haiku/trunk/src/apps/processcontroller/ProcessController.h	2007-06-09 23:08:30 UTC (rev 21378)
+++ haiku/trunk/src/apps/processcontroller/ProcessController.h	2007-06-10 14:15:09 UTC (rev 21379)
@@ -86,7 +86,6 @@
 extern	thread_id			gPopupThreadID;
 extern	const char*			kDeskbarItemName;
 extern	bool				gInDeskbar;
-extern	int32				gMimicPulse;
 
 #define kBarWidth 100
 #define kMargin	12



From jonas at kirilla.com  Sun Jun 10 17:04:14 2007
From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=)
Date: Sun, 10 Jun 2007 17:04:14 +0200 CEST
Subject: [Haiku-commits] r21374 - haiku/trunk/build/jam
In-Reply-To: <200706091207.l59C7tVj027813@sheep.berlios.de>
Message-ID: <3714340203-BeMail@kirilla>

stippi at BerliOS  wrote:
> Author: stippi
> Date: 2007-06-09 14:07:55 +0200 (Sat, 09 Jun 2007)
> New Revision: 21374
> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21374&view=rev
> 
> Modified:
>    haiku/trunk/build/jam/HaikuImage
> Log:
> * cleanup in the Leaf menu: Applications is no longer a link to
>   /boot/beos/apps, but a folder containing links to _selected_
>   apps in that folder

Thumbs up. :)

> * a new entry "Desktop Applets" has been added, which contains
>   all the apps that you either do or do not start at system boot,
>   but don't need frequent access to

I don't think its a good idea to expose people to more tech lingo such 
as Replicants, Desktop Applets, etc. We should try to simpify.

Have you considered the name Utilities? It would fit and would also 
cover some of the tools that might come in the future and that won't be 
-Applications- in the sense that WonderBrush is. 

http://rocbo.lautre.net/macos_X/se/applic.html
GIMP, FireFox, iPhoto, are applications. The ones in the second 
picture, including Terminal, are utilities. In MacOS X, FWIW.

I don't mean that Utilities should be a subfolder of Applications in 
Deskbar. Just pointing out the classification/organization of programs 
as either Applications or Utilities.

> * some apps have been hidden:
>   - ShowImage and Expander are usually not
>     directly started on their own, but through double clicking 
> documents

IMO, ShowImage and Expander would be utilities.

>   - AboutSystem is invoked elsewhere from the Leaf menu,
>   so it doesn't need to clutter the Applications menu

Not sure how to classify AboutSystem. BApplication as it may be, it's 
neither "application" nor utility. It's more like part of the "system", 
so I would put it alongside Tracker and Deskbar. :P

> * we almost introduced a third category for rarely used apps, but in 
> the
>   end it would only have contained Installer, Icon-O-Matic and 
> Diskprobe,
>   and we felt that it is ok to leave these in the Applications menu, 
> as long
>   as their number is small

These too would be utilities to me, but I suppose it depends on who you 
are and how you use your computer. Maybe there's someone out there who 
uses DiskProbe all day long.

/Jonas.



From axeld at pinc-software.de  Sun Jun 10 18:20:17 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Sun, 10 Jun 2007 18:20:17 +0200 CEST
Subject: [Haiku-commits] r21379 - haiku/trunk/src/apps/processcontroller
In-Reply-To: <200706101415.l5AEF9dA004131@sheep.berlios.de>
Message-ID: <10568457678-BeMail@zon>

kirilla at BerliOS  wrote:
> Log:
> Removed code for using Pulse's colors. Minor changes to About window.
> Renamed menuitems Launch Tracker/Deskbar to Restart Tracker/Deskbar.

BTW in case you or anyone else wondered why I renamed the former "Kill, 
Debug, or Change Priority" and "Quit Applications" to something else: 
that was just a try; I'm not sure it was a change for the better, but 
YMMV.

Bye,
   Axel.



From bonefish at mail.berlios.de  Sun Jun 10 18:52:44 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 10 Jun 2007 18:52:44 +0200
Subject: [Haiku-commits] r21380 - in haiku/trunk: headers/os/interface
	src/kits/interface
Message-ID: <200706101652.l5AGqiqW016957@sheep.berlios.de>

Author: bonefish
Date: 2007-06-10 18:52:42 +0200 (Sun, 10 Jun 2007)
New Revision: 21380
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21380&view=rev

Modified:
   haiku/trunk/headers/os/interface/ListView.h
   haiku/trunk/src/kits/interface/ListView.cpp
Log:
Implemented layout-friendly constructors. Also added MaxSize(), though it
only invokes the BView version. Didn't know what to do with MinSize() and
PreferredSize(). ATM they return fixed, hard-coded values. It might make
sense to compute something depending on the font size, for instance.


Modified: haiku/trunk/headers/os/interface/ListView.h
===================================================================
--- haiku/trunk/headers/os/interface/ListView.h	2007-06-10 14:15:09 UTC (rev 21379)
+++ haiku/trunk/headers/os/interface/ListView.h	2007-06-10 16:52:42 UTC (rev 21380)
@@ -26,6 +26,10 @@
 			list_view_type type = B_SINGLE_SELECTION_LIST,
 			uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP,
 			uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE);
+		BListView(const char* name,
+			list_view_type type = B_SINGLE_SELECTION_LIST,
+			uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE);
+		BListView(list_view_type type = B_SINGLE_SELECTION_LIST);
 		BListView(BMessage* data);
 
 		virtual ~BListView() ;
@@ -119,6 +123,7 @@
 		virtual void		AllDetached();
 
 		virtual	BSize		MinSize();
+		virtual	BSize		MaxSize();
 		virtual	BSize		PreferredSize();
 
 	protected:

Modified: haiku/trunk/src/kits/interface/ListView.cpp
===================================================================
--- haiku/trunk/src/kits/interface/ListView.cpp	2007-06-10 14:15:09 UTC (rev 21379)
+++ haiku/trunk/src/kits/interface/ListView.cpp	2007-06-10 16:52:42 UTC (rev 21380)
@@ -72,6 +72,20 @@
 }
 
 
+BListView::BListView(const char* name, list_view_type type, uint32 flags)
+	: BView(name, flags)
+{
+	_InitObject(type);
+}
+
+
+BListView::BListView(list_view_type type)
+	: BView(NULL, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE)
+{
+	_InitObject(type);
+}
+
+
 BListView::BListView(BMessage* archive)
 	: BView(archive)
 {
@@ -1103,6 +1117,13 @@
 
 
 BSize
+BListView::MaxSize()
+{
+	return BView::MaxSize();
+}
+
+
+BSize
 BListView::PreferredSize()
 {
 	// We need a stable preferred size: the BView implementation uses



From bonefish at mail.berlios.de  Sun Jun 10 18:54:51 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 10 Jun 2007 18:54:51 +0200
Subject: [Haiku-commits] r21381 -
	haiku/trunk/src/tests/kits/interface/layout/widget_layout_test
Message-ID: <200706101654.l5AGsptD018239@sheep.berlios.de>

Author: bonefish
Date: 2007-06-10 18:54:49 +0200 (Sun, 10 Jun 2007)
New Revision: 21381
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21381&view=rev

Added:
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.h
Modified:
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp
Log:
Added a test for BListView. There's little layout related to test, though.


Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile	2007-06-10 16:52:42 UTC (rev 21380)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile	2007-06-10 16:54:49 UTC (rev 21381)
@@ -12,6 +12,7 @@
 	CheckBoxTest.cpp
 	ControlTest.cpp
 	GroupView.cpp
+	ListViewTest.cpp
 	RadioButton.cpp
 	StringView.cpp
 	Test.cpp

Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.cpp	2007-06-10 16:52:42 UTC (rev 21380)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.cpp	2007-06-10 16:54:49 UTC (rev 21381)
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2007, Ingo Weinhold .
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+
+#include "ListViewTest.h"
+
+#include 
+#include 
+
+
+ListViewTest::ListViewTest()
+	: Test("ListView", NULL),
+	  fListView(new BListView(BRect(0, 0, -1, -1), NULL))
+{
+	SetView(fListView);
+
+	// add a view items
+	for (int32 i = 0; i < 15; i++) {
+		BString itemText("list item ");
+		itemText << i;
+		fListView->AddItem(new BStringItem(itemText.String()));
+	}
+}

Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.h
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.h	2007-06-10 16:52:42 UTC (rev 21380)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.h	2007-06-10 16:54:49 UTC (rev 21381)
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2007, Ingo Weinhold .
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+#ifndef WIDGET_LAYOUT_TEST_LIST_VIEW_TEST_H
+#define WIDGET_LAYOUT_TEST_LIST_VIEW_TEST_H
+
+
+#include "Test.h"
+
+
+class BListView;
+
+
+class ListViewTest : public Test {
+public:
+								ListViewTest();
+
+private:
+			BListView*			fListView;
+};
+
+
+#endif	// WIDGET_LAYOUT_TEST_LIST_VIEW_TEST_H

Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp	2007-06-10 16:52:42 UTC (rev 21380)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp	2007-06-10 16:54:49 UTC (rev 21381)
@@ -13,6 +13,7 @@
 #include "CheckBox.h"
 #include "CheckBoxTest.h"
 #include "GroupView.h"
+#include "ListViewTest.h"
 #include "StringView.h"
 #include "Test.h"
 #include "TwoDimensionalSliderView.h"
@@ -276,6 +277,8 @@
 		test = new ButtonTest;
 	} else if (strcmp(testName, "checkbox") == 0) {
 		test = new CheckBoxTest;
+	} else if (strcmp(testName, "listview") == 0) {
+		test = new ListViewTest;
 	} else {
 		fprintf(stderr, "Error: Invalid test name: \"%s\"\n", testName);
 		exit(1);



From bonefish at mail.berlios.de  Sun Jun 10 19:02:34 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 10 Jun 2007 19:02:34 +0200
Subject: [Haiku-commits] r21382 - in
	haiku/trunk/src/tests/kits/interface/layout/widget_layout_test:
	. tests
Message-ID: <200706101702.l5AH2YGX024502@sheep.berlios.de>

Author: bonefish
Date: 2007-06-10 19:02:33 +0200 (Sun, 10 Jun 2007)
New Revision: 21382
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21382&view=rev

Added:
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.h
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ButtonTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ButtonTest.h
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/CheckBoxTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/CheckBoxTest.h
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ControlTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ControlTest.h
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.h
Removed:
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.h
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.h
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.h
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.h
Modified:
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile
Log:
Moved tests into a subdirectory.


Deleted: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp

Deleted: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h

Deleted: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.cpp

Deleted: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.h

Deleted: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.cpp

Deleted: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.h

Deleted: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.cpp

Deleted: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.h

Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile	2007-06-10 16:54:49 UTC (rev 21381)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile	2007-06-10 17:02:33 UTC (rev 21382)
@@ -2,17 +2,14 @@
 
 SetSubDirSupportedPlatforms haiku libbe_test ;
 
+SEARCH_SOURCE += [ FDirName $(SUBDIR) tests ] ;
+
 SimpleTest WidgetLayoutTest :
 	WidgetLayoutTest.cpp
 
 	AbstractButton.cpp
-	BoxTest.cpp
-	ButtonTest.cpp
 	CheckBox.cpp
-	CheckBoxTest.cpp
-	ControlTest.cpp
 	GroupView.cpp
-	ListViewTest.cpp
 	RadioButton.cpp
 	StringView.cpp
 	Test.cpp
@@ -21,6 +18,12 @@
 	View.cpp
 	ViewContainer.cpp
 	WrapperView.cpp
+
+	BoxTest.cpp
+	ButtonTest.cpp
+	CheckBoxTest.cpp
+	ControlTest.cpp
+	ListViewTest.cpp
 	:
 	be
 ;

Deleted: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.cpp

Deleted: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.h

Copied: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.cpp (from rev 21381, haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.cpp)

Copied: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.h (from rev 21381, haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/BoxTest.h)

Copied: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ButtonTest.cpp (from rev 21381, haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.cpp)

Copied: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ButtonTest.h (from rev 21381, haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ButtonTest.h)

Copied: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/CheckBoxTest.cpp (from rev 21381, haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.cpp)

Copied: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/CheckBoxTest.h (from rev 21381, haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/CheckBoxTest.h)

Copied: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ControlTest.cpp (from rev 21381, haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.cpp)

Copied: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ControlTest.h (from rev 21381, haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ControlTest.h)

Copied: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.cpp (from rev 21381, haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.cpp)

Copied: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.h (from rev 21381, haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/ListViewTest.h)



From bonefish at mail.berlios.de  Sun Jun 10 19:27:35 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 10 Jun 2007 19:27:35 +0200
Subject: [Haiku-commits] r21383 - in
	haiku/trunk/src/tests/kits/interface/layout/widget_layout_test:
	. tests
Message-ID: <200706101727.l5AHRZTf032627@sheep.berlios.de>

Author: bonefish
Date: 2007-06-10 19:27:34 +0200 (Sun, 10 Jun 2007)
New Revision: 21383
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21383&view=rev

Modified:
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.h
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ButtonTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ButtonTest.h
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/CheckBoxTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/CheckBoxTest.h
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.h
Log:
Added static factory method to all test classes and improved the program
invocation (e.g. it list what tests are available now).


Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp	2007-06-10 17:02:33 UTC (rev 21382)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp	2007-06-10 17:27:34 UTC (rev 21383)
@@ -29,6 +29,20 @@
 };
 
 
+struct test_info {
+	const char*	name;
+	Test*		(*create)();
+};
+
+const test_info kTestInfos[] = {
+	{ "box",		BoxTest::CreateTest },
+	{ "button",		ButtonTest::CreateTest },
+	{ "checkbox",	CheckBoxTest::CreateTest },
+	{ "listview",	ListViewTest::CreateTest },
+	{ NULL, NULL }
+};
+
+
 // helpful operator
 BPoint
 operator+(const BPoint& p, const BSize& size)
@@ -258,29 +272,45 @@
 };
 
 
+static void
+print_test_list(bool error)
+{
+	FILE* out = (error ? stderr : stdout);
+
+	fprintf(out, "available tests:\n");
+
+	for (int32 i = 0; kTestInfos[i].name; i++)
+		fprintf(out, "  %s\n", kTestInfos[i].name);
+}
+
+
 int
 main(int argc, const char* const* argv)
 {
 	// get test name
-	const char* testName = "button";
-	if (argc >= 2)
-		testName = argv[1];
+	const char* testName;
+	if (argc < 2) {
+		fprintf(stderr, "Usage: %s \n", argv[0]);
+		print_test_list(true);
+		exit(1);
+	}
+	testName = argv[1];
 
 	// create app
 	BApplication app("application/x-vnd.haiku.widget-layout-test");
 
-	// create test
-	Test* test;
-	if (strcmp(testName, "box") == 0) {
-		test = new BoxTest;
-	} else if (strcmp(testName, "button") == 0) {
-		test = new ButtonTest;
-	} else if (strcmp(testName, "checkbox") == 0) {
-		test = new CheckBoxTest;
-	} else if (strcmp(testName, "listview") == 0) {
-		test = new ListViewTest;
-	} else {
+	// find and create the test
+	Test* test = NULL;
+	for (int32 i = 0; kTestInfos[i].name; i++) {
+		if (strcmp(testName, kTestInfos[i].name) == 0) {
+			test = (kTestInfos[i].create)();
+			break;
+		}
+	}
+
+	if (!test) {
 		fprintf(stderr, "Error: Invalid test name: \"%s\"\n", testName);
+		print_test_list(true);
 		exit(1);
 	}
 

Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.cpp	2007-06-10 17:02:33 UTC (rev 21382)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.cpp	2007-06-10 17:27:34 UTC (rev 21383)
@@ -77,6 +77,14 @@
 }
 
 
+// CreateTest
+Test*
+BoxTest::CreateTest()
+{
+	return new BoxTest;
+}
+
+
 // ActivateTest
 void
 BoxTest::ActivateTest(View* controls)

Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.h
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.h	2007-06-10 17:02:33 UTC (rev 21382)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/BoxTest.h	2007-06-10 17:27:34 UTC (rev 21383)
@@ -19,6 +19,8 @@
 								BoxTest();
 	virtual						~BoxTest();
 
+	static	Test*				CreateTest();
+
 	virtual	void				ActivateTest(View* controls);
 	virtual	void				DectivateTest();
 

Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ButtonTest.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ButtonTest.cpp	2007-06-10 17:02:33 UTC (rev 21382)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ButtonTest.cpp	2007-06-10 17:27:34 UTC (rev 21383)
@@ -27,6 +27,14 @@
 }
 
 
+// CreateTest
+Test*
+ButtonTest::CreateTest()
+{
+	return new ButtonTest;
+}
+
+
 // ActivateTest
 void
 ButtonTest::ActivateTest(View* controls)

Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ButtonTest.h
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ButtonTest.h	2007-06-10 17:02:33 UTC (rev 21382)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ButtonTest.h	2007-06-10 17:27:34 UTC (rev 21383)
@@ -17,6 +17,7 @@
 								ButtonTest();
 	virtual						~ButtonTest();
 
+	static	Test*				CreateTest();
 	virtual	void				ActivateTest(View* controls);
 	virtual	void				DectivateTest();
 

Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/CheckBoxTest.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/CheckBoxTest.cpp	2007-06-10 17:02:33 UTC (rev 21382)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/CheckBoxTest.cpp	2007-06-10 17:27:34 UTC (rev 21383)
@@ -27,6 +27,14 @@
 }
 
 
+// CreateTest
+Test*
+CheckBoxTest::CreateTest()
+{
+	return new CheckBoxTest;
+}
+
+
 // ActivateTest
 void
 CheckBoxTest::ActivateTest(View* controls)

Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/CheckBoxTest.h
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/CheckBoxTest.h	2007-06-10 17:02:33 UTC (rev 21382)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/CheckBoxTest.h	2007-06-10 17:27:34 UTC (rev 21383)
@@ -17,6 +17,8 @@
 								CheckBoxTest();
 	virtual						~CheckBoxTest();
 
+	static	Test*				CreateTest();
+
 	virtual	void				ActivateTest(View* controls);
 	virtual	void				DectivateTest();
 

Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.cpp	2007-06-10 17:02:33 UTC (rev 21382)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.cpp	2007-06-10 17:27:34 UTC (rev 21383)
@@ -22,3 +22,12 @@
 		fListView->AddItem(new BStringItem(itemText.String()));
 	}
 }
+
+
+Test*
+ListViewTest::CreateTest()
+{
+	return new ListViewTest;
+}
+
+

Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.h
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.h	2007-06-10 17:02:33 UTC (rev 21382)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.h	2007-06-10 17:27:34 UTC (rev 21383)
@@ -16,6 +16,8 @@
 public:
 								ListViewTest();
 
+	static	Test*				CreateTest();
+
 private:
 			BListView*			fListView;
 };



From bonefish at mail.berlios.de  Sun Jun 10 19:30:42 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 10 Jun 2007 19:30:42 +0200
Subject: [Haiku-commits] r21384 -
	haiku/trunk/src/tests/kits/interface/layout/widget_layout_test
Message-ID: <200706101730.l5AHUg71000149@sheep.berlios.de>

Author: bonefish
Date: 2007-06-10 19:30:42 +0200 (Sun, 10 Jun 2007)
New Revision: 21384
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21384&view=rev

Modified:
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp
Log:
Used the names of the tested classes as the test names.


Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp	2007-06-10 17:27:34 UTC (rev 21383)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp	2007-06-10 17:30:42 UTC (rev 21384)
@@ -35,10 +35,10 @@
 };
 
 const test_info kTestInfos[] = {
-	{ "box",		BoxTest::CreateTest },
-	{ "button",		ButtonTest::CreateTest },
-	{ "checkbox",	CheckBoxTest::CreateTest },
-	{ "listview",	ListViewTest::CreateTest },
+	{ "BBox",			BoxTest::CreateTest },
+	{ "BButton",		ButtonTest::CreateTest },
+	{ "BCheckBox",		CheckBoxTest::CreateTest },
+	{ "BListView",		ListViewTest::CreateTest },
 	{ NULL, NULL }
 };
 



From axeld at pinc-software.de  Sun Jun 10 19:49:15 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Sun, 10 Jun 2007 19:49:15 +0200 CEST
Subject: [Haiku-commits]
 =?iso-8859-15?q?r21380_-_in_haiku/trunk=3A_header?=
 =?iso-8859-15?q?s/os/interface_src/kits/interface?=
In-Reply-To: <200706101652.l5AGqiqW016957@sheep.berlios.de>
Message-ID: <15906385448-BeMail@zon>

bonefish at BerliOS  wrote:
> Log:
> Implemented layout-friendly constructors. Also added MaxSize(), 
> though it
> only invokes the BView version. Didn't know what to do with MinSize() 
> and
> PreferredSize(). ATM they return fixed, hard-coded values. It might 
> make
> sense to compute something depending on the font size, for instance.

Why not take its contents into account? Or is that too much of a moving 
target?

Bye,
   Axel.



From revol at free.fr  Sun Jun 10 21:27:56 2007
From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol)
Date: Sun, 10 Jun 2007 21:27:56 +0200 CEST
Subject: [Haiku-commits] r21379 - haiku/trunk/src/apps/processcontroller
In-Reply-To: <10568457678-BeMail@zon>
Message-ID: <565118980-BeMail@laptop>

> kirilla at BerliOS  wrote:
> > Log:
> > Removed code for using Pulse's colors. Minor changes to About 
> > window.

Hey I used that! :p

> > Renamed menuitems Launch Tracker/Deskbar to Restart Tracker/
> > Deskbar.

Doesn't restart implies quitting it first ?

> 
> BTW in case you or anyone else wondered why I renamed the former 
> "Kill, 

Teams&Threads ?

> Debug, or Change Priority" and "Quit Applications" to something else: 
> that was just a try; I'm not sure it was a change for the better, but 

Fact is those names are the only descriptions on what the menus do, as 
you have to figure out you can kill a team or thread by clicking them 
if you don't read the doc.
But everyone reads the doc anyway :)

Fran?ois.


From superstippi at gmx.de  Sun Jun 10 21:25:34 2007
From: superstippi at gmx.de (Stephan Assmus)
Date: Sun, 10 Jun 2007 21:25:34 +0200
Subject: [Haiku-commits] r21379 - haiku/trunk/src/apps/processcontroller
In-Reply-To: <565118980-BeMail@laptop>
References: <565118980-BeMail@laptop>
Message-ID: <20070610212534.42181.5@stippis.WG>


Fran?ois Revol wrote (2007-06-10, 21:27:56 [+0200]):
> > > Renamed menuitems Launch Tracker/Deskbar to Restart Tracker/
> > > Deskbar.
> 
> Doesn't restart implies quitting it first ?

The menu entries are only there if Tracker or Deskbar are not running.

Best regards,
-Stephan



From jonas at kirilla.com  Sun Jun 10 21:45:49 2007
From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=)
Date: Sun, 10 Jun 2007 21:45:49 +0200 CEST
Subject: [Haiku-commits] r21379 - haiku/trunk/src/apps/processcontroller
In-Reply-To: <565118980-BeMail@laptop>
Message-ID: <1476229301-BeMail@kirilla>

"Fran?ois Revol"  wrote:
> > kirilla at BerliOS  wrote:
> > > Log:
> > > Removed code for using Pulse's colors. Minor changes to
> > > About window.
> 
> Hey I used that! :p

Sorry. <:) 

Pulse might be going away, or so I've interpreted recent changes.

> > > Renamed menuitems Launch Tracker/Deskbar to Restart Tracker/
> > > Deskbar.
> 
> Doesn't restart implies quitting it first ?

The options only appear when either one has crashed or been
quit/killed. I think it implies that they are -supposed- to be running,
and need to be restarted. I think you can restart something that 
was running but isn't any more.

/Jonas.


From stippi at mail.berlios.de  Sun Jun 10 21:58:17 2007
From: stippi at mail.berlios.de (stippi at BerliOS)
Date: Sun, 10 Jun 2007 21:58:17 +0200
Subject: [Haiku-commits] r21385 - haiku/trunk/src/apps/launchbox
Message-ID: <200706101958.l5AJwHZa011440@sheep.berlios.de>

Author: stippi
Date: 2007-06-10 21:58:16 +0200 (Sun, 10 Jun 2007)
New Revision: 21385
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21385&view=rev

Modified:
   haiku/trunk/src/apps/launchbox/MainWindow.cpp
   haiku/trunk/src/apps/launchbox/MainWindow.h
   haiku/trunk/src/apps/launchbox/PadView.cpp
   haiku/trunk/src/apps/launchbox/PadView.h
Log:
* implemented default buttons
* window size limits are correctly set
* one can now chose between horizontal and vertical layout
  (brilliantly simple with the new layout system :-)


Modified: haiku/trunk/src/apps/launchbox/MainWindow.cpp
===================================================================
--- haiku/trunk/src/apps/launchbox/MainWindow.cpp	2007-06-10 17:30:42 UTC (rev 21384)
+++ haiku/trunk/src/apps/launchbox/MainWindow.cpp	2007-06-10 19:58:16 UTC (rev 21385)
@@ -31,7 +31,8 @@
 	: BWindow(frame, name,
 			  B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
 			  B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
-			  | B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION),
+			  | B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION
+			  | B_AUTO_UPDATE_SIZE_LIMITS),
 	  fSettings(new BMessage('sett')),
 	  fPadView(new PadView("pad view")),
 	  fLastID(0),
@@ -42,14 +43,8 @@
 	bool buttonsAdded = false;
 	if (load_settings(fSettings, "main_settings", "LaunchBox") >= B_OK)
 		buttonsAdded = LoadSettings(fSettings);
-	if (!buttonsAdded) {
-		fPadView->AddButton(new LaunchButton("launch button", fLastID++, NULL,
-											new BMessage(MSG_LAUNCH)));
-		fPadView->AddButton(new LaunchButton("launch button", fLastID++, NULL,
-											new BMessage(MSG_LAUNCH)));
-		fPadView->AddButton(new LaunchButton("launch button", fLastID++, NULL,
-											new BMessage(MSG_LAUNCH)));
-	}
+	if (!buttonsAdded)
+		_AddDefaultButtons();
 
 	SetLayout(new BGroupLayout(B_HORIZONTAL));
 	AddChild(fPadView);
@@ -60,7 +55,8 @@
 	: BWindow(frame, name,
 			  B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
 			  B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE
-			  | B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION),
+			  | B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION
+			  | B_AUTO_UPDATE_SIZE_LIMITS),
 	  fSettings(settings),
 	  fPadView(new PadView("pad view")),
 	  fLastID(0),
@@ -68,14 +64,8 @@
 	  fAutoRaise(false),
 	  fShowOnAllWorkspaces(true)
 {
-	if (!LoadSettings(settings)) {
-		fPadView->AddButton(new LaunchButton("launch button", fLastID++, NULL,
-											new BMessage(MSG_LAUNCH)));
-		fPadView->AddButton(new LaunchButton("launch button", fLastID++, NULL,
-											new BMessage(MSG_LAUNCH)));
-		fPadView->AddButton(new LaunchButton("launch button", fLastID++, NULL,
-											new BMessage(MSG_LAUNCH)));
-	}
+	if (!LoadSettings(settings))
+		_AddDefaultButtons();
 
 	SetLayout(new BGroupLayout(B_HORIZONTAL));
 	AddChild(fPadView);
@@ -317,6 +307,12 @@
 	window_look look;
 	if (message->FindInt32("window look", (int32*)&look) == B_OK)
 		SetLook(look);
+
+	// restore orientation
+	int32 orientation;
+	if (message->FindInt32("orientation", &orientation) == B_OK)
+		fPadView->SetOrientation((enum orientation)orientation);
+
 	// restore buttons
 	const char* path;
 	bool buttonAdded = false;
@@ -381,6 +377,11 @@
 	if (message->ReplaceInt32("window look", Look()) != B_OK)
 		message->AddInt32("window look", Look());
 
+	// store orientation
+	if (message->ReplaceInt32("orientation",
+			(int32)fPadView->Orientation()) != B_OK)
+		message->AddInt32("orientation", (int32)fPadView->Orientation());
+
 	// store buttons
 	message->RemoveName("path");
 	message->RemoveName("description");
@@ -473,3 +474,44 @@
 	ResizeTo(frame.Width(), frame.Height());
 }
 
+void
+MainWindow::_AddDefaultButtons()
+{
+	// Mail
+	LaunchButton* button = new LaunchButton("launch button", fLastID++, NULL,
+		new BMessage(MSG_LAUNCH));
+	fPadView->AddButton(button);
+	button->SetTo("application/x-vnd.Be-MAIL", true);
+
+	// StyledEdit
+	button = new LaunchButton("launch button", fLastID++, NULL,
+		new BMessage(MSG_LAUNCH));
+	fPadView->AddButton(button);
+	button->SetTo("application/x-vnd.Haiku-StyledEdit", true);
+
+	// ShowImage
+	button = new LaunchButton("launch button", fLastID++, NULL,
+		new BMessage(MSG_LAUNCH));
+	fPadView->AddButton(button);
+	button->SetTo("application/x-vnd.Haiku-ShowImage", true);
+
+	// MediaPlayer
+	button = new LaunchButton("launch button", fLastID++, NULL,
+		new BMessage(MSG_LAUNCH));
+	fPadView->AddButton(button);
+	button->SetTo("application/x-vnd.Haiku-MediaPlayer", true);
+
+	// DeskCalc
+	button = new LaunchButton("launch button", fLastID++, NULL,
+		new BMessage(MSG_LAUNCH));
+	fPadView->AddButton(button);
+	button->SetTo("application/x-vnd.Haiku-DeskCalc", true);
+
+	// Terminal
+	button = new LaunchButton("launch button", fLastID++, NULL,
+		new BMessage(MSG_LAUNCH));
+	fPadView->AddButton(button);
+	button->SetTo("application/x-vnd.Haiku-Terminal", true);
+}
+
+

Modified: haiku/trunk/src/apps/launchbox/MainWindow.h
===================================================================
--- haiku/trunk/src/apps/launchbox/MainWindow.h	2007-06-10 17:30:42 UTC (rev 21384)
+++ haiku/trunk/src/apps/launchbox/MainWindow.h	2007-06-10 19:58:16 UTC (rev 21385)
@@ -62,6 +62,7 @@
  private:
  			void				_GetLocation();
 			void				_AdjustLocation(BRect frame);
+			void				_AddDefaultButtons();
 
 	BMessage*					fSettings;
 	PadView*					fPadView;

Modified: haiku/trunk/src/apps/launchbox/PadView.cpp
===================================================================
--- haiku/trunk/src/apps/launchbox/PadView.cpp	2007-06-10 17:30:42 UTC (rev 21384)
+++ haiku/trunk/src/apps/launchbox/PadView.cpp	2007-06-10 19:58:16 UTC (rev 21385)
@@ -24,18 +24,23 @@
 
 bigtime_t kActivationDelay = 40000;
 
+enum {
+	MSG_TOGGLE_LAYOUT	= 'tgll'
+};
+
 // constructor
 PadView::PadView(const char* name)
-	: BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE,
-			new BGroupLayout(B_VERTICAL, 4)),
+	: BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE, NULL),
 	  fDragging(false),
-	  fClickTime(0)
+	  fClickTime(0),
+	  fButtonLayout(new BGroupLayout(B_VERTICAL, 4))
 {
 	SetViewColor(B_TRANSPARENT_32_BIT);
 	SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
 	get_click_speed(&kActivationDelay); 
 
-	GetLayout()->AddItem(BSpaceLayoutItem::CreateVerticalStrut(5));
+	fButtonLayout->SetInsets(2, 7, 2, 2);
+	SetLayout(fButtonLayout);
 }
 
 // destructor
@@ -62,9 +67,25 @@
 	r.InsetBy(1.0, 1.0);
 	// dots along top
 	BPoint dot = r.LeftTop();
-	BPoint stop = r.RightTop();
+	int32 current;
+	int32 stop;
+	BPoint offset;
+	BPoint next;
+	if (Orientation() == B_VERTICAL) {
+		current = (int32)dot.x;
+		stop = (int32)r.right;
+		offset = BPoint(0, 1);
+		next = BPoint(1, -4);
+		r.top += 5.0;
+	} else {
+		current = (int32)dot.y;
+		stop = (int32)r.bottom;
+		offset = BPoint(1, 0);
+		next = BPoint(-4, 1);
+		r.left += 5.0;
+	}
 	int32 num = 1;
-	while (dot.x <= stop.x) {
+	while (current <= stop) {
 		rgb_color col1;
 		rgb_color col2;
 		switch (num) {
@@ -85,22 +106,21 @@
 		SetHighColor(col1);
 		StrokeLine(dot, dot, B_SOLID_HIGH);
 		SetHighColor(col2);
-		dot.y++;
+		dot += offset;
 		StrokeLine(dot, dot, B_SOLID_HIGH);
-		dot.y++;
+		dot += offset;
 		StrokeLine(dot, dot, B_SOLID_LOW);
-		dot.y++;
+		dot += offset;
 		SetHighColor(col1);
 		StrokeLine(dot, dot, B_SOLID_HIGH);
-		dot.y++;
+		dot += offset;
 		SetHighColor(col2);
 		StrokeLine(dot, dot, B_SOLID_HIGH);
-		dot.y -= 4.0;
 		// next pixel
 		num++;
-		dot.x++;
+		dot += next;
+		current++;
 	}
-	r.top += 5.0;
 	FillRect(r, B_SOLID_LOW);
 }
 
@@ -109,6 +129,15 @@
 PadView::MessageReceived(BMessage* message)
 {
 	switch (message->what) {
+		case MSG_TOGGLE_LAYOUT:
+			if (fButtonLayout->Orientation() == B_HORIZONTAL) {
+				fButtonLayout->SetInsets(2, 7, 2, 2);
+				fButtonLayout->SetOrientation(B_VERTICAL);
+			} else {
+				fButtonLayout->SetInsets(7, 2, 2, 2);
+				fButtonLayout->SetOrientation(B_HORIZONTAL);
+			}
+			break;
 		default:
 			BView::MessageReceived(message);
 			break;
@@ -221,18 +250,17 @@
 void
 PadView::AddButton(LaunchButton* button, LaunchButton* beforeButton)
 {
-	BLayout* layout = GetLayout();
 	if (beforeButton)
-		layout->AddView(layout->IndexOfView(beforeButton), button);
+		fButtonLayout->AddView(fButtonLayout->IndexOfView(beforeButton), button);
 	else
-		layout->AddView(button);
+		fButtonLayout->AddView(button);
 }
 
 // RemoveButton
 bool
 PadView::RemoveButton(LaunchButton* button)
 {
-	return GetLayout()->RemoveView(button);
+	return fButtonLayout->RemoveView(button);
 }
 
 // ButtonAt
@@ -276,19 +304,29 @@
 			item = new BMenuItem("Remove Button", message);
 			item->SetTarget(window);
 			menu->AddItem(item);
-			if (button->Ref()) {
-				message = new BMessage(MSG_SET_DESCRIPTION);
-				message->AddPointer("be:source", (void*)button);
-				item = new BMenuItem("Set Description"B_UTF8_ELLIPSIS, message);
-				item->SetTarget(window);
-				menu->AddItem(item);
-			}
+// TODO: disabled because Haiku does not yet support tool tips
+//			if (button->Ref()) {
+//				message = new BMessage(MSG_SET_DESCRIPTION);
+//				message->AddPointer("be:source", (void*)button);
+//				item = new BMenuItem("Set Description"B_UTF8_ELLIPSIS, message);
+//				item->SetTarget(window);
+//				menu->AddItem(item);
+//			}
 		}
 		menu->AddSeparatorItem();
 		// window settings
 		BMenu* settingsM = new BMenu("Settings");
 		settingsM->SetFont(be_plain_font);
 
+		const char* toggleLayoutLabel;
+		if (fButtonLayout->Orientation() == B_HORIZONTAL)
+			toggleLayoutLabel = "Vertical Layout";
+		else
+			toggleLayoutLabel = "Horizontal Layout";
+		item = new BMenuItem(toggleLayoutLabel, new BMessage(MSG_TOGGLE_LAYOUT));
+		item->SetTarget(this);
+		settingsM->AddItem(item);
+
 		uint32 what = window->Look() == B_BORDERED_WINDOW_LOOK ? MSG_SHOW_BORDER : MSG_HIDE_BORDER;
 		item = new BMenuItem("Show Window Border", new BMessage(what));
 		item->SetTarget(window);
@@ -348,3 +386,24 @@
 	}
 }
 
+// SetOrientation
+void
+PadView::SetOrientation(enum orientation orientation)
+{
+	if (orientation == B_VERTICAL) {
+		fButtonLayout->SetInsets(2, 7, 2, 2);
+		fButtonLayout->SetOrientation(B_VERTICAL);
+	} else {
+		fButtonLayout->SetInsets(7, 2, 2, 2);
+		fButtonLayout->SetOrientation(B_HORIZONTAL);
+	}
+}
+
+// Orientation
+enum orientation
+PadView::Orientation() const
+{
+	return fButtonLayout->Orientation();
+}
+
+

Modified: haiku/trunk/src/apps/launchbox/PadView.h
===================================================================
--- haiku/trunk/src/apps/launchbox/PadView.h	2007-06-10 17:30:42 UTC (rev 21384)
+++ haiku/trunk/src/apps/launchbox/PadView.h	2007-06-10 19:58:16 UTC (rev 21385)
@@ -11,6 +11,7 @@
 
 #include 
 
+class BGroupLayout;
 class LaunchButton;
 
 class PadView : public BView {
@@ -35,10 +36,14 @@
 			void				DisplayMenu(BPoint where,
 											LaunchButton* button = NULL) const;
 
+			void				SetOrientation(enum orientation orientation);
+			enum orientation	Orientation() const;
+
  private:
 			BPoint				fDragOffset;
 			bool				fDragging;
 			bigtime_t			fClickTime;
+			BGroupLayout*		fButtonLayout;
 };
 
 #endif // PAD_VIEW_H



From fekdahl at gmail.com  Sun Jun 10 22:07:08 2007
From: fekdahl at gmail.com (Fredrik Ekdahl)
Date: Sun, 10 Jun 2007 22:07:08 +0200
Subject: [Haiku-commits] r21374 - haiku/trunk/build/jam
In-Reply-To: <200706091700.03189.fekdahl@gmail.com>
References: <200706091207.l59C7tVj027813@sheep.berlios.de>
	<200706091700.03189.fekdahl@gmail.com>
Message-ID: <200706102207.09268.fekdahl@gmail.com>

On Saturday 09 June 2007 17.00.03 you wrote:
> On Saturday 09 June 2007 14.07.55 stippi at BerliOS wrote:
> > Author: stippi
> > Date: 2007-06-09 14:07:55 +0200 (Sat, 09 Jun 2007)
> > New Revision: 21374
> > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21374&view=rev
> >
> > Modified:
> >    haiku/trunk/build/jam/HaikuImage
>
> Some gcc 4 comments coming..
>
> > -BEOS_APPS = Terminal Expander People ShowImage ProcessController
> > -	SoundRecorder Magnify DiskProbe AboutSystem StyledEdit Installer
> > Workspaces -	$(X86_ONLY)Cortex MediaPlayer DeskCalc MidiPlayer
> > -	Icon-O-Matic Mail CDPlayer NetworkStatus TV
> > +
> > +BEOS_APPS = AboutSystem DeskCalc DiskProbe CDPlayer Expander
> > Icon-O-Matic +	Installer LaunchBox Magnify Mail MediaPlayer MidiPlayer
> > NetworkStatus +	People PowerStatus ProcessController ShowImage
> > SoundRecorder StyledEdit +	Terminal TV Workspaces
> >  ;
>
> Launchbox is not compiling with gcc 4 yet. I'll probably take a look soon
> and see if I can figure it out.
>

I sent a reply to this yesterday but managed to send it to my own address 
instead of the commit list :-|

Anyway, I've attached a diff which fixes compilation of launchbox.

/Fredrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: launchbox.diff
Type: text/x-diff
Size: 504 bytes
Desc: not available
URL: 

From stippi at mail.berlios.de  Sun Jun 10 22:24:48 2007
From: stippi at mail.berlios.de (stippi at BerliOS)
Date: Sun, 10 Jun 2007 22:24:48 +0200
Subject: [Haiku-commits] r21386 - haiku/trunk/src/apps/launchbox
Message-ID: <200706102024.l5AKOmPd013248@sheep.berlios.de>

Author: stippi
Date: 2007-06-10 22:24:48 +0200 (Sun, 10 Jun 2007)
New Revision: 21386
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21386&view=rev

Modified:
   haiku/trunk/src/apps/launchbox/support.cpp
Log:
* compile fix, thanks to Fredrik Ekdahl


Modified: haiku/trunk/src/apps/launchbox/support.cpp
===================================================================
--- haiku/trunk/src/apps/launchbox/support.cpp	2007-06-10 19:58:16 UTC (rev 21385)
+++ haiku/trunk/src/apps/launchbox/support.cpp	2007-06-10 20:24:48 UTC (rev 21386)
@@ -85,7 +85,7 @@
 
 // make_sure_frame_is_on_screen
 bool
-make_sure_frame_is_on_screen(BRect& frame, BWindow* window = NULL)
+make_sure_frame_is_on_screen(BRect& frame, BWindow* window)
 {
 	BScreen* screen = window ? new BScreen(window) : new BScreen(B_MAIN_SCREEN_ID);
 	bool success = false;



From stippi at mail.berlios.de  Sun Jun 10 22:29:44 2007
From: stippi at mail.berlios.de (stippi at BerliOS)
Date: Sun, 10 Jun 2007 22:29:44 +0200
Subject: [Haiku-commits] r21387 -
	haiku/trunk/src/add-ons/translators/wonderbrush/support
Message-ID: <200706102029.l5AKTikQ013588@sheep.berlios.de>

Author: stippi
Date: 2007-06-10 22:29:44 +0200 (Sun, 10 Jun 2007)
New Revision: 21387
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21387&view=rev

Modified:
   haiku/trunk/src/add-ons/translators/wonderbrush/support/support.h
Log:
* GCC4 compile fix by Fredrik Ekdahl


Modified: haiku/trunk/src/add-ons/translators/wonderbrush/support/support.h
===================================================================
--- haiku/trunk/src/add-ons/translators/wonderbrush/support/support.h	2007-06-10 20:24:48 UTC (rev 21386)
+++ haiku/trunk/src/add-ons/translators/wonderbrush/support/support.h	2007-06-10 20:29:44 UTC (rev 21387)
@@ -24,21 +24,22 @@
 // constrain_int32_0_255_asm
 inline int32
 constrain_int32_0_255_asm(int32 value) {
-    asm("movl  $0,    %%ecx;
-         movl  $255,  %%edx;
-         cmpl  %%ecx, %%eax;
-         cmovl %%ecx, %%eax;
-         cmpl  %%edx, %%eax;
-         cmovg %%edx, %%eax"
-       : "=a" (value)
-       : "a" (value) 
-       : "%ecx", "%edx" );
-    return value;
+	asm("movl  $0,    %%ecx\n\t"
+		"movl  $255,  %%edx\n\t"
+		"cmpl  %%ecx, %%eax\n\t"
+		"cmovl %%ecx, %%eax\n\t"
+		"cmpl  %%edx, %%eax\n\t"
+		"cmovg %%edx, %%eax"
+		: "=a" (value)
+		: "a" (value) 
+		: "%ecx", "%edx" );
+	return value;
 }
 
 inline int32
-constrain_int32_0_255_c(int32 value) {
-    return max_c(0, min_c(255, value));
+constrain_int32_0_255_c(int32 value)
+{
+	return max_c(0, min_c(255, value));
 }
 
 #define constrain_int32_0_255 constrain_int32_0_255_asm



From bonefish at cs.tu-berlin.de  Sun Jun 10 23:17:20 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sun, 10 Jun 2007 23:17:20 +0200
Subject: [Haiku-commits] r21380 - in haiku/trunk: headers/os/interface
 src/kits/interface
In-Reply-To: <15906385448-BeMail@zon>
References: <15906385448-BeMail@zon>
Message-ID: <20070610231720.755.1@cs.tu-berlin.de>


On 2007-06-10 at 19:49:15 [+0200], Axel D?rfler  
wrote:
> bonefish at BerliOS  wrote:
> > Log:
> > Implemented layout-friendly constructors. Also added MaxSize(),
> > though it
> > only invokes the BView version. Didn't know what to do with MinSize()
> > and
> > PreferredSize(). ATM they return fixed, hard-coded values. It might
> > make
> > sense to compute something depending on the font size, for instance.
> 
> Why not take its contents into account? Or is that too much of a moving
> target?

I'm not sure, if that would be too expensive. Adding/removing an item would 
affect the preferred size and thus trigger a layout invalidation. All 
ancestors would be relayouted. Since the relayouting happens deferredly, in 
this respect there's no difference between adding one item or thousand 
items in a row. So it may or may not be OK, if one has a complex layout. I 
suppose one has to try that and test whether it is acceptable.

CU, Ingo


From marcusoverhagen at mail.berlios.de  Mon Jun 11 01:13:29 2007
From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS)
Date: Mon, 11 Jun 2007 01:13:29 +0200
Subject: [Haiku-commits] r21388 - in
	haiku/trunk/src/add-ons/media/plugins/avi_reader: . libOpenDML
Message-ID: <200706102313.l5ANDT5r019359@sheep.berlios.de>

Author: marcusoverhagen
Date: 2007-06-11 01:13:28 +0200 (Mon, 11 Jun 2007)
New Revision: 21388
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21388&view=rev

Added:
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.cpp
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.h
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.cpp
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.h
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.cpp
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.h
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.cpp
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.h
Modified:
   haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp
   haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.h
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Jamfile
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h
Log:
Preparation of seek support. Put AVI index handling into different files. Preload the full idx1 (standard) index during file opening.


Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp	2007-06-10 23:13:28 UTC (rev 21388)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Marcus Overhagen
+ * Copyright (c) 2004-2007, Marcus Overhagen
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without modification,
@@ -32,7 +32,7 @@
 #include "RawFormats.h"
 #include "avi_reader.h"
 
-//#define TRACE_AVI_READER
+#define TRACE_AVI_READER
 #ifdef TRACE_AVI_READER
   #define TRACE printf
 #else
@@ -71,7 +71,7 @@
 
 
 aviReader::aviReader()
- :	fFile(0)
+ :	fFile(NULL)
 {
 	TRACE("aviReader::aviReader\n");
 }
@@ -110,8 +110,8 @@
 	
 	TRACE("aviReader::Sniff: this stream seems to be supported\n");
 	
-	fFile = new OpenDMLFile();
-	if (B_OK != fFile->SetTo(pos_io_source)) {
+	fFile = new OpenDMLFile(pos_io_source);
+	if (B_OK != fFile->Init()) {
 		ERROR("aviReader::Sniff: can't setup OpenDMLFile\n");
 		return B_ERROR;
 	}
@@ -169,24 +169,24 @@
 		
 		if (audio_format->format_tag == 0x0001) {// PCM
 			cookie->frame_count = stream_header->length / ((stream_header->sample_size + 7) / 8);
-			TRACE("frame_count %Ld (is PCM)\n", cookie->frame_count);
+			TRACE("audio frame_count %Ld (is PCM)\n", cookie->frame_count);
 		} else if (stream_header->rate) { // not PCM
 			cookie->frame_count = (stream_header->length * (int64)audio_format->frames_per_sec) / stream_header->rate;
-			TRACE("frame_count %Ld (using rate)\n", cookie->frame_count);
+			TRACE("audio frame_count %Ld (using rate)\n", cookie->frame_count);
 		} else { // not PCM
 			cookie->frame_count = (stream_header->length * (int64)audio_format->frames_per_sec) / (stream_header->sample_size * audio_format->avg_bytes_per_sec);
-			TRACE("frame_count %Ld (using fallback)\n", cookie->frame_count);
+			TRACE("audio frame_count %Ld (using fallback)\n", cookie->frame_count);
 		}
 
 		if (stream_header->rate && stream_header->scale) {
 			cookie->duration = (1000000LL * (int64)stream_header->length * (int64)stream_header->scale) / stream_header->rate;
-			TRACE("duration %.6f (%Ld) (using scale & rate)\n", cookie->duration / 1E6, cookie->duration);
+			TRACE("audio duration %.6f (%Ld) (using scale & rate)\n", cookie->duration / 1E6, cookie->duration);
 		} else if (stream_header->rate) {
 			cookie->duration = (1000000LL * (int64)stream_header->length) / stream_header->rate;
-			TRACE("duration %.6f (%Ld) (using rate)\n", cookie->duration / 1E6, cookie->duration);
+			TRACE("audio duration %.6f (%Ld) (using rate)\n", cookie->duration / 1E6, cookie->duration);
 		} else {
 			cookie->duration = fFile->Duration();
-			TRACE("duration %.6f (%Ld) (using fallback)\n", cookie->duration / 1E6, cookie->duration);
+			TRACE("audio duration %.6f (%Ld) (using fallback)\n", cookie->duration / 1E6, cookie->duration);
 		}
 		
 		cookie->audio = true;
@@ -195,19 +195,19 @@
 		if (stream_header->scale && stream_header->rate && stream_header->sample_size) {
 			cookie->bytes_per_sec_rate = stream_header->rate * stream_header->sample_size;
 			cookie->bytes_per_sec_scale = stream_header->scale;
-			TRACE("bytes_per_sec_rate %ld, bytes_per_sec_scale %ld (using both)\n", cookie->bytes_per_sec_rate, cookie->bytes_per_sec_scale);
+			TRACE("audio bytes_per_sec_rate %ld, bytes_per_sec_scale %ld (using both)\n", cookie->bytes_per_sec_rate, cookie->bytes_per_sec_scale);
 		} else if (audio_format->avg_bytes_per_sec) {
 			cookie->bytes_per_sec_rate = audio_format->avg_bytes_per_sec;
 			cookie->bytes_per_sec_scale = 1;
-			TRACE("bytes_per_sec_rate %ld, bytes_per_sec_scale %ld (using avg_bytes_per_sec)\n", cookie->bytes_per_sec_rate, cookie->bytes_per_sec_scale);
+			TRACE("audio bytes_per_sec_rate %ld, bytes_per_sec_scale %ld (using avg_bytes_per_sec)\n", cookie->bytes_per_sec_rate, cookie->bytes_per_sec_scale);
 		} else if (stream_header->rate) {
 			cookie->bytes_per_sec_rate = stream_header->rate;
 			cookie->bytes_per_sec_scale = 1;
-			TRACE("bytes_per_sec_rate %ld, bytes_per_sec_scale %ld (using rate)\n", cookie->bytes_per_sec_rate, cookie->bytes_per_sec_scale);
+			TRACE("audio bytes_per_sec_rate %ld, bytes_per_sec_scale %ld (using rate)\n", cookie->bytes_per_sec_rate, cookie->bytes_per_sec_scale);
 		} else {
 			cookie->bytes_per_sec_rate = 128000;
 			cookie->bytes_per_sec_scale = 8;
-			TRACE("bytes_per_sec_rate %ld, bytes_per_sec_scale %ld (using fallback)\n", cookie->bytes_per_sec_rate, cookie->bytes_per_sec_scale);
+			TRACE("audio bytes_per_sec_rate %ld, bytes_per_sec_scale %ld (using fallback)\n", cookie->bytes_per_sec_rate, cookie->bytes_per_sec_scale);
 		}
 
 		if (audio_format->format_tag == 0x0001) {
@@ -291,8 +291,8 @@
 		cookie->frame_count = stream_header->length;
 		cookie->duration = (cookie->frame_count * (int64)cookie->frames_per_sec_scale * 1000000LL) / cookie->frames_per_sec_rate;
 		
-		TRACE("frame_count %Ld\n", cookie->frame_count);
-		TRACE("duration %.6f (%Ld)\n", cookie->duration / 1E6, cookie->duration);
+		TRACE("video frame_count %Ld\n", cookie->frame_count);
+		TRACE("video duration %.6f (%Ld)\n", cookie->duration / 1E6, cookie->duration);
 
 		description.family = B_AVI_FORMAT_FAMILY;
 		if (stream_header->fourcc_handler == 'ekaf' || stream_header->fourcc_handler == 0) // 'fake' or 0 fourcc => used compression id
@@ -383,9 +383,14 @@
 	avi_cookie *cookie = (avi_cookie *)_cookie;
 
 	int64 start; uint32 size; bool keyframe;
-	if (!fFile->GetNextChunkInfo(cookie->stream, &start, &size, &keyframe))
+	if (fFile->GetNextChunkInfo(cookie->stream, &start, &size, &keyframe) < B_OK)
 		return B_LAST_BUFFER_ERROR;
 
+	if (size > 0x200000) { // 2 MB
+		ERROR("stream %d: frame too big: %u byte\n", size);
+		return B_NO_MEMORY;
+	}
+
 	if (cookie->buffer_size < size) {
 		delete [] cookie->buffer;
 		cookie->buffer_size = (size + 15) & ~15;

Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.h
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.h	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.h	2007-06-10 23:13:28 UTC (rev 21388)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Marcus Overhagen
+ * Copyright (c) 2004-2007, Marcus Overhagen
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without modification,
@@ -26,7 +26,7 @@
 #define _AVI_READER_H
 
 #include "ReaderPlugin.h"
-#include "libOpenDML/OpenDMLFile.h"
+#include "OpenDMLFile.h"
 
 class aviReader : public Reader
 {

Added: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.cpp	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.cpp	2007-06-10 23:13:28 UTC (rev 21388)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2007, Marcus Overhagen
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include 
+#include 
+#include "FallbackIndex.h"
+
+
+FallbackIndex::FallbackIndex(BPositionIO *source, OpenDMLParser *parser)
+ :	Index(source, parser)
+{
+}
+
+
+FallbackIndex::~FallbackIndex()
+{
+}
+
+
+status_t
+FallbackIndex::Init()
+{
+	return B_ERROR;
+}
+
+
+status_t
+FallbackIndex::GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe)
+{
+	return B_ERROR;
+}
+
+
+status_t
+FallbackIndex::Seek(int stream_index, uint32 seekTo, int64 *frame, bigtime_t *time)
+{
+	return B_ERROR;
+}

Added: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.h
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.h	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.h	2007-06-10 23:13:28 UTC (rev 21388)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2007, Marcus Overhagen
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _FALLBACK_INDEX_H
+#define _FALLBACK_INDEX_H
+
+#include "Index.h"
+
+class FallbackIndex : public Index
+{
+public:
+						FallbackIndex(BPositionIO *source, OpenDMLParser *parser);
+						~FallbackIndex();
+
+	status_t			Init();
+
+	status_t			GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe);
+	status_t			Seek(int stream_index, uint32 seekTo, int64 *frame, bigtime_t *time);
+};
+
+#endif

Added: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.cpp	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.cpp	2007-06-10 23:13:28 UTC (rev 21388)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, Marcus Overhagen
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include 
+#include 
+#include "Index.h"
+
+Index::Index(BPositionIO *source, OpenDMLParser *parser)
+ :	fSource(source)
+ ,	fParser(parser)
+{
+}
+
+
+Index::~Index()
+{
+}

Added: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.h
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.h	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.h	2007-06-10 23:13:28 UTC (rev 21388)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, Marcus Overhagen
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _INDEX_H
+#define _INDEX_H
+
+class OpenDMLParser;
+
+class Index
+{
+public:
+						Index(BPositionIO *source, OpenDMLParser *parser);
+	virtual				~Index();
+
+	virtual status_t	Init() = 0;
+
+	virtual status_t	GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe) = 0;
+	virtual status_t	Seek(int stream_index, uint32 seekTo, int64 *frame, bigtime_t *time) = 0;
+
+protected:
+	BPositionIO *		fSource;
+	OpenDMLParser *		fParser;
+};
+
+#endif

Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Jamfile
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Jamfile	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Jamfile	2007-06-10 23:13:28 UTC (rev 21388)
@@ -1,6 +1,12 @@
 SubDir HAIKU_TOP src add-ons media plugins avi_reader libOpenDML ;
 
+UsePrivateHeaders media ;
+
 StaticLibrary libopendml.a :
 	OpenDMLFile.cpp
 	OpenDMLParser.cpp
+	Index.cpp
+	OpenDMLIndex.cpp
+	StandardIndex.cpp
+	FallbackIndex.cpp
 ;

Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp	2007-06-10 23:13:28 UTC (rev 21388)
@@ -24,6 +24,9 @@
  */
 #include 
 #include "OpenDMLFile.h"
+#include "OpenDMLIndex.h"
+#include "StandardIndex.h"
+#include "FallbackIndex.h"
 
 #define TRACE_ODML_FILE
 #ifdef TRACE_ODML_FILE
@@ -34,6 +37,7 @@
 
 #define ERROR(a...) fprintf(stderr, a)
 
+#if 0
 #define INDEX_CHUNK_SIZE 32768
 
 struct OpenDMLFile::stream_data
@@ -62,19 +66,19 @@
 	int		index_chunk_entry_count;
 	int		index_chunk_entry_pos;
 };
+#endif
 
-OpenDMLFile::OpenDMLFile()
- : 	fSource(0),
-	fParser(0),
- 	fStreamCount(0),
- 	fStreamData(0)
+OpenDMLFile::OpenDMLFile(BPositionIO *source)
+ : 	fSource(source)
+ ,	fParser(NULL)
+ ,	fIndex(NULL)
 {
 }
 
 OpenDMLFile::~OpenDMLFile()
 {
 	delete fParser;
-	delete [] fStreamData;
+	delete fIndex;
 }
 
 /* static */ bool
@@ -88,10 +92,8 @@
 }
 
 status_t
-OpenDMLFile::SetTo(BPositionIO *source)
+OpenDMLFile::Init()
 {
-	fSource = source;
-	delete fParser;
 	fParser = new OpenDMLParser(fSource);
 
 	if (fParser->Parse() < B_OK) {
@@ -103,28 +105,40 @@
 		return B_ERROR;
 	}
 	
-	if (fParser->StreamCount() != 0 && fParser->StandardIndexSize() == 0) {
-		TRACE("OpenDMLFile::SetTo file has no standard avi index\n");
-		bool found_odml_index = false;
-		for (int i = 0; i < fParser->StreamCount(); i++) {
-			if (fParser->StreamInfo(i)->odml_index_size != 0) {
-				found_odml_index = true;
-				break;
-			}
+	if (fParser->StreamCount() == 0) {
+		ERROR("OpenDMLFile::SetTo: no streams found\n");
+	}
+
+	if (fParser->StreamInfo(0)->odml_index_size != 0) {
+		fIndex = new OpenDMLIndex(fSource, fParser);
+		if (fIndex->Init() < B_OK) {
+			delete fIndex;
+			fIndex = NULL;
 		}
-		if (!found_odml_index) {
-			ERROR("OpenDMLFile::SetTo file has no standard avi index, and no OpenDML track index found\n");
+	}
+	if (!fIndex && fParser->StandardIndexSize() != 0) {
+		fIndex = new StandardIndex(fSource, fParser);
+		if (fIndex->Init() < B_OK) {
+			delete fIndex;
+			fIndex = NULL;
+		}
+	}
+	if (!fIndex) {
+		fIndex = new FallbackIndex(fSource, fParser);
+		if (fIndex->Init() < B_OK) {
+			delete fIndex;
+			fIndex = NULL;
+			TRACE("OpenDMLFile::SetTo: init of fallback index failed!\n");
 			return B_ERROR;
 		}
 	}
 	
 	TRACE("OpenDMLFile::SetTo: this is a %s AVI file with %d streams\n", fParser->OdmlExtendedHeader() ? "OpenDML" : "standard", fParser->StreamCount());
 
-	InitData();
-
 	return B_OK;
 }
 
+#if 0
 void
 OpenDMLFile::InitData()
 {
@@ -375,22 +389,18 @@
 	TRACE("OpenDMLFile::AviGetNextChunkInfo: index end reached\n");
 	return false;
 }
+#endif
 
-bool
+status_t
 OpenDMLFile::GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe)
 {
-	stream_data *data = &fStreamData[stream_index];
-	if (data->has_standard_index)
-		return AviGetNextChunkInfo(stream_index, start, size, keyframe);
-	if (data->has_odml_index)
-		return OdmlGetNextChunkInfo(stream_index, start, size, keyframe);
-	return false;
+	return fIndex->GetNextChunkInfo(stream_index, start, size, keyframe);
 }
 
 int
 OpenDMLFile::StreamCount()
 {
-	return fStreamCount;
+	return fParser->StreamCount();
 }
 
 bigtime_t
@@ -416,13 +426,13 @@
 bool
 OpenDMLFile::IsVideo(int stream_index)
 {
-	return fStreamData[stream_index].info->is_video;
+	return fParser->StreamInfo(stream_index)->is_video;
 }
 
 bool
 OpenDMLFile::IsAudio(int stream_index)
 {
-	return fStreamData[stream_index].info->is_audio;
+	return fParser->StreamInfo(stream_index)->is_audio;
 }
 
 const avi_main_header *
@@ -434,25 +444,25 @@
 const wave_format_ex *
 OpenDMLFile::AudioFormat(int stream_index, size_t *size /* = 0*/)
 {
-	if (!fStreamData[stream_index].info->is_audio)
+	if (!fParser->StreamInfo(stream_index)->is_audio)
 		return 0;
-	if (!fStreamData[stream_index].info->audio_format)
+	if (!fParser->StreamInfo(stream_index)->audio_format)
 		return 0;
 	if (size)
-		*size = fStreamData[stream_index].info->audio_format_size;
-	return fStreamData[stream_index].info->audio_format;
+		*size = fParser->StreamInfo(stream_index)->audio_format_size;
+	return fParser->StreamInfo(stream_index)->audio_format;
 }
 
 const bitmap_info_header *
 OpenDMLFile::VideoFormat(int stream_index)
 {
-	return (fStreamData[stream_index].info->is_video && fStreamData[stream_index].info->video_format_valid) ?
-		&fStreamData[stream_index].info->video_format : 0;
+	return (fParser->StreamInfo(stream_index)->is_video && fParser->StreamInfo(stream_index)->video_format_valid) ?
+		&fParser->StreamInfo(stream_index)->video_format : 0;
 }
 
 const avi_stream_header *
 OpenDMLFile::StreamFormat(int stream_index)
 {
-	return (fStreamData[stream_index].info->stream_header_valid) ?
-		&fStreamData[stream_index].info->stream_header : 0;
+	return (fParser->StreamInfo(stream_index)->stream_header_valid) ?
+		&fParser->StreamInfo(stream_index)->stream_header : 0;
 }

Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h	2007-06-10 23:13:28 UTC (rev 21388)
@@ -27,24 +27,25 @@
 
 #include 
 #include "OpenDMLParser.h"
+#include "Index.h"
 
 class OpenDMLFile
 {
 public:
-				OpenDMLFile();
-				~OpenDMLFile();
+						OpenDMLFile(BPositionIO *source);
+						~OpenDMLFile();
 
-	static bool IsSupported(BPositionIO *source);
+	static bool 		IsSupported(BPositionIO *source);
 
-	status_t	SetTo(BPositionIO *source);
+	status_t			Init();
 	
-	int			StreamCount();
+	int					StreamCount();
 	
-	bigtime_t	Duration();
-	uint32		FrameCount();
+	bigtime_t			Duration();
+	uint32				FrameCount();
 	
-	bool		IsVideo(int stream_index);
-	bool		IsAudio(int stream_index);
+	bool				IsVideo(int stream_index);
+	bool				IsAudio(int stream_index);
 
 	const avi_main_header *AviMainHeader();
 
@@ -52,27 +53,14 @@
 	const bitmap_info_header *	VideoFormat(int stream_index);
 	const avi_stream_header *	StreamFormat(int stream_index);
 	
-	bool		GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe);
+	status_t			GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe);
 	
 	BPositionIO *Source() { return fSource; }
-
-private:
-	void		InitData();
-
-	bool		OdmlReadIndexChunk(int stream_index);
-	bool		OdmlReadIndexInfo(int stream_index);
-	bool		OdmlGetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe);
-
-	bool		AviGetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe);
 		
 private:
 	BPositionIO *	fSource;
 	OpenDMLParser *	fParser;
-
-	struct stream_data;
-	
-	int				fStreamCount;
-	stream_data *	fStreamData;
+	Index *			fIndex;
 };
 
 #endif

Added: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.cpp	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.cpp	2007-06-10 23:13:28 UTC (rev 21388)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2007, Marcus Overhagen
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include 
+#include 
+#include "OpenDMLIndex.h"
+
+
+OpenDMLIndex::OpenDMLIndex(BPositionIO *source, OpenDMLParser *parser)
+ :	Index(source, parser)
+{
+}
+
+
+OpenDMLIndex::~OpenDMLIndex()
+{
+}
+
+
+status_t
+OpenDMLIndex::Init()
+{
+	return B_ERROR;
+}
+
+
+status_t
+OpenDMLIndex::GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe)
+{
+	return B_ERROR;
+}
+
+
+status_t
+OpenDMLIndex::Seek(int stream_index, uint32 seekTo, int64 *frame, bigtime_t *time)
+{
+	return B_ERROR;
+}

Added: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.h
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.h	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.h	2007-06-10 23:13:28 UTC (rev 21388)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2007, Marcus Overhagen
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _OPEN_DML_INDEX_H
+#define _OPEN_DML_INDEX_H
+
+#include "Index.h"
+
+class OpenDMLIndex : public Index
+{
+public:
+						OpenDMLIndex(BPositionIO *source, OpenDMLParser *parser);
+						~OpenDMLIndex();
+
+	status_t			Init();
+
+	status_t			GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe);
+	status_t			Seek(int stream_index, uint32 seekTo, int64 *frame, bigtime_t *time);
+};
+
+#endif

Added: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.cpp	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.cpp	2007-06-10 23:13:28 UTC (rev 21388)
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2007, Marcus Overhagen
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include 
+#include 
+#include 
+#include 
+#include "ReaderPlugin.h" // B_MEDIA_*
+#include "StandardIndex.h"
+#include "OpenDMLParser.h"
+
+#include 
+
+
+struct StandardIndex::stream_data
+{
+	uint32 chunk_id;
+	uint32 pos;
+};
+
+StandardIndex::StandardIndex(BPositionIO *source, OpenDMLParser *parser)
+ :	Index(source, parser)
+ ,	fIndex(NULL)
+ ,	fIndexSize(0)
+ ,	fStreamData(NULL)
+ ,	fStreamCount(parser->StreamCount())
+ ,	fDataOffset(parser->MovieListStart() - 4)
+{
+}
+
+
+StandardIndex::~StandardIndex()
+{
+	delete [] fIndex;
+	delete [] fStreamData;
+}
+
+
+status_t
+StandardIndex::Init()
+{
+	uint32 indexBytes = fParser->StandardIndexSize();
+	fIndexSize = indexBytes / sizeof(avi_standard_index_entry);
+	indexBytes = fIndexSize * sizeof(avi_standard_index_entry);
+
+ { BStopWatch w("StandardIndex::Init: malloc");
+
+	if (indexBytes > 0x1900000) { // 25 MB
+		printf("StandardIndex::Init index is way too big\n");
+		return B_NO_MEMORY;
+	}
+
+	if (fIndexSize == 0) {
+		printf("StandardIndex::Init index is empty\n");
+		return B_NO_MEMORY;
+	}
+
+	fIndex = new (std::nothrow) avi_standard_index_entry[fIndexSize];
+	if (fIndex == NULL) {
+		printf("StandardIndex::Init out of memory\n");
+		return B_NO_MEMORY;
+	}
+}
+{ BStopWatch w("StandardIndex::Init: file read");
+
+	if (indexBytes != fSource->ReadAt(fParser->StandardIndexStart(), fIndex, indexBytes)) {
+		printf("StandardIndex::Init file reading failed\n");
+		delete [] fIndex;
+		fIndex = NULL;
+		return B_IO_ERROR;
+	}
+}
+
+	fStreamData = new stream_data[fStreamCount];
+	for (int i = 0; i < fStreamCount; i++) {
+		fStreamData[i].chunk_id = i / 10 + '0' + (i % 10 + '0') * 256;
+		fStreamData[i].pos = 0;
+	}
+	
+	//DumpIndex();
+
+	return B_OK;
+}
+
+
+void 
+StandardIndex::DumpIndex()
+{
+	uint32 chunk = fIndex->chunk_id;
+	int count = 0;
+	int pos = 0;
+
+	printf("StandardIndex::DumpIndex %u entries\n", fIndexSize);
+	for (int i = 0; i < fIndexSize; i++) {
+		count++;
+		if (chunk != fIndex[i].chunk_id) {
+			printf("%3d %c%c%c%c", count, FOURCC_PARAM(chunk));
+			chunk = fIndex[i].chunk_id;
+			count = 0;
+			if (++pos % 8 == 0)
+				printf("\n");			
+		}
+	}
+	if (count)
+		printf("%3d %c%c%c%c", count, FOURCC_PARAM(chunk));
+	printf("\n");			
+}
+
+
+status_t
+StandardIndex::GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe)
+{
+	stream_data *data = &fStreamData[stream_index];
+	while (data->pos < fIndexSize) {
+		if ((fIndex[data->pos].chunk_id & 0xffff) == data->chunk_id) {
+			*keyframe = fIndex[data->pos].flags & AVIIF_KEYFRAME;
+			*start = fDataOffset + fIndex[data->pos].chunk_offset + 8;  // skip 8 bytes (chunk id + chunk size)
+			*size = fIndex[data->pos].chunk_length;
+			data->pos++;
+			return B_OK;
+		}
+		data->pos++;
+	}
+
+	return B_ERROR;
+}
+
+
+status_t
+StandardIndex::Seek(int stream_index, uint32 seekTo, int64 *frame, bigtime_t *time)
+{
+/*
+	printf("StandardIndex::Seek: seekTo%s%s%s%s, time %Ld, frame %Ld\n",
+		(seekTo & B_MEDIA_SEEK_TO_TIME) ? " B_MEDIA_SEEK_TO_TIME" : "",
+		(seekTo & B_MEDIA_SEEK_TO_FRAME) ? " B_MEDIA_SEEK_TO_FRAME" : "",
+		(seekTo & B_MEDIA_SEEK_CLOSEST_FORWARD) ? " B_MEDIA_SEEK_CLOSEST_FORWARD" : "",
+		(seekTo & B_MEDIA_SEEK_CLOSEST_BACKWARD) ? " B_MEDIA_SEEK_CLOSEST_BACKWARD" : "");
+*/
+	return B_ERROR;
+}
+

Added: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.h
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.h	2007-06-10 20:29:44 UTC (rev 21387)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.h	2007-06-10 23:13:28 UTC (rev 21388)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2007, Marcus Overhagen
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _STANDARD_INDEX_H
+#define _STANDARD_INDEX_H
+
+#include "Index.h"
+#include "avi.h"
+
+class StandardIndex : public Index
+{
+public:
+						StandardIndex(BPositionIO *source, OpenDMLParser *parser);
+						~StandardIndex();
+
+	status_t			Init();
+
+	status_t			GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe);
+	status_t			Seek(int stream_index, uint32 seekTo, int64 *frame, bigtime_t *time);
+
+private:
+	void				DumpIndex();
+
+private:
+	struct stream_data;
+	avi_standard_index_entry *fIndex;
+	uint32				fIndexSize;
+	stream_data *		fStreamData;
+	int					fStreamCount;
+	int64				fDataOffset;
+};
+
+#endif



From hugosantos at gmail.com  Mon Jun 11 01:23:25 2007
From: hugosantos at gmail.com (Hugo Santos)
Date: Mon, 11 Jun 2007 00:23:25 +0100
Subject: [Haiku-commits] r21388 - in
	haiku/trunk/src/add-ons/media/plugins/avi_reader: . libOpenDML
In-Reply-To: <200706102313.l5ANDT5r019359@sheep.berlios.de>
References: <200706102313.l5ANDT5r019359@sheep.berlios.de>
Message-ID: <9c46321e0706101623l6fc63b5fnc5959f1b5967dfd4@mail.gmail.com>

Hey Marcus,

  Any particular reason why you are adding the license verbatim to the
source files instead of referencing the MIT license as we have been
doing? It ends up cluttering the files, specially small ones.

On 6/11/07, marcusoverhagen at BerliOS  wrote:
> +       fFile = new OpenDMLFile(pos_io_source);
> +       if (B_OK != fFile->Init()) {

  By the way, this form is sometimes used to make sure you aren't
making a mistake and assigning to a variable. I.e. "foo == 0" vs. "foo
= 0". As Init() probably isn't a valid lvalue (i'm assuming it doesn't
return a reference), it doesn't make much sense to use this form as it
is less readable. At least IMO. :-)

  Hugo


From axeld at pinc-software.de  Mon Jun 11 01:33:19 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Mon, 11 Jun 2007 01:33:19 +0200 CEST
Subject: [Haiku-commits]
 =?iso-8859-15?q?r21388_-_in_haiku/trunk/src/add-o?=
 =?iso-8859-15?q?ns/media/plugins/avi=5Freader=3A_=2E_libOpenDML?=
In-Reply-To: <9c46321e0706101623l6fc63b5fnc5959f1b5967dfd4@mail.gmail.com>
Message-ID: <36544406188-BeMail@zon>

"Hugo Santos"  wrote:
> On 6/11/07, marcusoverhagen at BerliOS <
> marcusoverhagen at mail.berlios.de> wrote:
> > +       fFile = new OpenDMLFile(pos_io_source);
> > +       if (B_OK != fFile->Init()) {
>   By the way, this form is sometimes used to make sure you aren't
> making a mistake and assigning to a variable. I.e. "foo == 0" vs. 
> "foo
> = 0". As Init() probably isn't a valid lvalue (i'm assuming it 
> doesn't
> return a reference), it doesn't make much sense to use this form as 
> it
> is less readable. At least IMO. :-)

Besides our style guide forbids it, too ;-)

Bye,
   Axel.



From leavengood at mail.berlios.de  Mon Jun 11 02:14:33 2007
From: leavengood at mail.berlios.de (leavengood at BerliOS)
Date: Mon, 11 Jun 2007 02:14:33 +0200
Subject: [Haiku-commits] r21389 - in haiku/trunk: headers/private/interface
	src/apps/showimage src/kits/interface
Message-ID: <200706110014.l5B0EX0j016409@sheep.berlios.de>

Author: leavengood
Date: 2007-06-11 02:14:32 +0200 (Mon, 11 Jun 2007)
New Revision: 21389
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21389&view=rev

Added:
   haiku/trunk/headers/private/interface/AboutWindow.h
   haiku/trunk/src/kits/interface/AboutWindow.cpp
Modified:
   haiku/trunk/src/apps/showimage/Jamfile
   haiku/trunk/src/apps/showimage/ShowImageApp.cpp
   haiku/trunk/src/kits/interface/Jamfile
Log:
Initial implementation of the common BAboutWindow class. Of course I just
realized that calling it a window may not be strictly correct since it isn't a
decendent of BWindow, but just uses a BAlert. Oh well, it can be changed if
need be.

I'm also checking in the first use of it, in ShowImage. Since ShowImage can
still be compiled for R5 I've added a #ifdef around the new BAboutWindow
related code.

I'm open for suggestions for the interface for this class, well mostly the
constructor. I'm not a big fan of having to specify the number of authors.

For now I'm making the header private, but I don't think it would be a big deal
to expose it publically.


Added: haiku/trunk/headers/private/interface/AboutWindow.h
===================================================================
--- haiku/trunk/headers/private/interface/AboutWindow.h	2007-06-10 23:13:28 UTC (rev 21388)
+++ haiku/trunk/headers/private/interface/AboutWindow.h	2007-06-11 00:14:32 UTC (rev 21389)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2007 Haiku, Inc.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *		Ryan Leavengood, leavengood at gmail.com
+ */
+#ifndef B_ABOUT_WINDOW_H
+#define B_ABOUT_WINDOW_H
+
+
+#include 
+
+
+class BAboutWindow {
+	public:
+		BAboutWindow(char *appName, int32 firstCopyrightYear,
+			int32 numAuthors, const char **authors, char *extraInfo = NULL);
+		virtual ~BAboutWindow();
+
+		void Show();
+
+	private:
+		BString* 		fAppName;
+		BString*		fText;
+};
+
+#endif	// B_ABOUT_WINDOW_H

Modified: haiku/trunk/src/apps/showimage/Jamfile
===================================================================
--- haiku/trunk/src/apps/showimage/Jamfile	2007-06-10 23:13:28 UTC (rev 21388)
+++ haiku/trunk/src/apps/showimage/Jamfile	2007-06-11 00:14:32 UTC (rev 21389)
@@ -1,6 +1,6 @@
 SubDir HAIKU_TOP src apps showimage ;
 
-UsePrivateHeaders tracker ;
+UsePrivateHeaders tracker interface ;
 
 SetSubDirSupportedPlatformsBeOSCompatible ;
 

Modified: haiku/trunk/src/apps/showimage/ShowImageApp.cpp
===================================================================
--- haiku/trunk/src/apps/showimage/ShowImageApp.cpp	2007-06-10 23:13:28 UTC (rev 21388)
+++ haiku/trunk/src/apps/showimage/ShowImageApp.cpp	2007-06-11 00:14:32 UTC (rev 21389)
@@ -14,6 +14,9 @@
 #include "ShowImageConstants.h"
 #include "ShowImageWindow.h"
 
+#ifdef HAIKU_TARGET_PLATFORM_HAIKU
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -44,9 +47,20 @@
 void
 ShowImageApp::AboutRequested()
 {
+#ifdef HAIKU_TARGET_PLATFORM_HAIKU
+	const char *authors[] = {
+		"Fernando F. Oliveira",
+		"Michael Wilber",
+		"Michael Pfeiffer",
+		"Ryan Leavengood"
+	};
+	BAboutWindow about("ShowImage", 2003, 4, authors);
+	about.Show();
+#else
 	BAlert* alert = new BAlert("About ShowImage",
 		"Haiku ShowImage\n\nby Fernando F. Oliveira, Michael Wilber, Michael Pfeiffer and Ryan Leavengood", "OK");
 	alert->Go();
+#endif
 }
 
 

Added: haiku/trunk/src/kits/interface/AboutWindow.cpp
===================================================================
--- haiku/trunk/src/kits/interface/AboutWindow.cpp	2007-06-10 23:13:28 UTC (rev 21388)
+++ haiku/trunk/src/kits/interface/AboutWindow.cpp	2007-06-11 00:14:32 UTC (rev 21389)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2007 Haiku, Inc.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *		Ryan Leavengood, leavengood at gmail.com
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+
+BAboutWindow::BAboutWindow(char *appName, int32 firstCopyrightYear,
+	int32 numAuthors, const char **authors, char *extraInfo)
+{
+	fAppName = new BString(appName);
+	fText = new BString();
+
+	// Get current year
+	time_t tp;
+	time(&tp);
+	char currentYear[5];
+	strftime(currentYear, 5, "%Y", localtime(&tp));
+
+	// Build the text to display
+	BString text(appName);
+	text << "\n\nCopyright " B_UTF8_COPYRIGHT " ";
+	text << firstCopyrightYear << "-" << currentYear << " Haiku, Inc.\n\n";
+	text << "Written by:\n";
+	for (int32 i = 0; i < numAuthors; i++) {
+		text << "    " << authors[i] << "\n";
+	}
+	if (extraInfo != NULL) {
+		text << "\n" << extraInfo << "\n";
+	}
+	fText->Adopt(text);
+}
+
+
+BAboutWindow::~BAboutWindow()
+{
+	delete fText;
+}
+
+
+void
+BAboutWindow::Show()
+{
+	BAlert *alert = new BAlert("About...", fText->String(), "Close");
+	BTextView *view = alert->TextView();
+	BFont font;
+	view->SetStylable(true);
+	view->GetFont(&font);
+	font.SetFace(B_BOLD_FACE);
+	font.SetSize(font.Size() * 1.7);
+	view->SetFontAndColor(0, fAppName->Length(), &font);
+	alert->Go();
+}
+

Modified: haiku/trunk/src/kits/interface/Jamfile
===================================================================
--- haiku/trunk/src/kits/interface/Jamfile	2007-06-10 23:13:28 UTC (rev 21388)
+++ haiku/trunk/src/kits/interface/Jamfile	2007-06-11 00:14:32 UTC (rev 21389)
@@ -37,6 +37,7 @@
 SEARCH_SOURCE += [ FDirName $(SUBDIR) layouter ] ;
 
 MergeObject interface_kit.o :
+	AboutWindow.cpp
 	AbstractLayoutItem.cpp
 	Alert.cpp
 	Alignment.cpp



From jonas at kirilla.com  Mon Jun 11 02:39:57 2007
From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=)
Date: Mon, 11 Jun 2007 02:39:57 +0200 CEST
Subject: [Haiku-commits]
 =?iso-8859-1?q?r21389_-_in_haiku/trunk=3A_headers?=
 =?iso-8859-1?q?/private/interface_src/apps/showimage__src/kits/interface?=
In-Reply-To: <200706110014.l5B0EX0j016409@sheep.berlios.de>
Message-ID: <1412564981-BeMail@kirilla>

leavengood at BerliOS  wrote:
 ... 
> Initial implementation of the common BAboutWindow class. 
> Of course I just realized that calling it a window may not be 
> strictly correct since it isn't a decendent of BWindow, but just 
> uses a BAlert. Oh well, it can be changed if need be.

BAbout would be cute. 

Is there a good reason not to subclass BAlert?

> I'm also checking in the first use of it, in ShowImage. Since 
> ShowImage can
> still be compiled for R5 I've added a #ifdef around the new 
> BAboutWindow
> related code.
> 
> I'm open for suggestions for the interface for this class, well 
> mostly the
> constructor. I'm not a big fan of having to specify the number of 
> authors.

Why not use a simple char * instead of the char ** ?

 ...
> +	font.SetSize(font.Size() * 1.7);

Bold move. Will have a look tomorrow! :)

/Jonas.



From michael.pfeiffer at utanet.at  Mon Jun 11 07:38:45 2007
From: michael.pfeiffer at utanet.at (Michael Pfeiffer)
Date: Mon, 11 Jun 2007 07:38:45 +0200
Subject: [Haiku-commits] r21389 - in haiku/trunk:
	headers/private/interface src/apps/showimage src/kits/interface
In-Reply-To: <200706110014.l5B0EX0j016409@sheep.berlios.de>
References: <200706110014.l5B0EX0j016409@sheep.berlios.de>
Message-ID: 

Am 11.06.2007, 02:14 Uhr, schrieb leavengood at BerliOS  
:


> +#ifdef HAIKU_TARGET_PLATFORM_HAIKU
> +	const char *authors[] = {
> +		"Fernando F. Oliveira",
> +		"Michael Wilber",
> +		"Michael Pfeiffer",
> +		"Ryan Leavengood"
> +	};
> +	BAboutWindow about("ShowImage", 2003, 4, authors);

To avoid updating the number of authors manually you could add something  
like this
(probably a type cast is required in the following line):
	const int32 numAuthors = sizeof(authors) / sizeof(const char *);
	BAboutWindow about("ShowImage", 2003, numAuthors, authors);

Regards,
Michael


From leavengood at gmail.com  Mon Jun 11 08:05:22 2007
From: leavengood at gmail.com (Ryan Leavengood)
Date: Mon, 11 Jun 2007 02:05:22 -0400
Subject: [Haiku-commits] r21389 - in haiku/trunk:
	headers/private/interface src/apps/showimage src/kits/interface
In-Reply-To: <1412564981-BeMail@kirilla>
References: <200706110014.l5B0EX0j016409@sheep.berlios.de>
	<1412564981-BeMail@kirilla>
Message-ID: 

On 6/10/07, Jonas Sundstr?m  wrote:
>
> BAbout would be cute.

Yeah that may work. Though BAboutWindow isn't that bad either ;)

> Is there a good reason not to subclass BAlert?

In this case I think composition is better. There really is no benefit
to subclassing in this case.

> Why not use a simple char * instead of the char ** ?

I'll look into that, though I don't know if it really matters. My
C/C++ skills are rusty (and never were all that sharp to begin
with...I have a copy of Meyers' "Effective C++" staring at me unread
on my desk...)

> Bold move. Will have a look tomorrow! :)

I found 1.5 too small, at least with the default font.

On 6/11/07, Michael Pfeiffer  wrote:
>
> To avoid updating the number of authors manually you could add something
> like this
> (probably a type cast is required in the following line):
>         const int32 numAuthors = sizeof(authors) / sizeof(const char *);
>         BAboutWindow about("ShowImage", 2003, numAuthors, authors);

That is definitely better. Though I would still prefer something
simpler that only requires the call to the constructor followed by the
call to Show(), with minimal setup required. I've considered a
va_list, except for the optional extraInfo which would need to come
before the va_list and would frequently be NULL. Still this might be
decent:

BAboutWindow about("ShowImage", 2003, NULL,
    "Fernando F. Oliveira",
    "Michael Wilber",
    "Michael Pfeiffer",
    "Ryan Leavengood");
about.Show();

Comments?

Ryan


From hugosantos at gmail.com  Mon Jun 11 09:08:35 2007
From: hugosantos at gmail.com (Hugo Santos)
Date: Mon, 11 Jun 2007 08:08:35 +0100
Subject: [Haiku-commits] r21389 - in haiku/trunk:
	headers/private/interface src/apps/showimage src/kits/interface
In-Reply-To: 
References: <200706110014.l5B0EX0j016409@sheep.berlios.de>
	<1412564981-BeMail@kirilla>
	
Message-ID: <9c46321e0706110008n55d778f4x858e7414f1d06dd9@mail.gmail.com>

Hello Ryan,

On 6/11/07, Ryan Leavengood  wrote:
> BAboutWindow about("ShowImage", 2003, NULL,
>     "Fernando F. Oliveira",
>     "Michael Wilber",
>     "Michael Pfeiffer",
>     "Ryan Leavengood");

  This is error prone. Use DRY (Don't Repeat Yourself) whenever
possible. That means not separating a list and the corresponding list
size. As an example, you have two possibilities:

  const char *authors[] = {
   "Foo", "Bar", NULL
  };

  or using a std::vector assuming the author names are immutable.

  The first one is good enough and is used a lot in other places.
Whenever iterating through the list, just stop when you see the NULL.

  for (int index = 0; authors[index]; index++) {
    // ... authors[index]
  }

  Hugo


From marcusoverhagen at arcor.de  Mon Jun 11 09:31:41 2007
From: marcusoverhagen at arcor.de (Marcus Overhagen)
Date: Mon, 11 Jun 2007 09:31:41 +0200 (CEST)
Subject: [Haiku-commits] r21388 - in
 haiku/trunk/src/add-ons/media/plugins/avi_reader: . libOpenDML
In-Reply-To: <36544406188-BeMail@zon>
References: <36544406188-BeMail@zon>
	<200706102313.l5ANDT5r019359@sheep.berlios.de>
Message-ID: <6619690.1181547101246.JavaMail.ngmail@webmail10>

Axel D?rfler wrote:
> "Hugo Santos"  wrote:

> > = 0". As Init() probably isn't a valid lvalue (i'm assuming it doesn't
> > return a reference), it doesn't make much sense to use this form as 
> > it is less readable. At least IMO. :-)
> 
> Besides our style guide forbids it, too ;-)

Would you mind if I finish avi seeking support today, 
or do you prefer that I revert r21388?

Marcus

Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren
ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: g?nstig
und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer,
nur  39,85 ?  inkl. DSL- und ISDN-Grundgeb?hr!
http://www.arcor.de/rd/emf-dsl-2


From k_lurie at gbrener.org.il  Mon Jun 11 15:27:59 2007
From: k_lurie at gbrener.org.il (Kobi Lurie)
Date: Mon, 11 Jun 2007 14:27:59 +0100
Subject: [Haiku-commits] r21374 - haiku/trunk/build/jam
References: <3714340203-BeMail@kirilla>
Message-ID: 

in my opinion, the distinction can usually be made by what the program does.
if it does just one thing, it's a utility, like Expander
if it's a paint program with multiple features or more precisely multiple outputs, then it's an application.
if an email program was only a viewer with the message (in beos it would be a filename) as a launch argument, then it would be a utility.
(DiskProbe is a utility, even though it has features - they're all aimed at producing the same result)

that's how I see this matter, 
hope this helps. Kobi

---------- Original Message ----------
To: SVN commits to the Haiku source repository (haiku-commits at lists.berlios.de)
From: Jonas Sundstr?m (jonas at kirilla.com)
Subject: Re: [Haiku-commits] r21374 - haiku/trunk/build/jam
Date: 10/6/2007 4:04:14p

> stippi at BerliOS  wrote:
> > Author: stippi
> > Date: 2007-06-09 14:07:55 +0200 (Sat, 09 Jun 2007)
> > New Revision: 21374
> > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21374&view=rev
> > 
> > Modified:
> >    haiku/trunk/build/jam/HaikuImage
> > Log:
> > * cleanup in the Leaf menu: Applications is no longer a link to
> >   /boot/beos/apps, but a folder containing links to _selected_
> >   apps in that folder
> 
> Thumbs up. :)
> 
> > * a new entry "Desktop Applets" has been added, which contains
> >   all the apps that you either do or do not start at system boot,
> >   but don't need frequent access to
> 
> I don't think its a good idea to expose people to more tech lingo such 
> as Replicants, Desktop Applets, etc. We should try to simpify.
> 
> Have you considered the name Utilities? It would fit and would also 
> cover some of the tools that might come in the future and that won't be 
> -Applications- in the sense that WonderBrush is. 
> 
> http://rocbo.lautre.net/macos_X/se/applic.html
> GIMP, FireFox, iPhoto, are applications. The ones in the second 
> picture, including Terminal, are utilities. In MacOS X, FWIW.
> 
> I don't mean that Utilities should be a subfolder of Applications in 
> Deskbar. Just pointing out the classification/organization of programs 
> as either Applications or Utilities.
> 
> > * some apps have been hidden:
> >   - ShowImage and Expander are usually not
> >     directly started on their own, but through double clicking 
> > documents
> 
> IMO, ShowImage and Expander would be utilities.
> 
> >   - AboutSystem is invoked elsewhere from the Leaf menu,
> >   so it doesn't need to clutter the Applications menu
> 
> Not sure how to classify AboutSystem. BApplication as it may be, it's 
> neither "application" nor utility. It's more like part of the "system", 
> so I would put it alongside Tracker and Deskbar. :P
> 
> > * we almost introduced a third category for rarely used apps, but in 
> > the
> >   end it would only have contained Installer, Icon-O-Matic and 
> > Diskprobe,
> >   and we felt that it is ok to leave these in the Applications menu, 
> > as long
> >   as their number is small
> 
> These too would be utilities to me, but I suppose it depends on who you 
> are and how you use your computer. Maybe there's someone out there who 
> uses DiskProbe all day long.
> 
> /Jonas.
> 
> _______________________________________________
> Haiku-commits mailing list
> Haiku-commits at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/haiku-commits






From niels.reedijk at gmail.com  Mon Jun 11 15:17:08 2007
From: niels.reedijk at gmail.com (Niels Reedijk)
Date: Mon, 11 Jun 2007 15:17:08 +0200
Subject: [Haiku-commits] r21389 - in haiku/trunk:
	headers/private/interface src/apps/showimage src/kits/interface
In-Reply-To: <200706110014.l5B0EX0j016409@sheep.berlios.de>
References: <200706110014.l5B0EX0j016409@sheep.berlios.de>
Message-ID: <507d86c0706110617t3b80d19enea558d5a996cc47b@mail.gmail.com>

2007/6/11, leavengood at BerliOS :
> Author: leavengood
> Date: 2007-06-11 02:14:32 +0200 (Mon, 11 Jun 2007)
> New Revision: 21389
> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21389&view=rev
>
> Added:
>    haiku/trunk/headers/private/interface/AboutWindow.h
>    haiku/trunk/src/kits/interface/AboutWindow.cpp
> Modified:
>    haiku/trunk/src/apps/showimage/Jamfile
>    haiku/trunk/src/apps/showimage/ShowImageApp.cpp
>    haiku/trunk/src/kits/interface/Jamfile

Hi,

I think this class should not be in libbe, but rather in the shared
source subdirectory. Even though it might inflate the binaries a bit,
it will not be a bit deal. Judging by the discussion on the mailing
list, it isn't (yet) intended as public API, and as such, it should
not be in libbe (unlike the new layout api, which is private, but
which touches libbe directly). We can always move it to the public
headers post-R1, if for some reason this window should be standardized
for everyone.

Niels


From leavengood at gmail.com  Mon Jun 11 15:53:01 2007
From: leavengood at gmail.com (Ryan Leavengood)
Date: Mon, 11 Jun 2007 09:53:01 -0400
Subject: [Haiku-commits] r21389 - in haiku/trunk:
	headers/private/interface src/apps/showimage src/kits/interface
In-Reply-To: <9c46321e0706110008n55d778f4x858e7414f1d06dd9@mail.gmail.com>
References: <200706110014.l5B0EX0j016409@sheep.berlios.de>
	<1412564981-BeMail@kirilla>
	
	<9c46321e0706110008n55d778f4x858e7414f1d06dd9@mail.gmail.com>
Message-ID: 

On 6/11/07, Hugo Santos  wrote:
>
>   This is error prone.

Using va_lists is error prone? I'm not terribly surprised. I suppose
because each argument has to be gotten as the right type by va_arg and
there is no guarantee by the compiler that someone is passing the
right types.

> Use DRY (Don't Repeat Yourself) whenever
> possible. That means not separating a list and the corresponding list
> size.

Yeah I'm a big fan of DRY which is why I asked about getting rid of
the number of authors.

> As an example, you have two possibilities:
>
>   const char *authors[] = {
>    "Foo", "Bar", NULL
>   };

I briefly thought of using a null terminated list when I first
implemented this. I wasn't sure it was a standard practice in our
code, but if it is it sounds like the best option.

>   or using a std::vector assuming the author names are immutable.

I'd rather not have to introduce the use of a std::vector in the
interface to a class in our code, since this doesn't seem to be done
anywhere else.

>   The first one is good enough and is used a lot in other places.
> Whenever iterating through the list, just stop when you see the NULL.
>
>   for (int index = 0; authors[index]; index++) {
>     // ... authors[index]
>   }

Yeah that should work.

Ryan


From hugosantos at gmail.com  Mon Jun 11 17:21:03 2007
From: hugosantos at gmail.com (Hugo Santos)
Date: Mon, 11 Jun 2007 16:21:03 +0100
Subject: [Haiku-commits] r21389 - in haiku/trunk:
	headers/private/interface src/apps/showimage src/kits/interface
In-Reply-To: 
References: <200706110014.l5B0EX0j016409@sheep.berlios.de>
	<1412564981-BeMail@kirilla>
	
	<9c46321e0706110008n55d778f4x858e7414f1d06dd9@mail.gmail.com>
	
Message-ID: <9c46321e0706110821p4a135bdbtc951f936798f0531@mail.gmail.com>

On 6/11/07, Ryan Leavengood  wrote:
> Using va_lists is error prone? I'm not terribly surprised. I suppose

  Sorry, i replied to the wrong mail. I meant that using (pointer,
count) is error prone. One could argue that a null terminated list is
also error prone, but usually the problem is clearer when debugging.

  Hugo


From leavengood at gmail.com  Mon Jun 11 18:32:11 2007
From: leavengood at gmail.com (Ryan Leavengood)
Date: Mon, 11 Jun 2007 12:32:11 -0400
Subject: [Haiku-commits] r21389 - in haiku/trunk:
	headers/private/interface src/apps/showimage src/kits/interface
In-Reply-To: <9c46321e0706110821p4a135bdbtc951f936798f0531@mail.gmail.com>
References: <200706110014.l5B0EX0j016409@sheep.berlios.de>
	<1412564981-BeMail@kirilla>
	
	<9c46321e0706110008n55d778f4x858e7414f1d06dd9@mail.gmail.com>
	
	<9c46321e0706110821p4a135bdbtc951f936798f0531@mail.gmail.com>
Message-ID: 

On 6/11/07, Hugo Santos  wrote:
> On 6/11/07, Ryan Leavengood  wrote:
> > Using va_lists is error prone? I'm not terribly surprised. I suppose
>
>   Sorry, i replied to the wrong mail. I meant that using (pointer,
> count) is error prone. One could argue that a null terminated list is
> also error prone, but usually the problem is clearer when debugging.

Well practically everything is error-prone, hehehe, we just want to
minimize the chance of simple errors. What is your opinion on using a
va_list for the authors?

Sorry if this is approaching the level of "too much discussion" :)

Ryan


From umccullough at gmail.com  Mon Jun 11 18:37:58 2007
From: umccullough at gmail.com (Urias McCullough)
Date: Mon, 11 Jun 2007 09:37:58 -0700
Subject: [Haiku-commits] r21389 - in haiku/trunk:
	headers/private/interface src/apps/showimage src/kits/interface
In-Reply-To: <507d86c0706110617t3b80d19enea558d5a996cc47b@mail.gmail.com>
References: <200706110014.l5B0EX0j016409@sheep.berlios.de>
	<507d86c0706110617t3b80d19enea558d5a996cc47b@mail.gmail.com>
Message-ID: <1e80d8750706110937s10ce47d3r908e92138cf285f6@mail.gmail.com>

On 6/11/07, Niels Reedijk  wrote:
> I think this class should not be in libbe, but rather in the shared
> source subdirectory. Even though it might inflate the binaries a bit,


I agree - and that should prevent the need for all the #ifdef logic as
well, correct?


From leavengood at gmail.com  Mon Jun 11 18:45:34 2007
From: leavengood at gmail.com (Ryan Leavengood)
Date: Mon, 11 Jun 2007 12:45:34 -0400
Subject: [Haiku-commits] r21389 - in haiku/trunk:
	headers/private/interface src/apps/showimage src/kits/interface
In-Reply-To: <1e80d8750706110937s10ce47d3r908e92138cf285f6@mail.gmail.com>
References: <200706110014.l5B0EX0j016409@sheep.berlios.de>
	<507d86c0706110617t3b80d19enea558d5a996cc47b@mail.gmail.com>
	<1e80d8750706110937s10ce47d3r908e92138cf285f6@mail.gmail.com>
Message-ID: 

On 6/11/07, Urias McCullough  wrote:
> On 6/11/07, Niels Reedijk  wrote:
> > I think this class should not be in libbe, but rather in the shared
> > source subdirectory. Even though it might inflate the binaries a bit,
> 
>
> I agree - and that should prevent the need for all the #ifdef logic as
> well, correct?

Yeah this is a tiny bit of code and would alleviate the need for the
#ifdef. Unless anyone else objects, I'm fine with this and will make
the change tonight.

Ryan


From axeld at pinc-software.de  Mon Jun 11 18:49:51 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Mon, 11 Jun 2007 18:49:51 +0200 CEST
Subject: [Haiku-commits]
 =?iso-8859-15?q?r21389_-_in_haiku/trunk=3A_header?=
 =?iso-8859-15?q?s/private/interface_src/apps/showimage__src/kits/interfac?=
 =?iso-8859-15?q?e?=
In-Reply-To: <200706110014.l5B0EX0j016409@sheep.berlios.de>
Message-ID: <1870336858-BeMail@ibm>

leavengood at BerliOS  wrote:
> Added:
>    haiku/trunk/headers/private/interface/AboutWindow.h
>    haiku/trunk/src/kits/interface/AboutWindow.cpp

Please move these files to src/shared and headers/shared. And if you 
wanted to introduce private API to a public shared library, please use 
the BPrivate namespace for this.

Bye,
   Axel.



From leavengood at gmail.com  Mon Jun 11 18:58:18 2007
From: leavengood at gmail.com (Ryan Leavengood)
Date: Mon, 11 Jun 2007 12:58:18 -0400
Subject: [Haiku-commits] r21389 - in haiku/trunk:
	headers/private/interface src/apps/showimage src/kits/interface
In-Reply-To: <1870336858-BeMail@ibm>
References: <200706110014.l5B0EX0j016409@sheep.berlios.de>
	<1870336858-BeMail@ibm>
Message-ID: 

On 6/11/07, Axel D?rfler  wrote:
>
> Please move these files to src/shared and headers/shared.

Yeah I will do that tonight.

> And if you wanted to introduce private API to a public shared
> library, please use the BPrivate namespace for this.

Cool, will do in the future. Is this kind of stuff documented anywhere
for future developers? If not, maybe it could be added in the coding
guidelines or something.

Ryan


From axeld at mail.berlios.de  Mon Jun 11 21:11:48 2007
From: axeld at mail.berlios.de (axeld at BerliOS)
Date: Mon, 11 Jun 2007 21:11:48 +0200
Subject: [Haiku-commits] r21390 - haiku/trunk/src/add-ons/accelerants/radeon
Message-ID: <200706111911.l5BJBmYo015534@sheep.berlios.de>

Author: axeld
Date: 2007-06-11 21:11:48 +0200 (Mon, 11 Jun 2007)
New Revision: 21390
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21390&view=rev

Modified:
   haiku/trunk/src/add-ons/accelerants/radeon/overlay.c
Log:
Fixed overlay distortions on Radeon cards introduced with r20277.


Modified: haiku/trunk/src/add-ons/accelerants/radeon/overlay.c
===================================================================
--- haiku/trunk/src/add-ons/accelerants/radeon/overlay.c	2007-06-11 00:14:32 UTC (rev 21389)
+++ haiku/trunk/src/add-ons/accelerants/radeon/overlay.c	2007-06-11 19:11:48 UTC (rev 21390)
@@ -1,7 +1,6 @@
 /*
 	Copyright (c) 2002-2004, Thomas Kurschel
 	
-
 	Part of Radeon accelerant
 		
 	Hardware access routines for overlays
@@ -620,7 +619,6 @@
 	dest_right -= vc->mode.h_display_start + crtc->rel_x;
 	dest_bottom -= vc->mode.v_display_start + crtc->rel_y;
 
-	
 	// clip to visible area
 	if( dest_left < 0 ) {
 		src_left += -dest_left * src_h_inc;
@@ -889,7 +887,7 @@
 	scale_ctrl = RADEON_SCALER_ENABLE | 
 		RADEON_SCALER_DOUBLE_BUFFER | 
 		(node->ati_space << 8) | 
-		RADEON_SCALER_ADAPTIVE_DEINT |
+		/* RADEON_SCALER_ADAPTIVE_DEINT | */
 		RADEON_SCALER_BURST_PER_PLANE |
 		(crtc->crtc_idx == 0 ? 0 : RADEON_SCALER_CRTC_SEL );
 		



From leavengood at mail.berlios.de  Tue Jun 12 05:54:08 2007
From: leavengood at mail.berlios.de (leavengood at BerliOS)
Date: Tue, 12 Jun 2007 05:54:08 +0200
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
	headers/private/interface headers/shared src
	src/apps/showimage src/kits/interface src/shared
Message-ID: <200706120354.l5C3s8NI000496@sheep.berlios.de>

Author: leavengood
Date: 2007-06-12 05:54:07 +0200 (Tue, 12 Jun 2007)
New Revision: 21391
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21391&view=rev

Added:
   haiku/trunk/headers/shared/
   haiku/trunk/headers/shared/AboutWindow.h
   haiku/trunk/src/shared/
   haiku/trunk/src/shared/AboutWindow.cpp
Removed:
   haiku/trunk/headers/private/interface/AboutWindow.h
   haiku/trunk/src/kits/interface/AboutWindow.cpp
Modified:
   haiku/trunk/build/jam/FileRules
   haiku/trunk/build/jam/HeadersRules
   haiku/trunk/src/apps/showimage/Jamfile
   haiku/trunk/src/apps/showimage/ShowImageApp.cpp
   haiku/trunk/src/kits/interface/Jamfile
Log:
Moved the BAboutWindow implementation to the shared source directory, which
despite being talked about repeatedly, does not currently exist.

Adding this required adding some new Jam rules to deal with this shared source
directory and headers. I had some fun figuring this out. Despite writing
articles about Jam in the Haiku newsletter a few years ago I still find Jam to
be a PITA at times.

But my solution seems to work pretty well. Basically you just call the rule
UseSharedSource and pass the name of the shared source file you want to use.
This rule sets up the header directories and the right Jam variables for the
source file. You then add the source file to the source list in the Application
rule like any other source file.

I also made the authors list sent to the about window constructor null
terminated instead of passing the size of the array, as suggested by Hugo.


Modified: haiku/trunk/build/jam/FileRules
===================================================================
--- haiku/trunk/build/jam/FileRules	2007-06-11 19:11:48 UTC (rev 21390)
+++ haiku/trunk/build/jam/FileRules	2007-06-12 03:54:07 UTC (rev 21391)
@@ -249,3 +249,15 @@
 	$(2[1]) --data $(2[3]) $(1) &&
 	$(2[2]) $(1) ${revision}
 }
+
+rule UseSharedSource
+{
+	UseSharedHeaders ;
+
+	for file in $(1) {
+		local gristed_file = [ FGristFiles $(file) ] ;
+		SEARCH on $(gristed_file) = [ FDirName $(HAIKU_TOP) src shared ] ;
+		LOCATE on $(gristed_file) = [ FDirName $(HAIKU_TOP) src shared ] ;
+		SEARCH_SOURCE on $(gristed_file) = [ FDirName $(HAIKU_TOP) src shared ] ;
+	}
+}

Modified: haiku/trunk/build/jam/HeadersRules
===================================================================
--- haiku/trunk/build/jam/HeadersRules	2007-06-11 19:11:48 UTC (rev 21390)
+++ haiku/trunk/build/jam/HeadersRules	2007-06-12 03:54:07 UTC (rev 21391)
@@ -338,6 +338,11 @@
 	SourceSysHdrs $(1) : [ FDirName $(HAIKU_TOP) headers legacy ] : $(2) ;
 }
 
+rule UseSharedHeaders
+{
+	UseHeaders [ FDirName $(HAIKU_TOP) headers shared ] ;
+}
+
 rule FStandardOSHeaders
 {
 	local osIncludes = add-ons add-ons/file_system add-ons/graphics

Deleted: haiku/trunk/headers/private/interface/AboutWindow.h

Added: haiku/trunk/headers/shared/AboutWindow.h
===================================================================
--- haiku/trunk/headers/shared/AboutWindow.h	2007-06-11 19:11:48 UTC (rev 21390)
+++ haiku/trunk/headers/shared/AboutWindow.h	2007-06-12 03:54:07 UTC (rev 21391)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2007 Haiku, Inc.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *		Ryan Leavengood, leavengood at gmail.com
+ */
+#ifndef B_ABOUT_WINDOW_H
+#define B_ABOUT_WINDOW_H
+
+
+#include 
+
+
+class BAboutWindow {
+	public:
+		BAboutWindow(char *appName, int32 firstCopyrightYear,
+			const char **authors, char *extraInfo = NULL);
+		virtual ~BAboutWindow();
+
+		void Show();
+
+	private:
+		BString* 		fAppName;
+		BString*		fText;
+};
+
+#endif	// B_ABOUT_WINDOW_H

Modified: haiku/trunk/src/apps/showimage/Jamfile
===================================================================
--- haiku/trunk/src/apps/showimage/Jamfile	2007-06-11 19:11:48 UTC (rev 21390)
+++ haiku/trunk/src/apps/showimage/Jamfile	2007-06-12 03:54:07 UTC (rev 21391)
@@ -1,10 +1,13 @@
 SubDir HAIKU_TOP src apps showimage ;
 
-UsePrivateHeaders tracker interface ;
+UsePrivateHeaders tracker ;
 
 SetSubDirSupportedPlatformsBeOSCompatible ;
 
+UseSharedSource AboutWindow.cpp ;
+
 Application ShowImage :
+	AboutWindow.cpp
 	ShowImageApp.cpp
 	ShowImageSettings.cpp
 	ShowImageStatusView.cpp

Modified: haiku/trunk/src/apps/showimage/ShowImageApp.cpp
===================================================================
--- haiku/trunk/src/apps/showimage/ShowImageApp.cpp	2007-06-11 19:11:48 UTC (rev 21390)
+++ haiku/trunk/src/apps/showimage/ShowImageApp.cpp	2007-06-12 03:54:07 UTC (rev 21391)
@@ -10,13 +10,11 @@
  */
 
 
+#include "AboutWindow.h" // Shared source
 #include "ShowImageApp.h"
 #include "ShowImageConstants.h"
 #include "ShowImageWindow.h"
 
-#ifdef HAIKU_TARGET_PLATFORM_HAIKU
-#include 
-#endif
 #include 
 #include 
 #include 
@@ -47,20 +45,15 @@
 void
 ShowImageApp::AboutRequested()
 {
-#ifdef HAIKU_TARGET_PLATFORM_HAIKU
 	const char *authors[] = {
 		"Fernando F. Oliveira",
 		"Michael Wilber",
 		"Michael Pfeiffer",
-		"Ryan Leavengood"
+		"Ryan Leavengood",
+		NULL
 	};
-	BAboutWindow about("ShowImage", 2003, 4, authors);
+	BAboutWindow about("ShowImage", 2003, authors);
 	about.Show();
-#else
-	BAlert* alert = new BAlert("About ShowImage",
-		"Haiku ShowImage\n\nby Fernando F. Oliveira, Michael Wilber, Michael Pfeiffer and Ryan Leavengood", "OK");
-	alert->Go();
-#endif
 }
 
 

Deleted: haiku/trunk/src/kits/interface/AboutWindow.cpp

Modified: haiku/trunk/src/kits/interface/Jamfile
===================================================================
--- haiku/trunk/src/kits/interface/Jamfile	2007-06-11 19:11:48 UTC (rev 21390)
+++ haiku/trunk/src/kits/interface/Jamfile	2007-06-12 03:54:07 UTC (rev 21391)
@@ -37,7 +37,6 @@
 SEARCH_SOURCE += [ FDirName $(SUBDIR) layouter ] ;
 
 MergeObject interface_kit.o :
-	AboutWindow.cpp
 	AbstractLayoutItem.cpp
 	Alert.cpp
 	Alignment.cpp

Added: haiku/trunk/src/shared/AboutWindow.cpp
===================================================================
--- haiku/trunk/src/shared/AboutWindow.cpp	2007-06-11 19:11:48 UTC (rev 21390)
+++ haiku/trunk/src/shared/AboutWindow.cpp	2007-06-12 03:54:07 UTC (rev 21391)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2007 Haiku, Inc.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *		Ryan Leavengood, leavengood at gmail.com
+ */
+
+#include "AboutWindow.h"
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+
+BAboutWindow::BAboutWindow(char *appName, int32 firstCopyrightYear,
+	const char **authors, char *extraInfo)
+{
+	fAppName = new BString(appName);
+	fText = new BString();
+
+	// Get current year
+	time_t tp;
+	time(&tp);
+	char currentYear[5];
+	strftime(currentYear, 5, "%Y", localtime(&tp));
+
+	// Build the text to display
+	BString text(appName);
+	text << "\n\nCopyright " B_UTF8_COPYRIGHT " ";
+	text << firstCopyrightYear << "-" << currentYear << " Haiku, Inc.\n\n";
+	text << "Written by:\n";
+	for (int32 i = 0; authors[i]; i++) {
+		text << "    " << authors[i] << "\n";
+	}
+	
+	// The extra information is optional
+	if (extraInfo != NULL) {
+		text << "\n" << extraInfo << "\n";
+	}
+
+	fText->Adopt(text);
+}
+
+
+BAboutWindow::~BAboutWindow()
+{
+	delete fText;
+}
+
+
+void
+BAboutWindow::Show()
+{
+	BAlert *alert = new BAlert("About...", fText->String(), "Close");
+	BTextView *view = alert->TextView();
+	BFont font;
+	view->SetStylable(true);
+	view->GetFont(&font);
+	font.SetFace(B_BOLD_FACE);
+	font.SetSize(font.Size() * 1.7);
+	view->SetFontAndColor(0, fAppName->Length(), &font);
+	alert->Go();
+}
+



From leavengood at mail.berlios.de  Tue Jun 12 06:02:51 2007
From: leavengood at mail.berlios.de (leavengood at BerliOS)
Date: Tue, 12 Jun 2007 06:02:51 +0200
Subject: [Haiku-commits] r21392 - haiku/trunk/src/apps/showimage
Message-ID: <200706120402.l5C42pJT001076@sheep.berlios.de>

Author: leavengood
Date: 2007-06-12 06:02:50 +0200 (Tue, 12 Jun 2007)
New Revision: 21392
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21392&view=rev

Modified:
   haiku/trunk/src/apps/showimage/ShowImageView.cpp
Log:
The zoom level needed to be reset to 1.0 after loading an image, otherwise it
would keep the zoom level of the previous image in some cases.


Modified: haiku/trunk/src/apps/showimage/ShowImageView.cpp
===================================================================
--- haiku/trunk/src/apps/showimage/ShowImageView.cpp	2007-06-12 03:54:07 UTC (rev 21391)
+++ haiku/trunk/src/apps/showimage/ShowImageView.cpp	2007-06-12 04:02:50 UTC (rev 21392)
@@ -593,6 +593,7 @@
 		fCaption << ", " << fDocumentIndex << "/" << fDocumentCount;
 
 	fCaption << ", " << fImageType;
+	fZoom = 1.0;
 
 	AddToRecentDocuments();
 
@@ -1001,6 +1002,7 @@
 		}
 		DrawSelectionBox();
 	}
+	printf("fZoom is %f\n", fZoom);
 }
 
 



From leavengood at mail.berlios.de  Tue Jun 12 06:05:14 2007
From: leavengood at mail.berlios.de (leavengood at BerliOS)
Date: Tue, 12 Jun 2007 06:05:14 +0200
Subject: [Haiku-commits] r21393 - haiku/trunk/src/apps/showimage
Message-ID: <200706120405.l5C45EUd001290@sheep.berlios.de>

Author: leavengood
Date: 2007-06-12 06:05:13 +0200 (Tue, 12 Jun 2007)
New Revision: 21393
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21393&view=rev

Modified:
   haiku/trunk/src/apps/showimage/ShowImageView.cpp
Log:
Remove debugging printf.


Modified: haiku/trunk/src/apps/showimage/ShowImageView.cpp
===================================================================
--- haiku/trunk/src/apps/showimage/ShowImageView.cpp	2007-06-12 04:02:50 UTC (rev 21392)
+++ haiku/trunk/src/apps/showimage/ShowImageView.cpp	2007-06-12 04:05:13 UTC (rev 21393)
@@ -1002,7 +1002,6 @@
 		}
 		DrawSelectionBox();
 	}
-	printf("fZoom is %f\n", fZoom);
 }
 
 



From superstippi at gmx.de  Tue Jun 12 10:54:53 2007
From: superstippi at gmx.de (Stephan Assmus)
Date: Tue, 12 Jun 2007 10:54:53 +0200
Subject: [Haiku-commits] r21392 - haiku/trunk/src/apps/showimage
In-Reply-To: <200706120402.l5C42pJT001076@sheep.berlios.de>
References: <200706120402.l5C42pJT001076@sheep.berlios.de>
Message-ID: <20070612105453.400.1@stippis.mindwork.office>


leavengood at BerliOS wrote (2007-06-12, 06:02:51 [+0200]):
> Author: leavengood
> Date: 2007-06-12 06:02:50 +0200 (Tue, 12 Jun 2007)
> New Revision: 21392
> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21392&view=rev
> 
> Modified:
>    haiku/trunk/src/apps/showimage/ShowImageView.cpp
> Log:
> The zoom level needed to be reset to 1.0 after loading an image, otherwise 
> it would keep the zoom level of the previous image in some cases.

I know this might be out of scope, but I actually liked this feature in some 
cases. Could we make this "optional"? Like if the new picture has the same 
resolution, and I'm holding down some additional modifier when I switch to a 
new picture, it doesn't mess with the zoom and view region? I like this very 
much when comparing images, especially looking at certain details.

Best regards,
-Stephan


From jackburton at mail.berlios.de  Tue Jun 12 11:10:09 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Tue, 12 Jun 2007 11:10:09 +0200
Subject: [Haiku-commits] r21394 - in haiku/trunk: headers/os/interface
	src/kits/interface
Message-ID: <200706120910.l5C9A9Cd004266@sheep.berlios.de>

Author: jackburton
Date: 2007-06-12 11:10:08 +0200 (Tue, 12 Jun 2007)
New Revision: 21394
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21394&view=rev

Modified:
   haiku/trunk/headers/os/interface/Menu.h
   haiku/trunk/src/kits/interface/Menu.cpp
   haiku/trunk/src/kits/interface/MenuItem.cpp
   haiku/trunk/src/kits/interface/PopUpMenu.cpp
Log:
Some work on menu layouts:
- Menus are generally a bit wider (BeIDE ones didn't look nice)
- The modifiers bitmap are drawn more centered vertically
- Splitted BMenu::ComputeLayout() into three methods
- Various minor changes.
The menuitems still don't look nice with bigger font sizes, but we'll 
try to fix this...


Modified: haiku/trunk/headers/os/interface/Menu.h
===================================================================
--- haiku/trunk/headers/os/interface/Menu.h	2007-06-12 04:05:13 UTC (rev 21393)
+++ haiku/trunk/headers/os/interface/Menu.h	2007-06-12 09:10:08 UTC (rev 21394)
@@ -17,7 +17,7 @@
 #include 
 
 /*----------------------------------------------------------------*/
-/*----- Menu decalrations and structures -------------------------*/
+/*----- Menu declarations and structures -------------------------*/
 
 class BMenuItem;
 class BMenuBar;
@@ -204,6 +204,10 @@
 		void		LayoutItems(int32 index);
 		void		ComputeLayout(int32 index, bool bestFit, bool moveItems,
 								  float* width, float* height);
+		void		_ComputeColumnLayout(int32 index, bool bestFit, bool moveItems, BRect &outRect);
+		void		_ComputeRowLayout(int32 index, bool bestFit, bool moveItems, BRect &outRect);		
+		void		_ComputeMatrixLayout(BRect &outRect);
+
 		BRect		Bump(BRect current, BPoint extent, int32 index) const;
 		BPoint		ItemLocInRect(BRect frame) const;
 		BRect		CalcFrame(BPoint where, bool *scrollOn);

Modified: haiku/trunk/src/kits/interface/Menu.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Menu.cpp	2007-06-12 04:05:13 UTC (rev 21393)
+++ haiku/trunk/src/kits/interface/Menu.cpp	2007-06-12 09:10:08 UTC (rev 21394)
@@ -1530,90 +1530,19 @@
 	// Recalculate only the needed items,
 	// not the whole layout every time
 
-	BRect frame(0, 0, 0, 0);
-	float iWidth, iHeight;
-	BMenuItem *item = NULL;
-	
-	BFont font;
-	GetFont(&font);
+	BRect frame(0, 0, 0, 0);	
 	switch (fLayout) {
 		case B_ITEMS_IN_COLUMN:
-		{
-			for (int32 i = 0; i < fItems.CountItems(); i++) {
-				item = ItemAt(i);	
-				if (item != NULL) {
-					item->GetContentSize(&iWidth, &iHeight);
-
-					if (item->fModifiers && item->fShortcutChar)
-						iWidth += 2 * font.Size();
-					if (item->fSubmenu != NULL)
-						iWidth += 2 * font.Size();
-
-					item->fBounds.left = 0.0f;
-					item->fBounds.top = frame.bottom;
-					item->fBounds.bottom = item->fBounds.top + iHeight + fPad.top + fPad.bottom;
-
-					frame.right = max_c(frame.right, iWidth + fPad.left + fPad.right);
-					frame.bottom = item->fBounds.bottom + 1.0f;
-				}
-			}
-			if (fMaxContentWidth > 0)
-				frame.right = min_c(frame.right, fMaxContentWidth);
-
-			if (moveItems) {
-				for (int32 i = 0; i < fItems.CountItems(); i++)
-					ItemAt(i)->fBounds.right = frame.right;
-			}
-			frame.right = ceilf(frame.right);
-			frame.bottom--;
+			_ComputeColumnLayout(index, bestFit, moveItems, frame);
 			break;
-		}
 
 		case B_ITEMS_IN_ROW:
-		{
-			font_height fh;
-			GetFontHeight(&fh);
-			frame = BRect(0.0f, 0.0f, 0.0f,	ceilf(fh.ascent + fh.descent + fPad.top + fPad.bottom));	
-
-			for (int32 i = 0; i < fItems.CountItems(); i++) {
-				item = ItemAt(i);
-				if (item != NULL) {
-					item->GetContentSize(&iWidth, &iHeight);
-
-					item->fBounds.left = frame.right;
-					item->fBounds.top = 0.0f;
-					item->fBounds.right = item->fBounds.left + iWidth + fPad.left + fPad.right;
-
-					frame.right = item->Frame().right + 1.0f;
-					frame.bottom = max_c(frame.bottom, iHeight + fPad.top + fPad.bottom);
-				}
-			}
-			
-			if (moveItems) {
-				for (int32 i = 0; i < fItems.CountItems(); i++)
-					ItemAt(i)->fBounds.bottom = frame.bottom;			
-			}
-			
-			if (bestFit)
-				frame.right = ceilf(frame.right);
-			else
-				frame.right = Bounds().right;
+			_ComputeRowLayout(index, bestFit, moveItems, frame);
 			break;
-		}
 
 		case B_ITEMS_IN_MATRIX:
-		{
-			for (int32 i = 0; i < CountItems(); i++) {
-				item = ItemAt(i);
-				if (item != NULL) {
-					frame.left = min_c(frame.left, item->Frame().left);
-					frame.right = max_c(frame.right, item->Frame().right);
-					frame.top = min_c(frame.top, item->Frame().top);
-					frame.bottom = max_c(frame.bottom, item->Frame().bottom);
-				}			
-			}		
+			_ComputeMatrixLayout(frame);	
 			break;
-		}
 
 		default:
 			break;
@@ -1640,6 +1569,99 @@
 }
 
 
+void
+BMenu::_ComputeColumnLayout(int32 index, bool bestFit, bool moveItems, BRect &frame)
+{
+	BFont font;
+	GetFont(&font);
+	for (int32 i = 0; i < fItems.CountItems(); i++) {
+		BMenuItem *item = ItemAt(i);	
+		if (item != NULL) {
+			float iWidth, iHeight;			
+			item->GetContentSize(&iWidth, &iHeight);
+
+			if (item->fModifiers && item->fShortcutChar) {
+				iWidth += font.Size();
+				if (item->fModifiers & B_COMMAND_KEY)
+					iWidth += 15;
+				if (item->fModifiers & B_CONTROL_KEY)
+					iWidth += 15;
+				if (item->fModifiers & B_SHIFT_KEY)
+					iWidth += 20;				
+			}
+
+			item->fBounds.left = 0.0f;
+			item->fBounds.top = frame.bottom;
+			item->fBounds.bottom = item->fBounds.top + iHeight + fPad.top + fPad.bottom;
+
+			if (item->fSubmenu != NULL)
+				iWidth += item->Frame().Height();
+
+			frame.right = max_c(frame.right, iWidth + fPad.left + fPad.right);
+			frame.bottom = item->fBounds.bottom + 1.0f;
+		}
+	}
+	if (fMaxContentWidth > 0)
+		frame.right = min_c(frame.right, fMaxContentWidth);
+
+	if (moveItems) {
+		for (int32 i = 0; i < fItems.CountItems(); i++)
+			ItemAt(i)->fBounds.right = frame.right;
+	}
+	frame.right = ceilf(frame.right);
+	frame.bottom--;	
+}
+
+
+void
+BMenu::_ComputeRowLayout(int32 index, bool bestFit, bool moveItems, BRect &frame)
+{
+	font_height fh;
+	GetFontHeight(&fh);
+	frame = BRect(0.0f, 0.0f, 0.0f,	ceilf(fh.ascent + fh.descent + fPad.top + fPad.bottom));	
+
+	for (int32 i = 0; i < fItems.CountItems(); i++) {
+		BMenuItem *item = ItemAt(i);
+		float iWidth, iHeight;
+		if (item != NULL) {
+			item->GetContentSize(&iWidth, &iHeight);
+
+			item->fBounds.left = frame.right;
+			item->fBounds.top = 0.0f;
+			item->fBounds.right = item->fBounds.left + iWidth + fPad.left + fPad.right;
+
+			frame.right = item->Frame().right + 1.0f;
+			frame.bottom = max_c(frame.bottom, iHeight + fPad.top + fPad.bottom);
+		}
+	}
+	
+	if (moveItems) {
+		for (int32 i = 0; i < fItems.CountItems(); i++)
+			ItemAt(i)->fBounds.bottom = frame.bottom;			
+	}
+	
+	if (bestFit)
+		frame.right = ceilf(frame.right);
+	else
+		frame.right = Bounds().right;
+}
+
+
+void
+BMenu::_ComputeMatrixLayout(BRect &frame)
+{
+	for (int32 i = 0; i < CountItems(); i++) {
+		BMenuItem *item = ItemAt(i);
+		if (item != NULL) {
+			frame.left = min_c(frame.left, item->Frame().left);
+			frame.right = max_c(frame.right, item->Frame().right);
+			frame.top = min_c(frame.top, item->Frame().top);
+			frame.bottom = max_c(frame.bottom, item->Frame().bottom);
+		}			
+	}		
+}
+
+
 BRect
 BMenu::Bump(BRect current, BPoint extent, int32 index) const
 {

Modified: haiku/trunk/src/kits/interface/MenuItem.cpp
===================================================================
--- haiku/trunk/src/kits/interface/MenuItem.cpp	2007-06-12 04:05:13 UTC (rev 21393)
+++ haiku/trunk/src/kits/interface/MenuItem.cpp	2007-06-12 09:10:08 UTC (rev 21394)
@@ -1,11 +1,11 @@
 /*
- * Copyright 2001-2006, Haiku, Inc.
+ * Copyright 2001-2007, Haiku, Inc.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
  *		Marc Flerackers (mflerackers at androme.be)
  *		Bill Hayden (haydentech at users.sourceforge.net)
- *		Stefano Ceccherini (burton666 at libero.it)
+ *		Stefano Ceccherini (stefano.ceccherini at gmail.com)
  *		Olivier Milla
  */
 
@@ -20,7 +20,6 @@
 #include 
 #include 
 
-
 const uint32 kCtrlLength = 20*11;
 const unsigned char kCtrlBits[] = {
 	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,0xff,0xff,0xff,
@@ -709,11 +708,12 @@
 void
 BMenuItem::_DrawShortcutSymbol()
 {
-	// TODO: Review this
+	BFont font;
+	Menu()->GetFont(&font);
 	BPoint where = ContentLocation();
-	where.x += fBounds.Width() - 28;
+	where.x += fBounds.Width() - 28;	
 	if (fSubmenu)
-		where.x -= 12;
+		where.x -= fBounds.Height();
 
 	switch (fShortcutChar) {
 		case B_DOWN_ARROW:
@@ -729,7 +729,8 @@
 			break;
 	}
 
-	where -= BPoint(20, -1);
+	where.y += (fBounds.Height() - 11) / 2 - 1;
+	where.x -= 5;
 
 	if (fModifiers & B_COMMAND_KEY) {
 		BRect rect(0,0,16,10);
@@ -739,9 +740,9 @@
 			control.SetBits(kAltBits, kAltLength, 0, B_CMAP8);
 		else
 			control.SetBits(kCtrlBits, kCtrlLength, 0, B_CMAP8);
+		
+		where.x -= rect.Width() + 1;
 		fSuper->DrawBitmap(&control, where);
-
-		where.x -= rect.Width() + 1;
 	}
 
 	if (fModifiers & B_CONTROL_KEY) {
@@ -752,16 +753,16 @@
 			control.SetBits(kCtrlBits, kCtrlLength, 0, B_CMAP8);
 		else	
 			control.SetBits(kAltBits, kAltLength, 0, B_CMAP8);
+		where.x -= rect.Width() + 1;
 		fSuper->DrawBitmap(&control, where);
-
-		where.x -= rect.Width() + 1;
 	}
 
 	if (fModifiers & B_SHIFT_KEY) {
 		BRect rect(0,0,21,10);
 		BBitmap shift(rect, B_CMAP8);
 		shift.SetBits(kShiftBits, kShiftLength, 0, B_CMAP8);
-		fSuper->DrawBitmap(&shift, where - BPoint(6, 0));
+		where.x -= rect.Width() + 1;
+		fSuper->DrawBitmap(&shift, where);
 	}
 }
 

Modified: haiku/trunk/src/kits/interface/PopUpMenu.cpp
===================================================================
--- haiku/trunk/src/kits/interface/PopUpMenu.cpp	2007-06-12 04:05:13 UTC (rev 21393)
+++ haiku/trunk/src/kits/interface/PopUpMenu.cpp	2007-06-12 09:10:08 UTC (rev 21394)
@@ -16,7 +16,6 @@
 
 #include 
 
-using std::nothrow;
 
 struct popup_menu_data {
 	BPopUpMenu *object;
@@ -267,7 +266,7 @@
 BPopUpMenu::_Go(BPoint where, bool autoInvoke, bool startOpened,
 		BRect *_specialRect, bool async)
 {
-	popup_menu_data *data = new (nothrow) popup_menu_data;
+	popup_menu_data *data = new (std::nothrow) popup_menu_data;
 	if (!data)
 		return NULL;
 



From bonefish at cs.tu-berlin.de  Tue Jun 12 13:11:00 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Tue, 12 Jun 2007 13:11:00 +0200
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
 headers/private/interface headers/shared src src/apps/showimage
 src/kits/interface src/shared
In-Reply-To: <200706120354.l5C3s8NI000496@sheep.berlios.de>
References: <200706120354.l5C3s8NI000496@sheep.berlios.de>
Message-ID: <20070612131100.810.1@cs.tu-berlin.de>


On 2007-06-12 at 05:54:08 [+0200], leavengood at BerliOS 
 wrote:
> Author: leavengood
> Date: 2007-06-12 05:54:07 +0200 (Tue, 12 Jun 2007)
> New Revision: 21391
> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21391&view=rev
> 
> Added:
>    haiku/trunk/headers/shared/
>    haiku/trunk/headers/shared/AboutWindow.h
>    haiku/trunk/src/shared/
>    haiku/trunk/src/shared/AboutWindow.cpp
> Removed:
>    haiku/trunk/headers/private/interface/AboutWindow.h
>    haiku/trunk/src/kits/interface/AboutWindow.cpp
> Modified:
>    haiku/trunk/build/jam/FileRules
>    haiku/trunk/build/jam/HeadersRules
>    haiku/trunk/src/apps/showimage/Jamfile
>    haiku/trunk/src/apps/showimage/ShowImageApp.cpp
>    haiku/trunk/src/kits/interface/Jamfile
> Log:
> Moved the BAboutWindow implementation to the shared source directory, which
> despite being talked about repeatedly, does not currently exist.
> 
> Adding this required adding some new Jam rules to deal with this shared 
> source
> directory and headers. I had some fun figuring this out. Despite writing
> articles about Jam in the Haiku newsletter a few years ago I still find Jam 
> to
> be a PITA at times.
> 
> But my solution seems to work pretty well. Basically you just call the rule
> UseSharedSource and pass the name of the shared source file you want to use.
> This rule sets up the header directories and the right Jam variables for the
> source file. You then add the source file to the source list in the 
> Application
> rule like any other source file.
> 
> I also made the authors list sent to the about window constructor null
> terminated instead of passing the size of the array, as suggested by Hugo.

I find it quite suboptimal to compile the same source file for every app that 
uses the respective class. The natural solutions are: 1) Build the stuff into 
libbe. 2) Put it into another shared or static library.

> Modified: haiku/trunk/build/jam/FileRules
> ===================================================================
> --- haiku/trunk/build/jam/FileRules    2007-06-11 19:11:48 UTC (rev 21390)
> +++ haiku/trunk/build/jam/FileRules    2007-06-12 03:54:07 UTC (rev 21391)
> @@ -249,3 +249,15 @@
>      $(2[1]) --data $(2[3]) $(1) &&
>      $(2[2]) $(1) ${revision}
>  }
> +
> +rule UseSharedSource
> +{
> +    UseSharedHeaders ;
> +
> +    for file in $(1) {
> +        local gristed_file = [ FGristFiles $(file) ] ;
> +        SEARCH on $(gristed_file) = [ FDirName $(HAIKU_TOP) src shared ] ;
> +        LOCATE on $(gristed_file) = [ FDirName $(HAIKU_TOP) src shared ] ;
> +        SEARCH_SOURCE on $(gristed_file) = [ FDirName $(HAIKU_TOP) src 
> shared ] ;
> +    }
> +}

Besides that I'd remove the rule completely and rather put those sources into 
a library, some comments:

* Please don't use underscores in local variables. E.g. it should read 
"gristedFile".
* In new rules please use named parameters.
* There's no reason to iterate over the sources in this case. You're doing 
the exactly same operations for all elements anyway. So you can as well 
operate on the array directly. Which is more efficient.
* There's no reason for setting both SEARCH and LOCATE on any target. In case 
of generated files it's LOCATE, otherwise SEARCH. There's no point in setting 
SEARCH_SOURCE on a target at all.

CU, Ingo


From korli at users.berlios.de  Tue Jun 12 13:36:28 2007
From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=)
Date: Tue, 12 Jun 2007 13:36:28 +0200
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
	headers/private/interface headers/shared src
	src/apps/showimage src/kits/interface src/shared
In-Reply-To: <20070612131100.810.1@cs.tu-berlin.de>
References: <200706120354.l5C3s8NI000496@sheep.berlios.de>
	<20070612131100.810.1@cs.tu-berlin.de>
Message-ID: 

2007/6/12, Ingo Weinhold :
>
> I find it quite suboptimal to compile the same source file for every app
> that
> uses the respective class. The natural solutions are: 1) Build the stuff
> into
> libbe. 2) Put it into another shared or static library.


Indeed, the static library ? la libhaiku.a would be fine to me. Moreover, I
don't quite understand the headers/shared directory. Why not
headers/private/shared ?

Bye,

J?r?me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From jackburton at mail.berlios.de  Tue Jun 12 14:28:07 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Tue, 12 Jun 2007 14:28:07 +0200
Subject: [Haiku-commits] r21395 - in haiku/trunk: headers/os/interface
	src/kits/interface
Message-ID: <200706121228.l5CCS7Al032662@sheep.berlios.de>

Author: jackburton
Date: 2007-06-12 14:28:06 +0200 (Tue, 12 Jun 2007)
New Revision: 21395
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21395&view=rev

Modified:
   haiku/trunk/headers/os/interface/Menu.h
   haiku/trunk/src/kits/interface/Menu.cpp
   haiku/trunk/src/kits/interface/MenuItem.cpp
Log:
Shortcut characters are aligned even if there's a submenu, like 
discussed in the thread in haiku-development. I added a fSubmenus member 
to BMenu, to be able to tell from BMenuItem if there are other items 
with a submenu (maintained in BMenuItem::SetSuper()). If you don't like 
this solution, let's just revert.


Modified: haiku/trunk/headers/os/interface/Menu.h
===================================================================
--- haiku/trunk/headers/os/interface/Menu.h	2007-06-12 09:10:08 UTC (rev 21394)
+++ haiku/trunk/headers/os/interface/Menu.h	2007-06-12 12:28:06 UTC (rev 21395)
@@ -292,8 +292,10 @@
 		BPoint		*fInitMatrixSize;
 		_ExtraMenuData_	*fExtraMenuData;
 
-		uint32		_reserved[2];
+		uint32		_reserved[1];
 
+		int32		fSubmenus;
+
 		char		fTrigger;
 		bool		fResizeToFit;
 		bool		fUseCachedMenuLayout;

Modified: haiku/trunk/src/kits/interface/Menu.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Menu.cpp	2007-06-12 09:10:08 UTC (rev 21394)
+++ haiku/trunk/src/kits/interface/Menu.cpp	2007-06-12 12:28:06 UTC (rev 21395)
@@ -160,6 +160,7 @@
 		fMaxContentWidth(0.0f),
 		fInitMatrixSize(NULL),
 		fExtraMenuData(NULL),
+		fSubmenus(0),
 		fTrigger(0),
 		fResizeToFit(true),
 		fUseCachedMenuLayout(false),
@@ -193,6 +194,7 @@
 		fMaxContentWidth(0.0f),
 		fInitMatrixSize(NULL),
 		fExtraMenuData(NULL),
+		fSubmenus(0),
 		fTrigger(0),
 		fResizeToFit(true),
 		fUseCachedMenuLayout(false),
@@ -238,6 +240,7 @@
 		fMaxContentWidth(0.0f),
 		fInitMatrixSize(NULL),
 		fExtraMenuData(NULL),
+		fSubmenus(0),
 		fTrigger(0),
 		fResizeToFit(true),
 		fUseCachedMenuLayout(false),
@@ -983,6 +986,7 @@
 		fMaxContentWidth(0.0f),
 		fInitMatrixSize(NULL),
 		fExtraMenuData(NULL),
+		fSubmenus(0),
 		fTrigger(0),
 		fResizeToFit(resizeToFit),
 		fUseCachedMenuLayout(false),
@@ -1594,7 +1598,7 @@
 			item->fBounds.top = frame.bottom;
 			item->fBounds.bottom = item->fBounds.top + iHeight + fPad.top + fPad.bottom;
 
-			if (item->fSubmenu != NULL)
+			if (fSubmenus)
 				iWidth += item->Frame().Height();
 
 			frame.right = max_c(frame.right, iWidth + fPad.left + fPad.right);

Modified: haiku/trunk/src/kits/interface/MenuItem.cpp
===================================================================
--- haiku/trunk/src/kits/interface/MenuItem.cpp	2007-06-12 09:10:08 UTC (rev 21394)
+++ haiku/trunk/src/kits/interface/MenuItem.cpp	2007-06-12 12:28:06 UTC (rev 21395)
@@ -649,11 +649,16 @@
 {
 	if (fSuper != NULL && super != NULL)
 		debugger("Error - can't add menu or menu item to more than 1 container (either menu or menubar).");
-				
-	fSuper = super;
 
-	if (fSubmenu != NULL)
+	if (fSubmenu != NULL) {
+		if (super)
+			super->fSubmenus++;
+		else if (fSuper)
+			fSuper->fSubmenus--;	
 		fSubmenu->fSuper = super;
+	}
+		
+	fSuper = super;
 }
 
 
@@ -708,12 +713,13 @@
 void
 BMenuItem::_DrawShortcutSymbol()
 {
+	BMenu *menu = Menu();
 	BFont font;
-	Menu()->GetFont(&font);
+	menu->GetFont(&font);
 	BPoint where = ContentLocation();
-	where.x += fBounds.Width() - 28;	
-	if (fSubmenu)
-		where.x -= fBounds.Height();
+	where.x = fBounds.right - font.Size();	
+	if (menu->fSubmenus)
+		where.x -= fBounds.Height() - 4;
 
 	switch (fShortcutChar) {
 		case B_DOWN_ARROW:
@@ -730,8 +736,8 @@
 	}
 
 	where.y += (fBounds.Height() - 11) / 2 - 1;
-	where.x -= 5;
-
+	where.x -= 4;	
+	
 	if (fModifiers & B_COMMAND_KEY) {
 		BRect rect(0,0,16,10);
 		BBitmap control(rect, B_CMAP8);
@@ -775,6 +781,7 @@
 	BRect r(fBounds);
 	r.left = r.right - r.Height();
 	r.InsetBy(2.0, 2.0);
+	//r.OffsetBy(2.0, 0.0);
 
 	fSuper->SetHighColor(tint_color(bgColor, kLightBGTint));
 	fSuper->FillRect(r);



From marcusoverhagen at arcor.de  Tue Jun 12 14:46:44 2007
From: marcusoverhagen at arcor.de (Marcus Overhagen)
Date: Tue, 12 Jun 2007 14:46:44 +0200 (CEST)
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
 headers/private/interface headers/shared src src/apps/showimage
 src/kits/interface src/shared
In-Reply-To: <20070612131100.810.1@cs.tu-berlin.de>
References: <20070612131100.810.1@cs.tu-berlin.de>
	<200706120354.l5C3s8NI000496@sheep.berlios.de>
Message-ID: <31321040.1181652404721.JavaMail.ngmail@webmail18>

Ingo Weinhold wrote:

> I find it quite suboptimal to compile the same source file for every app that 
> uses the respective class. The natural solutions are: 1) Build the stuff
> into  libbe. 2) Put it into another shared or static library.

First i would like to say that I hadn't looked at the initial commit mail until now.
Some comments:

I think that we don't need a "shared" headers folder, we already do sharing
of headers in the "private" folder a large number of times.

This kind of private class API should be put into a static (.a) library, and be linked
with the applications using it. we shouldn't make it public or put it into a .so lib.

For an example, have a look at the static libOpenDML, that gets used by the 
avi_reader.

It's really simple and supported by the build system since the beginning.

http://svn.berlios.de/viewcvs/haiku/haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Jamfile?view=markup

http://svn.berlios.de/viewcvs/haiku/haiku/trunk/src/add-ons/media/plugins/avi_reader/Jamfile?view=markup


Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren
ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: g?nstig
und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer,
nur  39,85 ?  inkl. DSL- und ISDN-Grundgeb?hr!
http://www.arcor.de/rd/emf-dsl-2


From bonefish at cs.tu-berlin.de  Tue Jun 12 15:03:09 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Tue, 12 Jun 2007 15:03:09 +0200 (MEST)
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
 headers/private/interface headers/shared src src/apps/showimage
 src/kits/interface src/shared
In-Reply-To: 
References: <200706120354.l5C3s8NI000496@sheep.berlios.de>
	<20070612131100.810.1@cs.tu-berlin.de>
	
Message-ID: 

On Tue, 12 Jun 2007, J?r?me Duval wrote:

> 2007/6/12, Ingo Weinhold :
>> 
>> I find it quite suboptimal to compile the same source file for every app
>> that
>> uses the respective class. The natural solutions are: 1) Build the stuff
>> into
>> libbe. 2) Put it into another shared or static library.
>
>
> Indeed, the static library ? la libhaiku.a would be fine to me. Moreover, I
> don't quite understand the headers/shared directory. Why not
> headers/private/shared ?

Yep, that would be the right place.

CU, Ingo

From axeld at pinc-software.de  Tue Jun 12 15:05:43 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Tue, 12 Jun 2007 15:05:43 +0200 CEST
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
 headers/private/interface headers/shared src src/apps/showimage
 src/kits/interface src/shared
In-Reply-To: <20070612131100.810.1@cs.tu-berlin.de>
Message-ID: <14919655300-BeMail@ibm>

Ingo Weinhold  wrote:
> I find it quite suboptimal to compile the same source file for every 
> app that 
> uses the respective class. The natural solutions are: 1) Build the 
> stuff into 
> libbe. 2) Put it into another shared or static library.

I'd prefer a static library as well, and since its sources are in src/
shared, I'd just call it libshared.a.
Also, as J?r?me pointed out correctly, it should be private/shared for 
private stuff.

Bye,
   Axel.



From jackburton at mail.berlios.de  Tue Jun 12 15:16:40 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Tue, 12 Jun 2007 15:16:40 +0200
Subject: [Haiku-commits] r21396 - haiku/trunk/src/kits/interface
Message-ID: <200706121316.l5CDGeAE006884@sheep.berlios.de>

Author: jackburton
Date: 2007-06-12 15:16:39 +0200 (Tue, 12 Jun 2007)
New Revision: 21396
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21396&view=rev

Modified:
   haiku/trunk/src/kits/interface/Menu.cpp
   haiku/trunk/src/kits/interface/MenuItem.cpp
Log:
Changed the loop to compute the column layout: Now the space for 
modifiers is added after we've calculated the maximum width. This way we 
don't get overlapping between the menu content and the modifiers bitmaps 
themselves. TBR.


Modified: haiku/trunk/src/kits/interface/Menu.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Menu.cpp	2007-06-12 12:28:06 UTC (rev 21395)
+++ haiku/trunk/src/kits/interface/Menu.cpp	2007-06-12 13:16:39 UTC (rev 21396)
@@ -1578,6 +1578,9 @@
 {
 	BFont font;
 	GetFont(&font);
+	bool command = false;
+	bool control = false;
+	bool shift = false;
 	for (int32 i = 0; i < fItems.CountItems(); i++) {
 		BMenuItem *item = ItemAt(i);	
 		if (item != NULL) {
@@ -1587,11 +1590,11 @@
 			if (item->fModifiers && item->fShortcutChar) {
 				iWidth += font.Size();
 				if (item->fModifiers & B_COMMAND_KEY)
-					iWidth += 15;
+					command = true;
 				if (item->fModifiers & B_CONTROL_KEY)
-					iWidth += 15;
+					control = true;
 				if (item->fModifiers & B_SHIFT_KEY)
-					iWidth += 20;				
+					shift = true;				
 			}
 
 			item->fBounds.left = 0.0f;
@@ -1600,11 +1603,19 @@
 
 			if (fSubmenus)
 				iWidth += item->Frame().Height();
-
+			
 			frame.right = max_c(frame.right, iWidth + fPad.left + fPad.right);
 			frame.bottom = item->fBounds.bottom + 1.0f;
 		}
 	}
+	
+	if (command)
+		frame.right += 17;
+	if (control)
+		frame.right += 17;
+	if (shift)
+		frame.right += 22;				
+			
 	if (fMaxContentWidth > 0)
 		frame.right = min_c(frame.right, fMaxContentWidth);
 

Modified: haiku/trunk/src/kits/interface/MenuItem.cpp
===================================================================
--- haiku/trunk/src/kits/interface/MenuItem.cpp	2007-06-12 12:28:06 UTC (rev 21395)
+++ haiku/trunk/src/kits/interface/MenuItem.cpp	2007-06-12 13:16:39 UTC (rev 21396)
@@ -781,7 +781,6 @@
 	BRect r(fBounds);
 	r.left = r.right - r.Height();
 	r.InsetBy(2.0, 2.0);
-	//r.OffsetBy(2.0, 0.0);
 
 	fSuper->SetHighColor(tint_color(bgColor, kLightBGTint));
 	fSuper->FillRect(r);



From leavengood at gmail.com  Tue Jun 12 16:15:06 2007
From: leavengood at gmail.com (Ryan Leavengood)
Date: Tue, 12 Jun 2007 10:15:06 -0400
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
	headers/private/interface headers/shared src
	src/apps/showimage src/kits/interface src/shared
In-Reply-To: <20070612131100.810.1@cs.tu-berlin.de>
References: <200706120354.l5C3s8NI000496@sheep.berlios.de>
	<20070612131100.810.1@cs.tu-berlin.de>
Message-ID: 

On 6/12/07, Ingo Weinhold  wrote:
>
> I find it quite suboptimal to compile the same source file for every app that
> uses the respective class. The natural solutions are: 1) Build the stuff into
> libbe. 2) Put it into another shared or static library.

People already complained about this getting put in libbe (though
frankly I don't see the big deal.)

The problem with a static library that encompasses all of the
src/shared directory into a libshared.a (as suggested by Axel) is that
applications would have to include the whole library, even though they
may not use all the code. We don't know how big the shared source
directory might be in the future, and I for one don't want to bloat
the applications with unused code. I suppose each bit of shared code
could be put in its own library (grouping things that belong
together.)

I'm open to suggestions.

> Besides that I'd remove the rule completely and rather put those sources into
> a library, some comments:
>
> * Please don't use underscores in local variables. E.g. it should read
> "gristedFile".

Yeah that is just our coding guidelines, I should have caught that. I
use underscores at work when writing Ruby, so it is just a habit.

> * In new rules please use named parameters.
> * There's no reason to iterate over the sources in this case. You're doing
> the exactly same operations for all elements anyway. So you can as well
> operate on the array directly. Which is more efficient.

OK.

> * There's no reason for setting both SEARCH and LOCATE on any target. In case
> of generated files it's LOCATE, otherwise SEARCH. There's no point in setting
> SEARCH_SOURCE on a target at all.

Actually it only works right when LOCATE is set as well. I guess Jam
considers the source file to have been generated and so setting LOCATE
to the src/shared directory finally made this work. The setting of
SEARCH and SEARCH_SOURCE could probably be removed. I tried all kinds
of variations on setting SEARCH but it never seemed to work. I guess
this is all moot anyhow.

In regards to headers/shared, I just saw that mentioned somewhere as
the directory to use for the shared headers. I know of the existence
of private/shared and had the header there at first ;)

Ryan


From hugosantos at gmail.com  Tue Jun 12 16:19:31 2007
From: hugosantos at gmail.com (Hugo Santos)
Date: Tue, 12 Jun 2007 15:19:31 +0100
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
	headers/private/interface headers/shared src
	src/apps/showimage src/kits/interface src/shared
In-Reply-To: 
References: <200706120354.l5C3s8NI000496@sheep.berlios.de>
	<20070612131100.810.1@cs.tu-berlin.de>
	
Message-ID: <9c46321e0706120719w6028323bl788be97e475f6acb@mail.gmail.com>

Hey Ryan,

On 6/12/07, Ryan Leavengood  wrote:
> The problem with a static library that encompasses all of the
> src/shared directory into a libshared.a (as suggested by Axel) is that
> applications would have to include the whole library, even though they
> may not use all the code. We don't know how big the shared source
> directory might be in the future, and I for one don't want to bloat
> the applications with unused code. I suppose each bit of shared code
> could be put in its own library (grouping things that belong
> together.)

  The linker will only pick up the symbols that are used. At least a
sane one. I'm not sure about our older binutils/gcc 2.95. But
considering the amount of code you'll have there it doesn't really
matter at this point.

  Hugo


From leavengood at gmail.com  Tue Jun 12 16:29:33 2007
From: leavengood at gmail.com (Ryan Leavengood)
Date: Tue, 12 Jun 2007 10:29:33 -0400
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
	headers/private/interface headers/shared src
	src/apps/showimage src/kits/interface src/shared
In-Reply-To: <9c46321e0706120719w6028323bl788be97e475f6acb@mail.gmail.com>
References: <200706120354.l5C3s8NI000496@sheep.berlios.de>
	<20070612131100.810.1@cs.tu-berlin.de>
	
	<9c46321e0706120719w6028323bl788be97e475f6acb@mail.gmail.com>
Message-ID: 

On 6/12/07, Hugo Santos  wrote:
> Hey Ryan,
>
>   The linker will only pick up the symbols that are used. At least a
> sane one. I'm not sure about our older binutils/gcc 2.95. But
> considering the amount of code you'll have there it doesn't really
> matter at this point.

That makes sense.

You know, I've been programming professionally for almost 10 years,
but never with C or C++, and I think it is starting to show ;)

I feel like a college student or something. Hopefully I get back in
the swing of things soon. Though frankly with these kind of build
issues I'll probably have to defer to the wisdom of you guys for a
while.

So to avoid another flurry of responses for my next commit, I plan to
do the following:

1. Move the AboutWindow.h header into headers/private/shared. Delete
headers/shared/
2. Add a Jamfile to src/shared to build it into a static library libshared.a.
3. Remove my changes in the build/jam directory.
4. Have ShowImage include libshared.a.
5. Commit and pray that I finally got it all right.

Ryan


From hugosantos at gmail.com  Tue Jun 12 16:35:09 2007
From: hugosantos at gmail.com (Hugo Santos)
Date: Tue, 12 Jun 2007 15:35:09 +0100
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
	headers/private/interface headers/shared src
	src/apps/showimage src/kits/interface src/shared
In-Reply-To: 
References: <200706120354.l5C3s8NI000496@sheep.berlios.de>
	<20070612131100.810.1@cs.tu-berlin.de>
	
	<9c46321e0706120719w6028323bl788be97e475f6acb@mail.gmail.com>
	
Message-ID: <9c46321e0706120735p2c911a37j7001af81bdd531fe@mail.gmail.com>

Hey Ryan,

On 6/12/07, Ryan Leavengood  wrote:
> You know, I've been programming professionally for almost 10 years,
> but never with C or C++, and I think it is starting to show ;)
>
> I feel like a college student or something. Hopefully I get back in
> the swing of things soon. Though frankly with these kind of build
> issues I'll probably have to defer to the wisdom of you guys for a
> while.

  Don't worry too much about it. Everyone has something to learn. I
think what's important is people being able to take on advice as a
positive thing and improve their contributions. Eventually you'll be
the one pointing stuff to others. That's how it works.

  Trial and error is also the best way to learn, the brain reacts
better to error. So as long as the build isn't broken i think people
won't be annoyed with this kind of iterative development, so don't
worry.

  Have fun,
    Hugo


From jackburton at mail.berlios.de  Tue Jun 12 16:35:36 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Tue, 12 Jun 2007 16:35:36 +0200
Subject: [Haiku-commits] r21397 - haiku/trunk/src/kits/interface
Message-ID: <200706121435.l5CEZaa6014881@sheep.berlios.de>

Author: jackburton
Date: 2007-06-12 16:35:36 +0200 (Tue, 12 Jun 2007)
New Revision: 21397
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21397&view=rev

Modified:
   haiku/trunk/src/kits/interface/MenuItem.cpp
Log:
Use BBitmap::ImportBits() to get rid of the padded bitmaps

Modified: haiku/trunk/src/kits/interface/MenuItem.cpp
===================================================================
--- haiku/trunk/src/kits/interface/MenuItem.cpp	2007-06-12 13:16:39 UTC (rev 21396)
+++ haiku/trunk/src/kits/interface/MenuItem.cpp	2007-06-12 14:35:36 UTC (rev 21397)
@@ -20,66 +20,48 @@
 #include 
 #include 
 
-const uint32 kCtrlLength = 20*11;
 const unsigned char kCtrlBits[] = {
-	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,0xff,0xff,0xff,
-	0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xff,0xff,0xff
-/*	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff*/
+	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
+	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
+	0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
 };
 
 
-const uint32 kAltLength = 20*11;
 const unsigned char kAltBits[] = {
-	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x1a,0x04,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,0xff,0xff,0xff,
-	0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,0xff,0xff,0xff,
-	0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xff,0xff,0xff
-/*	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff*/
+	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
+	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x13,0x04,0x04,0x13,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x04,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x04,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
+	0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
 };
 
 
-const uint32 kShiftLength = 24*11;
 const unsigned char kShiftBits[] = {
-	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x17,0xff,0xff,
-	0x1d,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x17,0xff,0xff,
-	0x1d,0x1b,0x1b,0x17,0x0d,0x0d,0x17,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x17,0xff,0xff,
-	0x1d,0x1b,0x1b,0x0d,0x19,0x19,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x0d,0x0d,0x0d,0x1b,0x0d,0x0d,0x0d,0x1b,0x19,0x17,0xff,0xff,
-	0x1d,0x1b,0x1b,0x17,0x0d,0x0d,0x19,0x1b,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x1b,0x1b,0x1b,0x0d,0x1b,0x1b,0x19,0x17,0xff,0xff,
-	0x1d,0x1b,0x1b,0x1b,0x1b,0x1b,0x0d,0x1b,0x0d,0x0d,0x0d,0x1b,0x0d,0x0d,0x1b,0x1b,0x1b,0x0d,0x1b,0x1b,0x19,0x17,0xff,0xff,
-	0x1d,0x1b,0x1b,0x0d,0x19,0x19,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x1b,0x1b,0x1b,0x0d,0x1b,0x1b,0x19,0x17,0xff,0xff,
-	0x1d,0x1b,0x1b,0x17,0x0d,0x0d,0x17,0x1b,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x1b,0x1b,0x1b,0x0d,0x1b,0x1b,0x19,0x17,0xff,0xff,
-	0x1d,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x17,0xff,0xff,
-	0x1d,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x17,0xff,0xff,
-	0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0xff,0xff
-	/*0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-	0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff*/
+	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x17,
+	0x1d,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x17,
+	0x1d,0x1b,0x1b,0x17,0x0d,0x0d,0x17,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x17,
+	0x1d,0x1b,0x1b,0x0d,0x19,0x19,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x0d,0x0d,0x0d,0x1b,0x0d,0x0d,0x0d,0x1b,0x19,0x17,
+	0x1d,0x1b,0x1b,0x17,0x0d,0x0d,0x19,0x1b,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x1b,0x1b,0x1b,0x0d,0x1b,0x1b,0x19,0x17,
+	0x1d,0x1b,0x1b,0x1b,0x1b,0x1b,0x0d,0x1b,0x0d,0x0d,0x0d,0x1b,0x0d,0x0d,0x1b,0x1b,0x1b,0x0d,0x1b,0x1b,0x19,0x17,
+	0x1d,0x1b,0x1b,0x0d,0x19,0x19,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x1b,0x1b,0x1b,0x0d,0x1b,0x1b,0x19,0x17,
+	0x1d,0x1b,0x1b,0x17,0x0d,0x0d,0x17,0x1b,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x1b,0x1b,0x1b,0x0d,0x1b,0x1b,0x19,0x17,
+	0x1d,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x17,
+	0x1d,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x17,
+	0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17
 };
 
 const float kLightBGTint = (B_LIGHTEN_1_TINT + B_LIGHTEN_1_TINT + B_NO_TINT) / 3.0;
@@ -743,9 +725,9 @@
 		BBitmap control(rect, B_CMAP8);
 
 		if (BMenu::sAltAsCommandKey)
-			control.SetBits(kAltBits, kAltLength, 0, B_CMAP8);
+			control.ImportBits(kAltBits, sizeof(kAltBits), 17, 0, B_CMAP8);
 		else
-			control.SetBits(kCtrlBits, kCtrlLength, 0, B_CMAP8);
+			control.ImportBits(kCtrlBits, sizeof(kCtrlBits), 17, 0, B_CMAP8);
 		
 		where.x -= rect.Width() + 1;
 		fSuper->DrawBitmap(&control, where);
@@ -756,9 +738,9 @@
 		BBitmap control(rect, B_CMAP8);
 
 		if (BMenu::sAltAsCommandKey)
-			control.SetBits(kCtrlBits, kCtrlLength, 0, B_CMAP8);
+			control.ImportBits(kCtrlBits, sizeof(kCtrlBits), 17, 0, B_CMAP8);
 		else	
-			control.SetBits(kAltBits, kAltLength, 0, B_CMAP8);
+			control.ImportBits(kAltBits, sizeof(kAltBits), 17, 0, B_CMAP8);
 		where.x -= rect.Width() + 1;
 		fSuper->DrawBitmap(&control, where);
 	}
@@ -766,7 +748,7 @@
 	if (fModifiers & B_SHIFT_KEY) {
 		BRect rect(0,0,21,10);
 		BBitmap shift(rect, B_CMAP8);
-		shift.SetBits(kShiftBits, kShiftLength, 0, B_CMAP8);
+		shift.ImportBits(kShiftBits, sizeof(kShiftBits), 22, 0, B_CMAP8);
 		where.x -= rect.Width() + 1;
 		fSuper->DrawBitmap(&shift, where);
 	}



From jackburton at mail.berlios.de  Tue Jun 12 16:47:34 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Tue, 12 Jun 2007 16:47:34 +0200
Subject: [Haiku-commits] r21398 - haiku/trunk/src/kits/interface
Message-ID: <200706121447.l5CElY3o015939@sheep.berlios.de>

Author: jackburton
Date: 2007-06-12 16:47:33 +0200 (Tue, 12 Jun 2007)
New Revision: 21398
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21398&view=rev

Modified:
   haiku/trunk/src/kits/interface/MenuItem.cpp
Log:
fixed the colors of the shift modifier bitmap to be consistent with the others. Actually, though, I'm not sure which one is better

Modified: haiku/trunk/src/kits/interface/MenuItem.cpp
===================================================================
--- haiku/trunk/src/kits/interface/MenuItem.cpp	2007-06-12 14:35:36 UTC (rev 21397)
+++ haiku/trunk/src/kits/interface/MenuItem.cpp	2007-06-12 14:47:33 UTC (rev 21398)
@@ -51,17 +51,17 @@
 
 
 const unsigned char kShiftBits[] = {
-	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x17,
-	0x1d,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x17,
-	0x1d,0x1b,0x1b,0x17,0x0d,0x0d,0x17,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x17,
-	0x1d,0x1b,0x1b,0x0d,0x19,0x19,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x0d,0x0d,0x0d,0x1b,0x0d,0x0d,0x0d,0x1b,0x19,0x17,
-	0x1d,0x1b,0x1b,0x17,0x0d,0x0d,0x19,0x1b,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x1b,0x1b,0x1b,0x0d,0x1b,0x1b,0x19,0x17,
-	0x1d,0x1b,0x1b,0x1b,0x1b,0x1b,0x0d,0x1b,0x0d,0x0d,0x0d,0x1b,0x0d,0x0d,0x1b,0x1b,0x1b,0x0d,0x1b,0x1b,0x19,0x17,
-	0x1d,0x1b,0x1b,0x0d,0x19,0x19,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x1b,0x1b,0x1b,0x0d,0x1b,0x1b,0x19,0x17,
-	0x1d,0x1b,0x1b,0x17,0x0d,0x0d,0x17,0x1b,0x0d,0x1b,0x0d,0x1b,0x0d,0x1b,0x1b,0x1b,0x1b,0x0d,0x1b,0x1b,0x19,0x17,
-	0x1d,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x17,
-	0x1d,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x17,
-	0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17
+	0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x14,
+	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x04,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x04,0x04,0x04,0x1a,0x04,0x04,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x04,0x17,0x17,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x17,0x04,0x04,0x17,0x1a,0x04,0x1a,0x04,0x1a,0x04,0x1a,0x1a,0x1a,0x1a,0x04,0x1a,0x1a,0x17,0x14,
+	0x1d,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x17,0x14,
+	0x1d,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x14,
+	0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14
 };
 
 const float kLightBGTint = (B_LIGHTEN_1_TINT + B_LIGHTEN_1_TINT + B_NO_TINT) / 3.0;



From bonefish at cs.tu-berlin.de  Tue Jun 12 17:04:25 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Tue, 12 Jun 2007 17:04:25 +0200 (MEST)
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
 headers/private/interface headers/shared src src/apps/showimage
 src/kits/interface src/shared
In-Reply-To: 
References: <200706120354.l5C3s8NI000496@sheep.berlios.de>
	<20070612131100.810.1@cs.tu-berlin.de>
	
Message-ID: 

On Tue, 12 Jun 2007, Ryan Leavengood wrote:

> On 6/12/07, Ingo Weinhold  wrote:
>
>> * There's no reason for setting both SEARCH and LOCATE on any target. In case
>> of generated files it's LOCATE, otherwise SEARCH. There's no point in setting
>> SEARCH_SOURCE on a target at all.
>
> Actually it only works right when LOCATE is set as well. I guess Jam
> considers the source file to have been generated and so setting LOCATE
> to the src/shared directory finally made this work. The setting of
> SEARCH and SEARCH_SOURCE could probably be removed. I tried all kinds
> of variations on setting SEARCH but it never seemed to work. I guess
> this is all moot anyhow.

SEARCH is also set automatically by the Object rule, thus overriding an 
earlier set value. If you want to set SEARCH on files, you need to do that 
after the rule has been invoked. LOCATE has precedence of SEARCH, which is 
why your solution worked at all.

CU, Ingo


From superstippi at gmx.de  Tue Jun 12 17:09:54 2007
From: superstippi at gmx.de (Stephan Assmus)
Date: Tue, 12 Jun 2007 17:09:54 +0200
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
 headers/private/interface headers/shared src src/apps/showimage
 src/kits/interface src/shared
In-Reply-To: <9c46321e0706120735p2c911a37j7001af81bdd531fe@mail.gmail.com>
References: <200706120354.l5C3s8NI000496@sheep.berlios.de>
	<20070612131100.810.1@cs.tu-berlin.de>
	
	<9c46321e0706120719w6028323bl788be97e475f6acb@mail.gmail.com>
	
	<9c46321e0706120735p2c911a37j7001af81bdd531fe@mail.gmail.com>
Message-ID: <20070612170954.7929.11@stippis.mindwork.office>


Hugo Santos wrote (2007-06-12, 16:35:09 [+0200]):
>   Don't worry too much about it. Everyone has something to learn. I
> think what's important is people being able to take on advice as a
> positive thing and improve their contributions. Eventually you'll be
> the one pointing stuff to others. That's how it works.
> 
>   Trial and error is also the best way to learn, the brain reacts
> better to error. So as long as the build isn't broken i think people
> won't be annoyed with this kind of iterative development, so don't
> worry.

Exactly, I second that.

Best regards,
-Stephan



From superstippi at gmx.de  Tue Jun 12 17:12:09 2007
From: superstippi at gmx.de (Stephan Assmus)
Date: Tue, 12 Jun 2007 17:12:09 +0200
Subject: [Haiku-commits] r21391 - in haiku/trunk: build/jam headers
 headers/private/interface headers/shared src src/apps/showimage
 src/kits/interface src/shared
In-Reply-To: 
References: <200706120354.l5C3s8NI000496@sheep.berlios.de>
	<20070612131100.810.1@cs.tu-berlin.de>
	
	<9c46321e0706120719w6028323bl788be97e475f6acb@mail.gmail.com>
	
Message-ID: <20070612171209.7971.12@stippis.mindwork.office>

Hi Ryan,

Ryan Leavengood wrote (2007-06-12, 16:29:33 [+0200]):
> So to avoid another flurry of responses for my next commit, I plan to
> do the following:
> 
> 1. Move the AboutWindow.h header into headers/private/shared. Delete
> headers/shared/
> 2. Add a Jamfile to src/shared to build it into a static library 
> libshared.a.
> 3. Remove my changes in the build/jam directory.
> 4. Have ShowImage include libshared.a.

4.5 point the ShowImage build to where the shared headers are:

UsePrivateHeaders shared ;

Maybe you already knew, but in case not, hopefully it saved you some time...


Best regards,
-Stephan


From axeld at pinc-software.de  Tue Jun 12 18:12:20 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Tue, 12 Jun 2007 18:12:20 +0200 CEST
Subject: [Haiku-commits]
 =?iso-8859-15?q?r21391_-_in_haiku/trunk=3A_build/?=
 =?iso-8859-15?q?jam_headers_headers/private/interface_headers/shared_src_?=
 =?iso-8859-15?q?src/apps/showimage_src/kits/interface_src/shared?=
In-Reply-To: 
Message-ID: <26116300522-BeMail@ibm>

"Ryan Leavengood"  wrote:
> People already complained about this getting put in libbe (though
> frankly I don't see the big deal.)

It's indeed a matter of preference - I think as a rule of thumb we may 
want to put stuff inside libbe.so that is supposed to become public API 
at some point, and put other stuff, as well as experimental stuff, 
somewhere else.
For something like BAboutWindow, I don't really see the point in having 
it as a public API; it's something that is intended to be used by 
Haiku's own apps only (for the most part).
Having it in libbe.so you always tempt developers in actually using 
experimental API which might create unwanted compatibility issues.

> In regards to headers/shared, I just saw that mentioned somewhere as
> the directory to use for the shared headers. I know of the existence
> of private/shared and had the header there at first ;)

Ah well, probably the one who said that just accidently forget to add 
the "private" part - could have been my fault :-)

Bye,
   Axel.



From marcusoverhagen at mail.berlios.de  Tue Jun 12 18:12:58 2007
From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS)
Date: Tue, 12 Jun 2007 18:12:58 +0200
Subject: [Haiku-commits] r21399 -
	haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML
Message-ID: <200706121612.l5CGCw8w024521@sheep.berlios.de>

Author: marcusoverhagen
Date: 2007-06-12 18:12:57 +0200 (Tue, 12 Jun 2007)
New Revision: 21399
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21399&view=rev

Modified:
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp
Log:
small coding style cleanup


Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp	2007-06-12 14:47:33 UTC (rev 21398)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp	2007-06-12 16:12:57 UTC (rev 21399)
@@ -85,7 +85,7 @@
 OpenDMLFile::IsSupported(BPositionIO *source)
 {
 	uint8 h[12];
-	if (12 != source->ReadAt(0, h, 12))
+	if (source->ReadAt(0, h, 12) != 12)
 		return false;
 	return h[0] == 'R' && h[1] == 'I' && h[2] == 'F' && h[3] == 'F' &&
 		   h[8] == 'A' && h[9] == 'V' && h[10] == 'I' && h[11] == ' ';

Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp	2007-06-12 14:47:33 UTC (rev 21398)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp	2007-06-12 16:12:57 UTC (rev 21399)
@@ -158,7 +158,7 @@
 	uint64 pos = 0;
 	int riff_chunk_number = 0;
 	while (pos < (uint64)fSize) {
-		uint32 temp;
+		uint32 dword;
 		uint32 fourcc;
 		uint32 size;
 		uint64 maxsize;
@@ -170,21 +170,21 @@
 			return B_ERROR;
 		}
 
-		if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) {
+		if (fSource->ReadAt(pos, &dword, 4) != 4) {
 			ERROR("OpenDMLParser::Parse: read error at pos %llu\n", pos);
 			return B_ERROR;
 		}
 		pos += 4;
 		maxsize -= 4;
-		fourcc = AVI_UINT32(temp);
+		fourcc = AVI_UINT32(dword);
 
-		if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) {
+		if (fSource->ReadAt(pos, &dword, 4) != 4) {
 			ERROR("OpenDMLParser::Parse: read error at pos %llu\n", pos);
 			return B_ERROR;
 		}
 		pos += 4;
 		maxsize -= 4;
-		size = AVI_UINT32(temp);
+		size = AVI_UINT32(dword);
 
 		TRACE("OpenDMLParser::Parse: chunk '"FOURCC_FORMAT"', size = %lu, maxsize %Ld\n", FOURCC_PARAM(fourcc), size, maxsize);
 
@@ -217,11 +217,11 @@
 
 		TRACE("OpenDMLParser::Parse: it's a RIFF chunk!\n");
 
-		if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) {
+		if (fSource->ReadAt(pos, &dword, 4) != 4) {
 			ERROR("OpenDMLParser::Parse: read error at pos %llu\n", pos);
 			return B_ERROR;
 		}
-		fourcc = AVI_UINT32(temp);
+		fourcc = AVI_UINT32(dword);
 
 		if (riff_chunk_number == 0 && fourcc != FOURCC('A','V','I',' ')) {
 			ERROR("OpenDMLParser::Parse: not a AVI file\n");
@@ -257,23 +257,23 @@
 	}
 
 	while (pos < end) {
-		uint32 temp;
+		uint32 dword;
 		uint32 Chunkfcc;
 		uint32 Chunksize;
 
-		if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) {
+		if (fSource->ReadAt(pos, &dword, 4) != 4) {
 			ERROR("OpenDMLParser::ParseChunk_AVI: read error at pos %llu\n",pos);
 			return B_ERROR;
 		}
 		pos += 4;
-		Chunkfcc = AVI_UINT32(temp);
+		Chunkfcc = AVI_UINT32(dword);
 		
-		if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) {
+		if (fSource->ReadAt(pos, &dword, 4) != 4) {
 			ERROR("OpenDMLParser::ParseChunk_AVI: read error at pos %llu\n",pos);
 			return B_ERROR;
 		}
 		pos += 4;
-		Chunksize = AVI_UINT32(temp);
+		Chunksize = AVI_UINT32(dword);
 
 		uint32 maxsize = end - pos;
 
@@ -311,7 +311,7 @@
 OpenDMLParser::ParseChunk_LIST(uint64 start, uint32 size)
 {
 	TRACE("OpenDMLParser::ParseChunk_LIST\n");
-	uint32 temp;
+	uint32 dword;
 	uint32 fourcc;
 	
 	if (size < 5) {
@@ -319,11 +319,11 @@
 		return B_ERROR;
 	}
 
-	if (sizeof(temp) != fSource->ReadAt(start, &temp, sizeof(temp))) {
+	if (fSource->ReadAt(start, &dword, 4) != 4) {
 		ERROR("OpenDMLParser::ParseChunk_LIST: read error at pos %llu\n", start);
 		return B_ERROR;
 	}
-	fourcc = AVI_UINT32(temp);
+	fourcc = AVI_UINT32(dword);
 
 	TRACE("OpenDMLParser::ParseChunk_LIST: type '"FOURCC_FORMAT"'\n", FOURCC_PARAM(fourcc));
 	
@@ -378,7 +378,7 @@
 
 	memset(&fAviMainHeader, 0, sizeof(fAviMainHeader));
 	size = min_c(size, sizeof(fAviMainHeader));
-	if ((ssize_t)size != fSource->ReadAt(start, &fAviMainHeader, size)) {
+	if (fSource->ReadAt(start, &fAviMainHeader, size) != (ssize_t)size) {
 		ERROR("OpenDMLParser::ParseChunk_avih: read error at pos %llu\n", start);
 		return B_ERROR;
 	}
@@ -435,7 +435,7 @@
 	memset(&fCurrentStream->stream_header, 0, sizeof(fCurrentStream->stream_header));
 
 	size = min_c(size, sizeof(fCurrentStream->stream_header));
-	if ((ssize_t)size != fSource->ReadAt(start, &fCurrentStream->stream_header, size)) {
+	if (fSource->ReadAt(start, &fCurrentStream->stream_header, size) != (ssize_t)size) {
 		ERROR("OpenDMLParser::ParseChunk_strh: read error at pos %llu\n", start);
 		return B_ERROR;
 	}
@@ -519,7 +519,7 @@
 		fCurrentStream->audio_format = (wave_format_ex *) new char[fCurrentStream->audio_format_size];
 		memset(size + (char *)fCurrentStream->audio_format, 0, fCurrentStream->audio_format_size - size);
 
-		if ((ssize_t)size != fSource->ReadAt(start, fCurrentStream->audio_format, size)) {
+		if (fSource->ReadAt(start, fCurrentStream->audio_format, size) != (ssize_t)size) {
 			ERROR("OpenDMLParser::ParseChunk_strf: read error at pos %llu\n", start);
 			delete [] fCurrentStream->audio_format;
 			fCurrentStream->audio_format_size = 0;
@@ -562,7 +562,7 @@
 		memset(&fCurrentStream->video_format, 0, sizeof(fCurrentStream->video_format));
 	
 		size = min_c(size, sizeof(fCurrentStream->video_format));
-		if ((ssize_t)size != fSource->ReadAt(start, &fCurrentStream->video_format, size)) {
+		if (fSource->ReadAt(start, &fCurrentStream->video_format, size) != (ssize_t)size) {
 			ERROR("OpenDMLParser::ParseChunk_strf: read error at pos %llu\n", start);
 			return B_ERROR;
 		}
@@ -651,7 +651,7 @@
 
 	memset(&fOdmlExtendedHeader, 0, sizeof(fOdmlExtendedHeader));
 	size = min_c(size, sizeof(fOdmlExtendedHeader));
-	if ((ssize_t)size != fSource->ReadAt(start, &fOdmlExtendedHeader, size)) {
+	if (fSource->ReadAt(start, &fOdmlExtendedHeader, size) != (ssize_t)size) {
 		ERROR("OpenDMLParser::ParseChunk_dmlh: read error at pos %llu\n", start);
 		return B_ERROR;
 	}
@@ -687,28 +687,28 @@
 	uint64 end = start + size;
 
 	if (size < 9) {
-		ERROR("OpenDMLParser::ParseList_generic: list too small at pos %llu\n",pos);
+		ERROR("OpenDMLParser::ParseList_generic: list too small at pos %llu\n", pos);
 		return B_ERROR;
 	}
 
 	while (pos < end) {
-		uint32 temp;
+		uint32 dword;
 		uint32 Chunkfcc;
 		uint32 Chunksize;
 
-		if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) {
-			ERROR("OpenDMLParser::ParseList_generic: read error at pos %llu\n",pos);
+		if (fSource->ReadAt(pos, &dword, 4) != 4) {
+			ERROR("OpenDMLParser::ParseList_generic: read error at pos %llu\n", pos);
 			return B_ERROR;
 		}
 		pos += 4;
-		Chunkfcc = AVI_UINT32(temp);
+		Chunkfcc = AVI_UINT32(dword);
 		
-		if (sizeof(temp) != fSource->ReadAt(pos, &temp, sizeof(temp))) {
-			ERROR("OpenDMLParser::ParseList_generic: read error at pos %llu\n",pos);
+		if (fSource->ReadAt(pos, &dword, 4) != 4) {
+			ERROR("OpenDMLParser::ParseList_generic: read error at pos %llu\n", pos);
 			return B_ERROR;
 		}
 		pos += 4;
-		Chunksize = AVI_UINT32(temp);
+		Chunksize = AVI_UINT32(dword);
 		
 		uint32 maxsize = end - pos;
 



From leavengood at gmail.com  Tue Jun 12 18:25:36 2007
From: leavengood at gmail.com (Ryan Leavengood)
Date: Tue, 12 Jun 2007 12:25:36 -0400
Subject: [Haiku-commits] r21389 - in haiku/trunk:
	headers/private/interface src/apps/showimage src/kits/interface
In-Reply-To: <1870336858-BeMail@ibm>
References: <200706110014.l5B0EX0j016409@sheep.berlios.de>
	<1870336858-BeMail@ibm>
Message-ID: 

On 6/11/07, Axel D?rfler  wrote:
>
> Please move these files to src/shared and headers/shared.

Just proving that I'm not crazy, here is the headers/shared reference
I mentioned. It was you Axel :)

Ryan


From darkwyrm at mail.berlios.de  Tue Jun 12 19:00:11 2007
From: darkwyrm at mail.berlios.de (darkwyrm at BerliOS)
Date: Tue, 12 Jun 2007 19:00:11 +0200
Subject: [Haiku-commits] r21400 - haiku/trunk/src/apps/cdplayer
Message-ID: <200706121700.l5CH0BjB003976@sheep.berlios.de>

Author: darkwyrm
Date: 2007-06-12 19:00:00 +0200 (Tue, 12 Jun 2007)
New Revision: 21400
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21400&view=rev

Modified:
   haiku/trunk/src/apps/cdplayer/CDPlayer.cpp
   haiku/trunk/src/apps/cdplayer/CDPlayer.rdef
Log:
Updated button bitmaps to the Haiku-like style agreed upon quite some time ago.
Made some layout tweaks to handle the different size bitmaps.
Sorry I took so long in getting around to this. ;-/


Modified: haiku/trunk/src/apps/cdplayer/CDPlayer.cpp
===================================================================
--- haiku/trunk/src/apps/cdplayer/CDPlayer.cpp	2007-06-12 16:12:57 UTC (rev 21399)
+++ haiku/trunk/src/apps/cdplayer/CDPlayer.cpp	2007-06-12 17:00:00 UTC (rev 21400)
@@ -82,6 +82,10 @@
 	
 	fWindowState = fCDDrive.GetState();
 	fVolumeSlider->SetValue(fCDDrive.GetVolume());
+	if (fVolumeSlider->Value() <= 2) {
+		fCDDrive.SetVolume(255);
+		fVolumeSlider->SetValue(255);
+	}
 	WatchCDState();
 }
 
@@ -131,9 +135,11 @@
 	
 	r.OffsetTo(box->Bounds().right / 2, r.top);
 	fDiscTime = new BStringView(r,"DiscTime","Disc: --:-- / --:--",B_FOLLOW_RIGHT);
+	fDiscTime->ResizeToPreferred();
+	fDiscTime->ResizeBy(10,0);
 	box->AddChild(fDiscTime);
 	
-	box->ResizeTo(box->Bounds().Width(), fDiscTime->Frame().bottom + 10);
+	box->ResizeTo(fCDTitle->Frame().right + 5, fDiscTime->Frame().bottom + 10);
 	
 	fStop = new DrawButton(BRect(0,0,1,1), "Stop",
 							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"stop_up"),
@@ -150,7 +156,7 @@
 								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"play_up"),
 								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"play_down"), 
 								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"play_up_on"),
-								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"play_down_on"), 
+								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"play_down"), 
 								new BMessage(M_PLAY), B_FOLLOW_NONE, B_WILL_DRAW);
 
 	fPlay->ResizeToPreferred();
@@ -160,35 +166,35 @@
 	fPrevTrack = new DrawButton(BRect(0,0,1,1), "PrevTrack",
 								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"prev_up"),
 								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"prev_down"),
-								new BMessage(M_PREV_TRACK), B_FOLLOW_BOTTOM,
+								new BMessage(M_PREV_TRACK), 0,
 								B_WILL_DRAW);
 	fPrevTrack->ResizeToPreferred();
-	fPrevTrack->MoveTo(fPlay->Frame().right + 10, stopTop);
+	fPrevTrack->MoveTo(fPlay->Frame().right + 20, stopTop);
 	AddChild(fPrevTrack);
 	
 	fNextTrack = new DrawButton(BRect(0,0,1,1), "NextTrack",
 								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"next_up"),
 								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"next_down"),
-								new BMessage(M_NEXT_TRACK), B_FOLLOW_BOTTOM,
+								new BMessage(M_NEXT_TRACK), 0,
 								B_WILL_DRAW);
 	fNextTrack->ResizeToPreferred();
-	fNextTrack->MoveTo(fPrevTrack->Frame().right + 2, stopTop);
+	fNextTrack->MoveTo(fPrevTrack->Frame().right + 1, stopTop);
 	AddChild(fNextTrack);
 	
 	fRewind = new DoubleShotDrawButton(BRect(0,0,1,1), "Rewind", 
 								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"rew_up"),
 								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"rew_down"),
-								new BMessage(M_REWIND), B_FOLLOW_BOTTOM, B_WILL_DRAW);
+								new BMessage(M_REWIND), 0, B_WILL_DRAW);
 	fRewind->ResizeToPreferred();
-	fRewind->MoveTo(fNextTrack->Frame().right + 10, stopTop);
+	fRewind->MoveTo(fNextTrack->Frame().right + 20, stopTop);
 	AddChild(fRewind);
 	
 	fFastFwd = new DoubleShotDrawButton(BRect(0,0,1,1), "FastFwd", 
 								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"ffwd_up"),
 								BTranslationUtils::GetBitmap(B_PNG_FORMAT,"ffwd_down"),
-								new BMessage(M_FFWD), B_FOLLOW_BOTTOM, B_WILL_DRAW);
+								new BMessage(M_FFWD), 0, B_WILL_DRAW);
 	fFastFwd->ResizeToPreferred();
-	fFastFwd->MoveTo(fRewind->Frame().right + 2, stopTop);
+	fFastFwd->MoveTo(fRewind->Frame().right + 1, stopTop);
 	AddChild(fFastFwd);
 	
 	r.left = 10;
@@ -201,10 +207,10 @@
 	AddChild(fVolumeSlider);
 	
 	fRepeat = new TwoStateDrawButton( BRect(0,0,1,1), "Repeat", 
-							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"repeat_up"),
+							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"repeat_up_off"),
 							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"repeat_down"), 
 							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"repeat_up_on"),
-							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"repeat_down_on"), 
+							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"repeat_down"), 
 							new BMessage(M_REPEAT), B_FOLLOW_NONE, B_WILL_DRAW);
 	fRepeat->ResizeToPreferred();
 	fRepeat->MoveTo(fPrevTrack->Frame().left,
@@ -213,24 +219,25 @@
 	AddChild(fRepeat);
 	
 	fShuffle = new TwoStateDrawButton(BRect(0,0,1,1), "Shuffle", 
-							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"shuffle_up"),
+							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"shuffle_up_off"),
 							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"shuffle_down"), 
 							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"shuffle_up_on"),
-							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"shuffle_down_on"), 
+							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"shuffle_down"), 
 							new BMessage(M_SHUFFLE), B_FOLLOW_NONE, B_WILL_DRAW);
 	fShuffle->ResizeToPreferred();
-	fShuffle->MoveTo(fNextTrack->Frame().left + 2,fRepeat->Frame().top);
+	fShuffle->MoveTo(fRepeat->Frame().right + 2,fRepeat->Frame().top);
 	AddChild(fShuffle);
 	
 	fEject = new DrawButton(BRect(0,0,1,1), "Eject",
 							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"eject_up"),
 							BTranslationUtils::GetBitmap(B_PNG_FORMAT,"eject_down"),
-							new BMessage(M_EJECT), B_FOLLOW_BOTTOM, B_WILL_DRAW);
+							new BMessage(M_EJECT), 0, B_WILL_DRAW);
 	fEject->ResizeToPreferred();
 	fEject->MoveTo(fFastFwd->Frame().left, fShuffle->Frame().top);
 	AddChild(fEject);
 	
-	ResizeTo(fFastFwd->Frame().right + 10, fVolumeSlider->Frame().bottom + 10);
+	ResizeTo(box->Frame().right + 10, fVolumeSlider->Frame().bottom + 10);
+	
 }
 
 
@@ -259,7 +266,7 @@
 				fWindowState = kPaused;
 				fCDDrive.Pause();
 				fPlay->SetBitmaps(0, BTranslationUtils::GetBitmap(B_PNG_FORMAT,"paused_up"),
-									BTranslationUtils::GetBitmap(B_PNG_FORMAT,"paused_down"));
+									BTranslationUtils::GetBitmap(B_PNG_FORMAT,"play_down"));
 			} else if (fWindowState == kPaused) {
 				fWindowState = kPlaying;
 				fCDDrive.Resume();

Modified: haiku/trunk/src/apps/cdplayer/CDPlayer.rdef
===================================================================
--- haiku/trunk/src/apps/cdplayer/CDPlayer.rdef	2007-06-12 16:12:57 UTC (rev 21399)
+++ haiku/trunk/src/apps/cdplayer/CDPlayer.rdef	2007-06-12 17:00:00 UTC (rev 21400)
@@ -102,1187 +102,364 @@
 
 #endif // HAIKU_TARGET_PLATFORM_HAIKU
 
-resource(1, "play_up") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D4948445200000032000000180806000000B808AE"
-	$"E10000058C494441545885DD97CD4F135B18C67F33D36FA8B4298552D028A049"
-	$"054D8C2E3429BA7767A2D1F8471813E35ED7FE31EEDCE94AD3A80B100D1A455A"
-	$"4B11690B96D6997666CECCB98B66062A55C315BDC97D926EDE994CDFE73CEFC7"
-	$"739477EFDE49FE0750FFEB040E0A819F3D945262DB369D4E07C330304D13DBB6"
-	$"FD677F128AA21008040887C3C46231A2D128C160104551FABEDF9788E338E8BA"
-	$"4EB55A657575954AA542AD56A3D96C625916AEEBFE5112009AA611894488C7E3"
-	$"A4D369B2D92CD96C96743A4D3C1E271008F4905276F7889412D334F9FCF933F3"
-	$"F3F3BC7CF992F5F575B2D92C333333249349464747FF3889DDF9542A15B6B7B7"
-	$"29168B44221172B91CB3B3B38C8D8D118D465155752F914EA7C3FBF7EF79FCF8"
-	$"310B0B0B5CBE7C992B57AE30313181EBBAB8AE8B94D2FFFD0DEC3EF562B1C8D3"
-	$"A74F310C8353A74E71E4C81106060650146587886559ACACACF0E8D123CAE532"
-	$"F7EFDFE7F8F1E3D8B68D6DDB0821705DD7EF1155557F58AF074D4451949EFF2B"
-	$"954A2C2D2D71F4E851C6C6C60887C3DD1E9152B2B9B949A150E0EDDBB73C78F0"
-	$"80C9C949BFC18510BE02AF5EBDA2582C128FC7999E9E2693C9100E87F7955CB9"
-	$"5C666969898D8D0D2CCB229D4E333B3B8B94928F1F3FEE894F4C4C1089445055"
-	$"155555191F1F27100850A954FC7E090098A649B15864717191DBB76F33353545"
-	$"BBDDC6344D1CC7E949A2D16860DB36F57ADD27343535C5D4D414870E1D42D3B4"
-	$"5F12A9D7EBD46A3592C92442089ACD26F3F3F31C3B76AC6F7C727212C02F6D45"
-	$"514824127CFBF60D2925AEEB7689E8BACEEAEA2AD96C96B9B9394CD3EC4B0220"
-	$"1289D06C36D9DCDC24140A110C0679FDFA358B8B8B64B35972B9DC2F55D2340D"
-	$"C771585E5E666B6B8B8D8D0D2E5CB840341AED1B0F87C37BC6BE6DDB341A0DD2"
-	$"E934A150A84BC4B22C5AAD16F97C1EDBB6B12CAB2F090F8EE3B0B5B5C5F6F636"
-	$"A15088E1E161464747A956ABBEDC3F534951145CD7A5D16850AFD7FD91AEAA6A"
-	$"DFF8F7BD28A5C4711C5AAD16EBEBEB9C387162A74714452193C9E038CE4F497C"
-	$"FF41D334595B5BE3CB972FC4E3713299CCBF5269BF90522284A05AAD92CBE576"
-	$"16A2A669048341BF0EF70BC77168341A3D2A45A351745D27168B313E3E7E6024"
-	$"3C4829D1751D5555BB44144541D3341445F9EDFDE095DDA74F9F300C83B9B939"
-	$"52A914D168D4AFF38380EBBA0821104274ED0C74D50887C3BF45C4B22C745DA7"
-	$"D56A118FC7B979F32657AF5E25994C62591696651D1809002104BAAEFBFE2B00"
-	$"DD49944AA5B02C6B5F5BDB755DDAED36AD560B5DD7397FFE3C376EDC209FCF23"
-	$"84C0344D9ACDE681BB002925866150AFD7999C9CDC21128BC5989898C0300C1C"
-	$"C7F1C9FC68733B8EC3DADA1A9B9B9B0C0C0C70FDFA75AE5DBBE61F46B3D9FCE9"
-	$"C0482412BE8F6AB7DBBE5AC964B26FFCFB3CBC01532A95B878F1E20E914020C0"
-	$"F8F838E572995AADE6DB67AFDC766366668667CF9E313D3DCDDDBB77B974E9D2"
-	$"BE4FFFF0E1C3CCCECEF6D4B8E79DFAC577430841A552E1C58B171886C1D9B367"
-	$"711CA7D734EABACED7AF5FA956AB24120946464688C562BEC384AEC712423034"
-	$"348410E2973BA71FBCE1120C06FD6F7BCD2BA5DC13F7FC9E699A94CB659E3C79"
-	$"42A150E0DEBD7B9C397306C3307AEF238383830C0E0ED26EB759585860787898"
-	$"6C36CBF0F030B158CC1FCFAAAAD26AB5F695FC6E783B4008D1F7B917F7EC8777"
-	$"C01F3E7CA05028B0BCBCCCAD5BB73877EE1CED76BBABDE6E453C97A9AA2AC562"
-	$"91870F1F228460646484542A452412F1DFFB1BF09ABA56ABB1B2B242A9542293"
-	$"C970E7CE1D4E9E3C49A7D3A1D3E9EC25E225A9699ABF579E3F7F4EA150E0CD9B"
-	$"37BFA5C2EF60686888D3A74F333737473E9FC7719C1E3F28A5DC4B047694F1EA"
-	$"381008A0695A4FAFFC2D78EA7B65E67941DBB67BAEDC7DEFEC9E29735D17C771"
-	$"7C12DE25E76FC29B82DE0DD5CBEB7BFC03C1F89BC3576D54330000000049454E"
-	$"44AE426082"
-};
 
-resource(2, "play_down") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D4948445200000032000000180806000000B808AE"
-	$"E10000055A494441545885DD98CB4F135D18879F33D7DEA9B4C52276869810A5"
-	$"6D4A8C89C685A0511259E025FE31AE8D6B5C98B8F02F70A92B638C3B5C617445"
-	$"4C415262C1404BA1B6D80EBD4CFB2DC80C2255BC7D7CC9F7262769DEB4E79C67"
-	$"DEDF7B998A6C36DBE57F60D27F7D81BF65CA615F10422084409224F7F35159B7"
-	$"DB7557A7D3A1DBFDBE787A82381797651945515014E500C88F36FD5BE640D8B6"
-	$"BD6FF5823A002284405555745D47D3346459666D6D8DF9F979CAE532EBEBEB47"
-	$"060270F2E44942A110E9749A70384CBBDDA6DD6EBB403D412449425555BC5E2F"
-	$"9AA6F1E2C50B9E3E7D4A3E9F47D334229108C160108FC78324FDBBE9E5442397"
-	$"CBF1E5CB171A8D06C3C3C34C4D4D914EA7DD07E9C008A76A0921D0340DAFD74B"
-	$"AD56E3DEBD7B2C2C2C904AA548A5529C3871C2855014E5C8A4D56AB5B02C8B6A"
-	$"B54AA150A0542A619A2657AE5C41966517D8055114059FCF871082BB77EFB2B1"
-	$"B1C1B56BD7181B1B231A8DA2EB3A42083C1E0F9665E1F7FB69369BD8B6FDCB50"
-	$"AAAABAB205B06D9B66B3E9CAFA5BBF23A75AADC6C6C606EBEBEB84422192C924"
-	$"8AB22B2A05F624A5280A333333944A25A6A7A73977EE1CA150685FA5124270FF"
-	$"FE7D2CCBE2E6CD9B4C4C4C00D06AB5F669F64726CB324F9E3CE1E5CB9700689A"
-	$"C6D5AB57B97DFB764FFFF5EBD7916599502884D7EB25140AB1B5B5453E9F2714"
-	$"0A11894476FB8810025996C966B3CCCDCD313E3ECED8D8D80108D8D5A4A228E4"
-	$"F3791E3C78C09D3B7778FCF831A55209AFD78BA2288796E84EA743B158647373"
-	$"935AAD866559140A05F2F97C4F7F2E97DB17CDBEBE3E4CD364707090D5D55536"
-	$"37377723E21CFCF6ED5B464747DD0AF1BD0B0921D0759D6030886DDBBC7AF58A"
-	$"67CF9E914C26B971E3C64F4749D334745D27168B016059D60FFD5FC34892E4AE"
-	$"4F9F3EED75F64EA743AD56C3300CFAFBFB5D9D1E66B22C130804387EFC386B6B"
-	$"6BBF1DA55F31A79FC9B28CC7E3A15028EC95DF6EB78B2CCB048341344DFBADCD"
-	$"755D47D775374ACF9F3F2793C9303939C9D9B3677F6BDFC3CE9465994AA5D2BB"
-	$"8FFC498F505515C330181E1E261A8D52AD56C9E7F3C4E3710CC3F8EB91E976BB"
-	$"349BCD5D106796714ADFEF1C160E87310C83442281A669ACACAC303737C7C0C0"
-	$"00E9749A4020F0AFC8CBE9F2FB40C2E1F02F6DA6AA2A83838398A6492C16637B"
-	$"7B9BC5C5456CDB66646484CB972F6318C65F9794032249125B5B5B74BBDD5D10"
-	$"A7B20C0D0D5128140EDD4496654E9D3A452693C1E3F1B0B2B2C29B376F88C562"
-	$"5CBC7891D3A74F138944BEFB7BA784472211128904C16010455168341A3DFDDF"
-	$"563E21843BCC7EF8F0015DD7F722D26EB7E9EFEFA75EAFBBF2EAD5B11B8D065E"
-	$"AF17D334595A5AA2D56A313232C2F8F838A669FED4D3DFD9D9211E8FBB13B5A2"
-	$"28349B4DEAF57A4FFFB70DD9196A2B950AEFDEBD637A7A7A2FD9DBED36F57ADD"
-	$"9D7A25497225F7B56D6F6F73E9D22572B91C172E5CE0CC99333F7CFADF8B4826"
-	$"936179799972B98CAAAA1C3B768C818101E2F1F8017F3C1E07768B91A228EE50"
-	$"FBE8D12357DAEEAC65DB36954A858F1F3F12080448A5520821E8743AEE720634"
-	$"E7323FDB6BFEC4BEEE194EA3545595870F1FF2FAF56B6EDDBAC5F9F3E7F72222"
-	$"49127EBF9F68344A369B65797999C9C94982C1E03E80A33607C2C98962B1C8CC"
-	$"CC0C4B4B4B4C4D4D91C964F0FBFD7B1181DD5C69341A148B45DEBF7FCFC2C202"
-	$"8661904EA7492693F4F5F5FD2720D56A95F9F979666767999D9D259148303131"
-	$"41269371A710F1EDBF284EE257AB55565757C966B32C2E2EB2BABACACECECE91"
-	$"8338A6691AA669924EA7191D1D656868089FCFE736EF03208E392F35B55A8D72"
-	$"B9CCE7CF9FB12C8B76BB7DA4004E950A040284C361C2E1303E9FEF407EFE0305"
-	$"E18E28D5D1C2910000000049454E44AE426082"
+resource(1, "stop_down") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D494844520000001C00000015080300000062DC7E"
+	$"6E0000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C00000021504C54451818"
+	$"18BFBFBFCECBCE101010848284000000E7E7E76361637B7D7B2124216365639D"
+	$"66D1620000008E4944415478DA6260C203000288818985031760010820A02403"
+	$"330EC0021040404966561C80052080C0920CD8010B4000E19504082024494618"
+	$"804B0204105E498000C22B0910407825010208AF244000E195040820BC920001"
+	$"8457122080F04A020410DE10020820BC920001049264E0C40E5800020828C9C9"
+	$"8503B000041050921D27000820062636DC0020C0004B4D065C99EE4871000000"
+	$"0049454E44AE426082"
 };
 
-resource(3, "stop_up") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D49484452000000280000001808060000008884BF"
-	$"C00000040A494441544889CD974D4B1B5D1886AF331F4E342A1A4DACA0A52014"
-	$"51514144B70177C17FE0C29FE02FE84F125C883B5DD82E5A2A82204610C40F24"
-	$"895131D19993C939335D84999A6AACD0F0FADE90CDCC49E6CA7D9EE73ECF887C"
-	$"3E1FF23F96F1DE007F93D5EA86D61A2925AEEBE2791EBEEF031086FF6EB81082"
-	$"8E8E0E92C924C96412DBB6314DF36D805A6BAAD52A9797979C9C9C707E7ECEDD"
-	$"DD1DB55A8D2008FE190EC0344D7A7A7A181A1A627474944F9F3E91C964482693"
-	$"CF40C5D31A544A512814F8F9F327BBBBBB542A15E6E6E6F8F8F1238383836D81"
-	$"83DFBB70727242A954C2711C666767F9FCF933FDFDFD4D90B1834110707D7DCD"
-	$"D7AF5FD9DADA2297CBB1BABA4A229140294510048461D8962D8E94CD6609C390"
-	$"D3D3537EFCF8412291C0B66D7A7A7A308C467BC40E562A15BE7FFFCEFAFA3A2B"
-	$"2B2B2C2F2FE3FB3E52CA2640002925C562916AB54ABD5E6F09D0D9D9492693A1"
-	$"B7B717CB6AAE262144FC01A8D56A1C1D1D313838483A9DA6A3A3032144C341AD"
-	$"35854281BDBD3D262626C8E572789EC7E3E323F57AFD996BA552896FDFBE21A5"
-	$"7C15309148303232C2C2C2028EE3BCB8E629642A952208029452589685699A0D"
-	$"40292567676794CB65D6D6D6F07D1FD7755F848BFE90D69A818101EEEFEF5B02"
-	$"160A05A49464B359B4D62FAE795A366118A2B56EEA6A0BC0755D8AC522D3D3D3"
-	$"A452A9D89956F5669A268661707C7CCCD9D9594B402925333333D8B6DD123092"
-	$"1002C330C8E7F38C8D8D018DBE30A0D1BDBEEF33313181528A7ABDDEB64879AB"
-	$"C2302408026E6E6E705D17C3301AD0D14D21047D7D7D68ADFF73B8484110E0FB"
-	$"3E954AA519101A165B96D5D4ADEF21AD35F57A3D8E991830BAF09E70D136470C"
-	$"B1838661E0384EDCEEEF25AD35B55AAD297A0C68E4556F6F6F1CC8EFA12008F0"
-	$"3C8F6AB54A5757577CDD8A003F7CF8C0C3C3C39B6AB0B3B3936432C9E9E929D5"
-	$"6AB5E5BA28AADEB233524AAEAEAEB8BDBD259D4E038D2DB7001CC761787898CB"
-	$"CB4B945271784675F9A7FAFAFA989A9AE2FAFAFAD5934408C1E4E4E45F018320"
-	$"A0542A91CFE7C9643274777723A5FC0D2884209D4E53ABD5B8BABAC2308C7856"
-	$"7B095208C1D8D818E3E3E3D8B6DDF2C151D147B3642BB872B9CCFEFE3E070707"
-	$"7CF9F225FE1E3C99664CD3646464844AA5C2E1E1218661303434442A95C2719C"
-	$"26D0300C514AA194C2F3BC57DD790DCCF33C8AC5227B7B7BECECEC90CD66999B"
-	$"9BC3F3BCF8E4699A07A3EEB9BFBF676363032925A9548AAEAE2E4CD36C6B97FB"
-	$"BE4FB95C269FCF737171C1D2D2126B6B6B68AD715D17A5D4734068448E699A68"
-	$"ADD9DEDE6673739342A1D036B03F353F3F4F2E9763717111DFF7F13CAF690E78"
-	$"0618B9685916B66DC79345BB33F2E9EF45F9E7FB7EDCA4919EBD93441D1C0D0C"
-	$"4AA9F85C6CB7A26745E3DB4B19FC0BDC9765EE564806600000000049454E44AE"
-	$"426082"
+resource(2, "stop_up") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D494844520000001C00000015080300000062DC7E"
+	$"6E0000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C0000001B504C54459C9A"
+	$"9CDEDBDE636163EFEFEFCECBCE848284404040FFFFFFE7E7E724E86FE5000000"
+	$"8C4944415478DA6260C10300028881851537000820A02407330EC00A10404049"
+	$"66761C80152080C0921CD8012B4000E19504082024493618804B0204105E4980"
+	$"00C22B0910407825010208AF244000E195040820BC9200018457122080F04A02"
+	$"0410DE10020820BC9200010492E460C40E5801020828C9C88003B00204105092"
+	$"092700082006160EDC0020C00066DB0D59EF1DF8F60000000049454E44AE4260"
+	$"82"
 };
 
-resource(4, "stop_down") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D49484452000000280000001808060000008884BF"
-	$"C0000003D8494441544889CD974D4BF34C1486EF4966DA249AD86A6A6A288814"
-	$"A90852F003B41415FF82E0CF72256EC47F2076A73B7956E22250104451107563"
-	$"15BF522D98E6639E8524B6D5DA07ACAFEFBD69CA0C996BCE99B9CF09393939E1"
-	$"F81F4BF86D804EA2ED0608212084401084E8B99BE29C230882E8F79F0143284A"
-	$"291863A094360172DE9D13110401822080E779F03C0FBEEF7F0ADA04480801A5"
-	$"14922421168BC1F77D589685CBCB4BDCDEDE76151000B2D92CC6C6C6609A265C"
-	$"D78D201BD7208D9784520A5996214912767676B0B9B9895AAD065DD7914C2611"
-	$"8FC7218AE2B7C138E7F03C0FAFAFAF701C07B95C0E2B2B2BD034ED43CA234041"
-	$"1022B88D8D0D944A25E4F379E4F379188601455140E95BC04551443C1E8FFEB7"
-	$"531004701C079EE77D887C38F6F4F484BBBB3B00C0E2E22254550521249A4F81"
-	$"F7D432C66059164AA512969696502C1661180662B158D3CB1963B06D1BE572B9"
-	$"63CA0DC3C0E8E868DB71DFF7F1F2F2828787075C5D5D41D775E8BA1E65AA09B0"
-	$"5EAF637D7D1DD3D3D328140A304DF3D3941242707C7C8CD5D5D50FF08D922409"
-	$"737373505515E974FAD339A22842555530C6E0380E9E9F9F51AFD7A3B529F096"
-	$"5E4110707070004A29262727914EA7DB9E37CE3938E7D0340D7D7D7D6D010706"
-	$"062049122A954A5BC070FD783C0E4551A0691A2CCB82AAAA482412EF46CD39C7"
-	$"F9F93946464690C964BE8CCC4F48100488A208599661DB361E1F1FC1396F0674"
-	$"1C07A9540A8AA274DD983B29F4DA306BD56A15BEEF3703863BE8743B7F1A9273"
-	$"8E5AAD06CFF39A6B717859FEEBE8B532F8BE0FCFF31004C11B6078E845518420"
-	$"FC6EFF400889E0A23318BA776892BFA5D04DAAD56A044B4340DFF731343484EB"
-	$"EBEB8EE61BEEAEB7B717B95CAEEDBCD0DF7CDFFF27B8F078552A158C8F8FBFFB"
-	$"601841D334A3B2D3586E5AE5BA2E186328140A5FD6665114E1384EC7AC1042C0"
-	$"18432C16C3E9E929EAF53A344D03A5B4398200A0EB7AD4038663ADE29C2393C9"
-	$"80738E4AA5D276614A291289044CD3FC12AEB183DADEDE866118482693EF110C"
-	$"A3E5BA2E822000630CA22846916DEDD344518C6AE6772408021863906519B22C"
-	$"636F6F0F676767585E5E46229178DB64E3A29224811002CBB2303333F36519FB"
-	$"AE42538EC562608CE1CF9F3F585B5BC3FCFC3C72B91C64596E0624844092240C"
-	$"0E0EC2B66D6C6D6D61787818B3B3B3300CE347DA7E4110502E97B1BBBB8BFDFD"
-	$"7D2C2C2CA0582C22954A4576475ABFEA7CDF47B55AC5C5C5050E0F0F71747484"
-	$"9B9B9BAE82B54266B3594C4D4D6162620286618031168D7F0004DEEBB26DDBB8"
-	$"BFBF876DDB705DB7ABED7E78397A7A7A904C26D1DFDF0F45513E148ABF65E2B1"
-	$"4C85DC674C0000000049454E44AE426082"
+resource(3, "shuffle_up_on") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D494844520000003A000000150803000000209F0D"
+	$"F90000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C000000DE504C54456D6D"
+	$"6DDCDCDCC6C6C6D1D1D15656566161614B4B4BAFAFAFA4A4A48E8E8E69BA59E9"
+	$"E9E9E8E8E86CBB5CD8D8D886C87AE3E3E33F7035EBEBEB4F6A4BA7C7A1979797"
+	$"577452D2D2D2579A4A91BD87C3C3C3727D7042753894CE89838383B2B2B2DEDE"
+	$"DEECECEC85BF7885C77884BE788AA385EAEAEA9D9D9D9A9A9A559748F0F0F0AD"
+	$"C1A97D8B7A62AE53CCD8CA597753A8A8A892B38BE4E7E3788A74EBECEBD9D9D9"
+	$"529045B7B9B7BCBCBC8DA788C2CEC0EDEDED599E4B8C8C8CAAD8A1404040BABA"
+	$"BADEDBDE9C9A9CEFEFEF636163848284CECBCE999999FFFFFFE7E7E7FF841062"
+	$"0000019D4944415478DA6270231B000410839B2B99C0132080805A3D9DC9008E"
+	$"2E9E000104D4EAEC413AF07472F1040820B0564F928123502B400051A0152080"
+	$"30B5323A38307A3231200BB933B8833007278A5680008269E593175597520032"
+	$"98D95859183C1DEC917432D9B3B383B03B038A568000826A15B795B634543537"
+	$"05DAC002D40ED4CAE8C0ECE909B29FD9D3DDDE81118C815A99814250AD000104"
+	$"D56AA06327CBAFACC227E0C96ECF099474B067616563F6B477F004BA95D59E81"
+	$"0984815A39D840C210AD000104D5AA21C9CFC5C56BA60714656761E3006AE500"
+	$"E9836805B91E84815A59381D58DCA15A010208AAD54289978B4B57C68A1B144E"
+	$"9CF64C2095D8B4DAB332307040B50204102C9844346D2404C54CB881FEF464B4"
+	$"77806B656243B5550E114C000104D5CAC3ADAD2F6C6CA40894B7676083843050"
+	$"2B2B0B0BAA56763656569883010208662B8F9AB596B310382A1C9840910B0E5E"
+	$"6030034318C4016166B08403CC568000A22035010410055A010208A4D5D39174"
+	$"00D40A104040AD8E4E640057174F8000026A75210F78020410839B27B90020C0"
+	$"0028E229A6998C9D9D0000000049454E44AE426082"
 };
 
-resource(5, "play_down_on") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D49484452000000320000001808030000008FD65E"
-	$"D30000000467414D410000AFC837058AE90000001974455874536F6674776172"
-	$"650041646F626520496D616765526561647971C9653C00000234504C5445DADA"
-	$"DA74747490BA88D9D9D9767676565656DCDCDCE4E4E4D7D7D7404040DDDDDDDB"
-	$"DBDBD5D5D5E6E6E6E3E3E3E8E8E8B7B7B7AAAAAADFDFDFB3B3B3667962D6D6D6"
-	$"E1E1E1E0E0E04A4A4AD2D2D282A87B7A7A7AA9A9A99D9D9DE7E7E7B4B4B4EAEA"
-	$"EA414141A2A2A2D0D0D0CCCCCC444444E5E5E58D8D8D959595C5C5C5C3C3C3A6"
-	$"A6A69E9E9E909090CFCFCF7B7B7BCBCBCBEEEEEEB1B1B18A8A8A888888656565"
-	$"C1C1C1969696BEBEBEB6B6B6818181393939ABABABBCBCBC8C8C8C8FB987B0B0"
-	$"B0BBBBBB313131A7A7A7A1C59B939393B9B9B95E5E5EEDEDED89B18193BC8B96"
-	$"9E959F9F9F727D6FE5E5E4546A4F67856175976E3C3C3C5D5D5D3D3D3D6A6A6A"
-	$"919191C3C6C27979798484849A9A9A787878808080C6C6C6777777878787D3D3"
-	$"D3B5B5B5535353565D5581A67A74966DCECFCD5C5C5C989898606E5DC2C2C2EF"
-	$"EFEFA8A8A8CECECEBDBDBDCACACA69696985A07F97A9944848489B9B9B878987"
-	$"8F8F8F3638355050508B8B8B2D2D2D454545494949DADCDA7373736D82693335"
-	$"337E7E7E8E8E8EB6CBB298A69551515171896C6D6D6D7272725B5B5B3F3F3FB4"
-	$"D0AFC0C0C08DB685C0D8BB616161B4C9B1BCD5B76785626E766C5B6A58D4D4D4"
-	$"98A8958989899292925B75567883762C2C2C9AA996ABCBA45B6C58BABABAD1D1"
-	$"D1C7C7C754545499C092AFAFAF677963626262666666A1C49ABFD7BBB4D0AE54"
-	$"5A52BBD5B6768174EBEBEB949494555555C9C9C9676767BFBFBFE9E9E97F7F7F"
-	$"ECECECE2E2E2DEDEDE373737999999D8D8D812C74088000002A14944415478DA"
-	$"62D84D3200082006D2B50004105C0B33031BD70EDC808B8D9B19AA122080205A"
-	$"98B9776CE7E5DFA2A0B00517E0976317DB01D1051040602DCC3BD4D619F2C864"
-	$"C4C46CC5094A6478D4C4B840CA0102088C85F80DB537EC0CA90836DD84032C37"
-	$"0D6E950815166203AA070820206216E2E772DFB94CDD593ECF6C332E60E1E6A0"
-	$"541967CEC1C0BC1B2080805AD878E5DC6BD46D953976F3D66E114709422E3E5E"
-	$"5E3EAE1D609299273F51D68687991920801876338829C449986FE400AAE0CF9C"
-	$"E2EDA7C686D0226EACAA2AA1BE034CF2ECDE9DA06524A0B91B2080187673B367"
-	$"299A688274EC665F9A1AE0EF1BCE0FB76A07A393B5224B0F981406F225959565"
-	$"3401028861371B7B59A83C0F5805BB8894BD67E0CC7970AB7630EEE464651100"
-	$"9382403E0733B78D20400001B56C8F3489DD0DD3C2C4C4D49B02B70A5DCB6E86"
-	$"1DC2AE000104D42216AFA182AC85890968D5A4B696346C5A842C23010208A465"
-	$"7A542EAA162F97EE95D326EB8862D1229ED808104040EF0B35C9EA216B593C77"
-	$"E284B50D418CF2586CE11633D2070820602073E9E820B478B9ACEA9BB3BA6A91"
-	$"B90A36EFEF66E3F391060820500270538269A95FB1A6795679509D3C3490D9A2"
-	$"2536314A3B80C91C5062149793B602082086DD1CA2064B24A109BBB0287976D2"
-	$"7A1578544ED595D6DF1AA10D266540C9576E77B106400001B5489A59EEE60647"
-	$"DEE6D2A40E61E4042369216B17A6640B26CD80212CE7D1DE2F0F104040A53CB1"
-	$"CEC23B84B8809941545412675E6466E0E253C8B6AAD630000820A0168E058EAE"
-	$"3338D8F9B6E3057CBC0A86BB4D158DB544010208E4200EE5F9BA05F1C25CDBF0"
-	$"010F2161166B560D2D9EDD000104F6034782A68C5567D74EFC2024DDC4484574"
-	$"F76E800082A6590EC98596DAB2BBF080281F1B470370EA05083000046D3BA66A"
-	$"AC00DE0000000049454E44AE426082"
+resource(4, "shuffle_up_off") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D494844520000003A000000150803000000209F0D"
+	$"F90000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C000000D5504C54456D6D"
+	$"6DDCDCDCC6C6C6D1D1D16161614B4B4B565656AFAFAFA4A4A48E8E8EC4C4C4EB"
+	$"EBEBE9E9E9D5D5D5CACACAC5C5C5D0D0D09DA19C757874E5E7E4C6CFC5A2A2A2"
+	$"DDDDDD8A9288939593ECECECF2F2F2B8B8B86B706AABB0AAEFF0EFBABFB97B7B"
+	$"7BCBCBCBBBC2BA989898F5F5F59F9F9FF0F0F0A7B9A4838383686C67CFCFCF67"
+	$"6767BFBFBF595C58A6B0A48A8A8A7A7A7A5D605DDFDFDF6B6B6B767676636363"
+	$"BCC3BB555555656964A6A6A6F4F4F4ADBBAA404040BABABADEDBDE9C9A9CEFEF"
+	$"EF636163848284CECBCE999999FFFFFFE7E7E7D832BDA00000019D4944415478"
+	$"DA6270261B00041083B31399C00D2080805ADD1CC800768E6E000104D4EAE04A"
+	$"3A70B37774030820B0563792811D502B400051A015208030B532DADA32BA3131"
+	$"200BB930B8803007278A5680008269E5D33735E6E00532985959D818DC6C6D90"
+	$"7432D9B0B383B00B038A568000826AD531D7159415975004DAC006D40ED4CA68"
+	$"CBECE606B29FD9CDC5C696118C815A99814250AD000104D56A2023C62BA065CD"
+	$"67E4C66EC30994B4B56163616576B3B17503BA95C586810984815A395841C210"
+	$"AD000104D5AA2D2FC0C5C5AF2C0214656763E5006AE500E9836805B91E84815A"
+	$"D9386DD95CA05A010208AAD5C58C9F8B4B5A41891B144E9C364C2095D8B4DAB0"
+	$"30307040B50204102C98D4552D454D2CE4B881FE7463B4B1856B656245B55503"
+	$"114C000104D5CAC3ADA7692824AC0694B76160858430502B0B1B1BAA56765616"
+	$"169883010208662B8FA4948A9503382A6C9940910B0E5E6030034318C4016166"
+	$"B0842DCC568000A22035010410055A010208A4D5CD8E7400D40A104040AD76F6"
+	$"64002747378000026A75240FB801041083B31BB90020C0003F2F1CF1AA88B47B"
+	$"0000000049454E44AE426082"
 };
 
-resource(6, "play_up_on") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D49484452000000320000001808030000008FD65E"
-	$"D30000000467414D410000AFC837058AE90000001974455874536F6674776172"
-	$"650041646F626520496D616765526561647971C9653C00000237504C5445DEDE"
-	$"DE90BA88747474767676D7D7D7565656DADADA404040D9D9D9787878E1E1E1B4"
-	$"B4B4E3E3E3D0D0D0DBDBDBE8E8E8D2D2D2CACACADDDDDDAAAAAA9AC092E0E0E0"
-	$"DFDFDF8BA287EDEDEDAFAFAFB7B7B7EAEAEAE4E4E4CCCCCCA1A1A1BFBFBFBCBC"
-	$"BC9797977B7B7B9E9E9E9898986666667D7D7DD6D6D6A9A9A9888888D5D5D5BE"
-	$"BEBEB9B9B93D3D3DAEAEAEC5C5C56D6D6DC9C9C9868686E5E5E5EBEBEB545454"
-	$"818181757575B1B1B1909090676767CDCDCDD4D4D47979798D8D8DB6B6B6C8C8"
-	$"C87171716B6B6B6060605B5B5B7A7A7AC2C2C27373738A8A8AA6A6A6A7C8A1C1"
-	$"C1C12B2B2B3131318383835256517F8E7CADADAD94BD8D4F504FC0C0C0B2B2B2"
-	$"8CB584707070E9E9E9949494667064F0F0F0575757BABABA9F9F9FB8B8B8A0C4"
-	$"996E6E6E3A3A3AEEEEEEC6C6C6A9C5A44C62478F8F8F828282B0B0B0C3C3C387"
-	$"8787686868515151484848768E7142513FCECECE5D6B5AC7C7C78585855D5F5C"
-	$"698863464646F2F2F2789B71779A71D7D9D77C7C7CD8DAD8D2D3D2789B724F4F"
-	$"4F9696968EA589566054A6AAA57980785A745599C0924444447777779C9C9C9C"
-	$"B098D5D7D5C4C4C4597354535353919F8E8BA786A7AEA5777E76A5A5A5BDBDBD"
-	$"63636395959597AC93A3A3A349494952525284AA7CA2A7A1A4C69DADCCA7A5C7"
-	$"9E88A2844A4A4AF3F3F3B5B5B542553E43573F9A9A9A8B8B8B84848493939392"
-	$"BB8A5F5F5FD3D3D398AA955858588E8E8E41503E5F6D5D505050B3B3B3E7E7E7"
-	$"A4A4A4ECECECDCDCDCE2E2E2373737999999D8D8D847D55BE8000002A0494441"
-	$"5478DA62D8433200082006D2B50004104C0B8B8060880E37F7161C803B5EDE50"
-	$"8005A2142080205AB404B9159554D7CFDE8C0BF4BBE4A8295AA4AC05E9020820"
-	$"9016165EFB92CDBB726BECB6E10633B33963D668725BABEFD9031040202DBCC2"
-	$"56BBCC0492B74B47F06FC509F8F9F98B5798E9C9B2EC010820A016814CD53CC3"
-	$"E4081951062D75B61DB8801083281797B7A2142F0B400031EC6191EFD4753091"
-	$"11E2D8B36765A995B22072E0C45ADABA6B726F0193BC7B80E6E96BF4DA000410"
-	$"C31E5EE55981263BF9402A0CD6754705AB4909C0B5782A7918B9FA6D0393405F"
-	$"70B069E96409000410C31E7DB369D232601D7B389BE679A506F83BC3ADD2E054"
-	$"35D5650E049342403E07AF46E11E800062D823CF14670C8D1D4E7111C6A084F9"
-	$"33E0560933B3B2EF629204936035D65D4BF8000288618FB6B914C459102D8C8C"
-	$"ABDBE156616891558963000820A0164E055136642D401094B060E2843A6C5A14"
-	$"2345010208E830A5A962685AC2AAFA966D9AB4138B16C155E95C0001C4B0C72D"
-	$"439B0145CB9CB2B482D6DA687E062C5A5234ED76020410C31EC1E9F1A038816A"
-	$"09AB6F5BDADC5221C1C386CDFB2C0A4C8D3C0001C4B0C7C6428F6D0F2491722E"
-	$"AC4CDB38B9076C01242ACD937C7D9842C0A4182869C99986CA0004105052564F"
-	$"DF9017ACC73BBF68EE62A805902C21E7689028C70026815A6CB89D1619EF0408"
-	$"209079D60A9EF6B2C0C8DDC3572DC18F92E7387670F1F0700981C91D2CBCA1E1"
-	$"BBA4F819000208A48283638BD1726E075816C20A58B40475225D764D31D9C906"
-	$"1040602D7C420A4E566A962A2ABB7102950DB631BB1ADCB6CBECD80310400C10"
-	$"FBC54435C23B76E105E54C1612D23C3B38F6000410C4E91C7C0C3C5BA5B7E303"
-	$"1212DBA58DC1710E104030DF02358972EDC403B8B8C4842041091060004E583C"
-	$"EFDBF802160000000049454E44AE426082"
+resource(5, "shuffle_down") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D494844520000003A000000150803000000209F0D"
+	$"F90000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C000000E4504C54451818"
+	$"18CECBCEE7E7E7848284636163101010636563212421000000454545BFBFBF66"
+	$"66669292922323233939392E2E2EA9A9A99E9E9EB4B4B45050505B5B5B717171"
+	$"9645A61616167937852727279344A31717177C7C7C1212126E42781414148274"
+	$"857A388787758B212121A661B4AA68B7725877686868262626BD8AC7B095B448"
+	$"4648523E564343431515158D828F6D4C746565659D51ACC08FCA332735A688AC"
+	$"141314AD6FBAA88BAD7A4087755C7A5757573C3C3C6262626B31767B41871313"
+	$"131B181C3D313F55275E7373732D2D2D7B7D7B4D4D4D0F0F0FA865B51C1C1C58"
+	$"385E209137060000019D4944415478DA6260241B000410032333998009208080"
+	$"5A1958C900EC2C4C000104D4CACA413A60606361020820B0560692013B502B40"
+	$"0051A015208030B5F27272F232F0F1200B71F37083B088288A56800082699574"
+	$"57B7B5510632F8850405781838B99074F271090B8330370F8A568000826A7575"
+	$"D15733B0D2D600DA2000D40ED4CACBC9CFC000B29F9F819B8B93178C815AF981"
+	$"4250AD000104D56AADE06C27A1682FE9C520CC250A94E4E4121014E267E0E264"
+	$"00BA55908B870F84815A458440C210AD000104D56A2827212626656E02141516"
+	$"1012016A1501E9836805B91E84815A05443905B8A15A010208AA55D7524A4CCC"
+	$"48D3491C144EA25C7C2095D8B47209F2F08840B50204102C98BC55553C8D2DCC"
+	$"C481FE64E0E5E2846BE51342B55506114C000104D52A2DAE63AAA5E4E80094E7"
+	$"E21182843050ABA08000AA5661214141988301020866ABB49EAC07AB3C382A38"
+	$"F940910B0E5E6030034318C401617EB00427CC568000A22035010410055A0102"
+	$"08A495819D7400D40A104040ADEC6C64003716268000026A65210F3001041003"
+	$"2313B90020C000992E1E6DC556B8640000000049454E44AE426082"
 };
 
-resource(7, "eject_down") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D494844520000002C000000180803000000B6B1EF"
-	$"880000000467414D410000AFC837058AE90000001974455874536F6674776172"
-	$"650041646F626520496D616765526561647971C9653C000001A7504C5445B8B8"
-	$"B8646464404040DADADADBDBDB7C7C7CDDDDDDD1D1D1BCBCBC575757D9D9D9D7"
-	$"D7D7D5D5D5919191B4B4B4222222A2A2A2D6D6D6C5C5C5D4D4D4CFCFCFE1E1E1"
-	$"828282CECECED2D2D24D4D4DDFDFDFCBCBCB909090E4E4E4E2E2E2E8E8E8B5B5"
-	$"B5A9A9A9BABABACACACA939393D3D3D3C8C8C86B6B6B838383353535EAEAEA9D"
-	$"9D9DC6C6C67A7A7A989898C7C7C7BDBDBDCCCCCCAEAEAE6A6A6A7D7D7DE3E3E3"
-	$"7F7F7FAFAFAF6363634A4A4AB0B0B0292929A1A1A1E6E6E6E5E5E56161613838"
-	$"38787878C4C4C4B7B7B7656565757575A4A4A4EBEBEBCDCDCDA8A8A86969698A"
-	$"8A8A9E9E9E3B3B3B5858584F4F4FB2B2B2C3C3C3272727868686BBBBBB8E8E8E"
-	$"A5A5A55D5D5D3131314444446868689696962D2D2D9F9F9FE0E0E0707070ACAC"
-	$"AC505050B9B9B9B6B6B6565656BFBFBF6E6E6E3C3C3C6C6C6C5F5F5F8585858D"
-	$"8D8DC1C1C1AAAAAAC9C9C9C2C2C2B3B3B33A3A3A1D1D1D464646878787A7A7A7"
-	$"949494414141ABABAB3939392A2A2A515151494949424242A3A3A35B5B5B8989"
-	$"89606060EDEDEDADADADC0C0C0DEDEDE7E7E7E373737DCDCDCE9E9E9D8D8D899"
-	$"9999D0D0D0B5C997F6000002514944415478DA62E8220100041003298A010208"
-	$"A6988BB983AD153B60EB60E6822802082088626636515BF94E2DAD4E6C40DE4E"
-	$"4E8A05AC1C2080C08A59443B9B581465CCCCDAB002812453513666A03A800002"
-	$"2966317567CFD07490ACB767840163AF2818D3229353D24F910D643640000115"
-	$"33CBB9F3A5D7B0FA18F131C04088B455BE128C936C5E27D3D6CDCDC5D5051040"
-	$"40C5ADF22D95160281E23D08C06C10A4208CE08AE8F3D90488777501041003D0"
-	$"605B7F7B456524A53D822C91D6923DAA4822D2A97C7C42DC0001C4D0C5226B25"
-	$"A9A786AC5695CDA4CA57B38D871DC96C654321010F800062E8EA90F58E571041"
-	$"56CCEC1CD4CEE4AB69C4832426A2CAD36000104040C5721AC139C86AB9599822"
-	$"9898981C2C0D919CDD23DC956504104040C5A2C1324248A2EC5DBA852EEAEAEA"
-	$"5E89AE1248C23CCC1A6E000104525C52A6836CB292A3092B08B4990820B98E87"
-	$"C52C162080801E8CF38ED647522BCE61A32106062A151E4821D4A1AB0D1040C0"
-	$"A06BEDD6433199CD800302949CD8911C2765EC0310400C5D5C2C01DD288AA58A"
-	$"F8212086D509E13F366E4E37800062E8E2EE12175063470E396B2608F0735584"
-	$"1BCC252B105E00104040C5AA420AD21248AA0D257921404F57002A24D1652A6A"
-	$"C91A081040C0B4C123E4292428280C57CEA1C209018DACE610A53C1D769D6929"
-	$"A51200010454CC2DC217AAC0C6D6811348C976B61A17ABE471030410283D0B4A"
-	$"27B4393673C977E2005A6AD9B5D52A42825D000104CE29DCE2CE322EE5EDB881"
-	$"3F6BAEB2605717400041332C8FB292A776370EA01DC6A72F0C5205106000B8AD"
-	$"8F329AC58FF20000000049454E44AE426082"
+resource(6, "rew_down") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D4948445200000023000000150803000000FB24A7"
+	$"DB0000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C00000024504C54451818"
+	$"18BFBFBFCECBCE848284101010000000E7E7E76361632124216365637B7D7B1C"
+	$"1C1CBC1DBBD0000000B24944415478DA6260220C00028881899920000820A01A"
+	$"0616FC800B2080806A5858F1032E800002AB61C00BB80002881835000184AE86"
+	$"911183C5051040A86A1819613208160317400021AB616484C920582035000184"
+	$"50C3C8089341B0206A000208A686110B80A901082062CC010820B81A6EB82BB8"
+	$"D1DD031040C4F80B208088091F800022269C010288183500010452C3C0811770"
+	$"010410500D07277EC00510404035EC840040003130B1110400010600A1E40785"
+	$"A9210D8B0000000049454E44AE426082"
 };
 
-resource(8, "eject_up") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D494844520000002C000000180803000000B6B1EF"
-	$"880000000467414D410000AFC837058AE90000001974455874536F6674776172"
-	$"650041646F626520496D616765526561647971C9653C000001B6504C5445D5D5"
-	$"D5CFCFCFE4E4E4D9D9D9D7D7D7D6D6D6D2D2D24040406363637B7B7BE0E0E0B4"
-	$"B4B4DADADA1B1B1BD1D1D1DBDBDB858585CACACAD3D3D3E3E3E3C9C9C9BEBEBE"
-	$"6A6A6ACDCDCDC3C3C3777777CCCCCCDEDEDEE6E6E6B8B8B8BFBFBFEBEBEB9292"
-	$"92C1C1C17575752F2F2FBABABAEDEDEDE1E1E1B9B9B9656565DCDCDC91919190"
-	$"90903737374A4A4A8B8B8B7C7C7CA1A1A1DDDDDD7878787D7D7DDFDFDFCECECE"
-	$"AAAAAA555555BCBCBCBBBBBBC5C5C5575757ACACAC878787767676B5B5B5C8C8"
-	$"C8686868747474E7E7E7B2B2B2676767E5E5E56F6F6F6D6D6D9393939D9D9DE9"
-	$"E9E9A0A0A0323232979797515151484848B6B6B65C5C5C6C6C6C5A5A5A727272"
-	$"C4C4C4848484C6C6C66666665353531A1A1A838383414141585858EAEAEA7070"
-	$"70A7A7A77979796E6E6EA3A3A3A4A4A4313131A8A8A89E9E9E4C4C4CC0C0C09B"
-	$"9B9B5454545656565E5E5EB1B1B1616161808080989898818181C2C2C2AEAEAE"
-	$"4D4D4D444444AFAFAFB0B0B0A5A5A5A9A9A95959597E7E7EABABAB4242428F8F"
-	$"8FD4D4D49F9F9FB7B7B79A9A9A3E3E3EC7C7C7898989383838505050B3B3B394"
-	$"9494ECECECA2A2A2353535E2E2E2D8D8D8D0D0D0CFC448450000026549444154"
-	$"78DA6298400200082006521403041054318B9060963A37771716C0AD2221CEC0"
-	$"025605104060C52C132D338C35ACFD3BB181A8BC50BD6A093690728000022966"
-	$"6D6BD2D0D1E554E8C50A0C0C8C8383C2F3C559274C000820A062562B2D5DF366"
-	$"796F1926E17E2898C06FD88F00C2FDAC7EB62EA62C13000208A858AA453741C6"
-	$"998B878595010A04B5146C18611C065696093CCC723E726C2C0001C43081819B"
-	$"834386895968221C307A2537E8D933220426B235F2C9064AB1020410C304F1EE"
-	$"0053E1097C48522E499C9C215572482213F9F82C5426B2000410C38430633B61"
-	$"7E3624092B5B3BA7327325331114D52A3ECCCC0001C430414E29459A15499831"
-	$"DB49DF9A3D3347A10BD92113656B59F90102886182A824373F928327564A72BA"
-	$"C6B2B3FBC7F58A222B0E541234040820A062235966245788A71A05F82A2B2BA7"
-	$"75702A9A2229E60E9590060820A0624ED909488A1923943CC44020D85D0AD9E4"
-	$"2EF7121380006298A058AC8EAC78A2882023044C44169D58E118C60510400C13"
-	$"1CB4B8599185F53C382040D200293CC47B6B2672010410C304B63A1B213E248F"
-	$"736A0B4040A43E52E02BC674F67301041030BA23D24544909C17EEC80E017DFA"
-	$"881015ECCDE57496060820A0621609EE520B41B8D98ABEBC1010CDC90CF3B488"
-	$"99462BB39B26400081D3B3909776A2284CB9100F131470B140943AA8FB05E9D8"
-	$"C77331030410483133CF044F57A37605CF6EAC40BBB040A7DCB247987F024000"
-	$"814DE6D1E49290ACEFC309428A98E4816A27000410240FF268AAB979CBF76007"
-	$"AAAAAAF232263C4065000104CDB0CC3C86266AFD38801A97343F334815408001"
-	$"001D239CEC9F1CBCD30000000049454E44AE426082"
+resource(7, "rew_up") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D4948445200000023000000150803000000FB24A7"
+	$"DB0000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C0000001E504C5445E3E3"
+	$"E39C9A9CDEDBDE636163EFEFEFCECBCE848284404040FFFFFFE7E7E7E071FC71"
+	$"000000B24944415478DA6260250C00028881958D20000820A01A4E16FC800D20"
+	$"80806A5838F00336800002ABE1C40BD80002881835000184AE869D1D83C50610"
+	$"40A86AD8D961320816271B400021AB616787C92058203500018450C3CE0E9341"
+	$"B0206A000208A6861D0B80A901082062CC010820B81A06B82B18D0DD031040C4"
+	$"F80B208088091F800022269C010288183500010452C3C98417B0010410500D13"
+	$"237EC00610404035CC8400400031B072120400010600E9AA13AA1F2D6E440000"
+	$"000049454E44AE426082"
 };
 
-resource(9, "paused_down") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D49484452000000320000001808030000008FD65E"
-	$"D30000000467414D410000AFC837058AE90000001974455874536F6674776172"
-	$"650041646F626520496D616765526561647971C9653C00000204504C54456767"
-	$"67DFDFDFD9D9D9404040DADADAD7D7D771816E9DC296DCDCDC7B9F74E3E3E390"
-	$"BA8881957EE1E1E1D5D5D5DBDBDBDDDDDDD2D2D2868686C5C5C5A1A1A13A3A3A"
-	$"B3B3B35F5F5FEFEFEFEAEAEAEBEBEB5E5E5ED0D0D0E7E7E76161615C5C5CA9A9"
-	$"A9727272656565CBCBCB9D9D9D818181E6E6E6A7A7A7B4B4B4E4E4E4E8E8E892"
-	$"92929595959E9E9EC6C6C63D3D3D8484848888885D5D5DB6B6B6B1B1B1CCCCCC"
-	$"C3C3C35B5B5B454545ABABABB9B9B9E0E0E0D6D6D6626262CFCFCF878787EEEE"
-	$"EE2E2E2EA7C8A0797979A6A6A6AFAFAF6F90694F5E4DBBBBBB4A4A4AB5B5B5A2"
-	$"A2A23939398A98874141413F3F3F87968496969671806E5050506A6A6A5B6F57"
-	$"E5E5E5849281838D81BCBCBC323232515151798C757A7A7A3434348B8B8B8A8A"
-	$"8AA0A0A080808081967D9F9F9F858585EDEDED7777776A73699A9A9A859781D3"
-	$"D3D3949494AECDA991BB8987988378787896BE8E9393934D5C4B8D8D8D666666"
-	$"8697837E7E7E80A579757575A3A3A3838383ADADAD909090898989C0C0C0BEBE"
-	$"BE4848489B9B9BD1D1D1C1C1C1282828C7C7C73333335A5A5A696969767676B0"
-	$"B0B06B6B6BC2C2C26D6D6D7474747D7D7D4949495252527B7B7B828282BABABA"
-	$"555555CECECECACACA6E6E6EAAAAAA8E8E8EA8A8A85656568F8F8F919191B7B7"
-	$"B7989898C9C9C9BFBFBFE9E9E97F7F7FECECEC373737DEDEDEE2E2E2999999D8"
-	$"D8D84B1CE1AF000002A04944415478DA62584D3200082006D2B50004105C0B13"
-	$"0B87C00ADC4080839F09AA122080205A98F857AC54D35A2229B90417D092D5E4"
-	$"5D01D1051040602D4C2BC2A41CF8141626252DC5099A14F8C278055880AA0102"
-	$"08A4858551CBC165DA72FD602325061CA054C928DA33448C9103A8072080805A"
-	$"9818B504A497DB96A86B44D62FC6051AACBABDE3D30359599856030410500B87"
-	$"9AACF4C4924819D6D5D6AC2B3998900367A5948484142F179864E19BE1A562C9"
-	$"C7C40410400CAB597825D33D0317B10255F07644273232B220B4A845B81787E6"
-	$"AF049382AB57679B992C105E0D10400CABF9357BFD0C85413A56334AB73B4615"
-	$"E8F1C2ADE20A72ABC84B7605933940BEA08C8C8230400031ACE6D09C17A2C107"
-	$"56C1282ECAAC1FD73A096E15171B27373B8F08981402F25999F82D6701041050"
-	$"CB4A0343BDD5702DCCCCFE3E70ABD0B5AC66592156041040402DBCF63AA6C85A"
-	$"80403FCE515E44109B1646630380000269A9CB9C8EAAC542BA5CDBA0DA8A158B"
-	$"166BAF728000027A9F71B68A1DB296E099F1F3FBE5157585B1D8C2CF6B321920"
-	$"8080812CA0AB8BD062213D413B55C9D65E43109BF7577370A5C4020410302A59"
-	$"ACBC615A6CE513B42B8DC0164004620A9D72B372C0E4145062B4968D55050820"
-	$"86D5AC36CAAE82D088E8512D951312138447A54C7859806FC65230990A4ABEB2"
-	$"AB1B75000208A845B0C578353F381E94E708A9082327185375457339E72A3059"
-	$"030C61D9B43E390D8000023A8C4F4F5D6C05A3003033B0B2F2E1CC8B4C2C025C"
-	$"9212AA163ACA000104D4C2DAEC51A4CDAAC9B5122FE052937458ADE497606603"
-	$"1040A0FCC22A33B5B6D35E4C60193E90C628D6E53357C78C6F3540008173256B"
-	$"B6B082AAB9FF72FC405FDED0C4D466F56A8000821617AC826DC62E2AABF080CC"
-	$"144B0F65B05701020C0067FAF64F7EA4CB4E0000000049454E44AE426082"
+resource(8, "prev_down") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D494844520000001F00000015080300000089EBC5"
+	$"6D0000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C00000021504C54451818"
+	$"18BFBFBF848284CECBCE101010000000E7E7E76361636365632124211C1C1C7E"
+	$"A8A44E000000A34944415478DA6260C60F0002888199092F000820A03C030B6E"
+	$"C004104040791656DC80092080C0F20C38011340001192070820247946464698"
+	$"309CC5041040D8E419112A99000208539E9111591E2080D0E5191951E5010208"
+	$"551E0160F2000144483F4000A1C973A1DB0F104084DC0F104084FC0F104084C2"
+	$"0F208008C9030410489E81132760020820A03C27076EC00410404079767C0020"
+	$"801898D9F002800003004041062DA94CAAB70000000049454E44AE426082"
 };
 
-resource(10, "paused_up") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D49484452000000320000001808030000008FD65E"
-	$"D30000000467414D410000AFC837058AE90000001974455874536F6674776172"
-	$"650041646F626520496D616765526561647971C9653C00000207504C54454040"
-	$"40D9D9D9D7D7D77B9F7481957E71816E9DC29690BA88DBDBDBDADADAE1E1E1DE"
-	$"DEDEE3E3E3A1A1A1E8E8E8E5E5E5D0D0D0868686DFDFDF939393EBEBEB727272"
-	$"B4B4B4818181E0E0E0D4D4D4CCCCCCB9B9B9DDDDDDD2D2D2747474D6D6D6E4E4"
-	$"E4EAEAEACACACA5B5B5BD5D5D5BCBCBC909090E9E9E9BFBFBF989898979797A9"
-	$"A9A9949494EDEDEDC9C9C97777776666667D7D7D3D3D3DCDCDCD6B6B6BB1B1B1"
-	$"D1D1D1C7C7C7686868ADADADB7B7B7888888AEAEAE353535C5C5C5C8C8C84444"
-	$"44BEBEBE797979969696606060627E5C81947E9AA299A0A0A0A4B7A06F7D6C95"
-	$"9595787878C6C6C6A6C8A09F9F9F79857780977CB2B2B282A87B4747477B7B7B"
-	$"2222228282825656568AB3835757576B7669717F6F7676769CB397A7B9A48396"
-	$"7F757575B6B6B69A9A9A6767676F8F696873673E3E3E758772C2C2C2AAAAAAB8"
-	$"B8B8EEEEEE85858597A3947070708D8D8D4141412F2F2F2828289CC195C0C0C0"
-	$"B0B0B0A6A6A62D2D2D838383464646525252D3D3D35858584848484A4A4A8080"
-	$"80A5A5A55959594949497A7A7AC4C4C48F8F8FCECECE535353AFAFAFB5B5B56F"
-	$"6F6F1D1D1D6363635F5F5F8E8E8E5454546464645555554343439E9E9E626262"
-	$"BDBDBD8B8B8B5151514F4F4F8787877F7F7F3A3A3AC3C3C39C9C9CA3A3A3C1C1"
-	$"C11E1E1E7C7C7CB3B3B3A4A4A4E7E7E7DCDCDCECECEC505050E2E2E237373799"
-	$"9999D8D8D8D963F7E8000002A54944415478DA6258433200082006D2B5000410"
-	$"4C0B93AC52A9B498D8621C402C5B434F9609A2142080205A5494C4B4420D6AAB"
-	$"57E0021DCA16865AA6BE35205D000104D2C2249094BB62D58C45054B7083F9B3"
-	$"7CA2FAACC58CE5D7AC010820901681AC9455E2B239CB15D5F996E2047C7C7CE6"
-	$"D3C56DA498D6000410508B6C99419D5E8EBA8204372323C7325C40865B828B6B"
-	$"8196950013400031AC61D2D037B2175190615CB346DBDA5BDA0C39703C5C1C8C"
-	$"229C75C0A4FD1ACE65CBECB45B25010288618DC094664B91951C2015AB2BC5E5"
-	$"C49798ABC0B53404C47BC6B9198249C9356B183955A4E7CA020410C31A3BF15E"
-	$"4505B08E35BC89532D9CF463D5E056E526F8954466A881492E209F5140BB7D0D"
-	$"400031ACD190F3E7E786A8E0155D5118A22CDA02B74A90858D9D9955184CF280"
-	$"048CE77571000410C31AC7442B88B3C05A18181826AF805B85A1454AD39F1B20"
-	$"80805A7C54253891B5303000AD9A68922C894D8B968E044000011D163A4D084D"
-	$"4BBA6DF142654B192C5A9484DBB8000288614D66B823378A9639456145E1F24B"
-	$"B938B068F1B52E580910400C6B94BCB3417102D502B4A06792A53A3F372336EF"
-	$"33A9CA39F3000410C31A49531BCE359044CADB6D1B56315B126C01242A038353"
-	$"5D633AC1243F2869F14E0852000820608291B2B1D31300EB913268CA82590006"
-	$"F2795E69D1EE3C6012A84552CCA49E7F2540008192A5B16A7992143089AEE194"
-	$"E7875B00069C427C22227C5C6052884920287F95151F37400081B430322E164C"
-	$"16B3876521AC804945495A477955A3C84A4E8000026BE1905135493154D3D45C"
-	$"8D1368F63B45AD9A99B95C61D91A800002E74AC6654212DAF90EABF0822A3953"
-	$"5D459E658C6B00020892911939B879962A2EC7077475972BF283E31C208060C5"
-	$"05509304D74A3C808B4B480612E3000106002BCD0E856104D027000000004945"
-	$"4E44AE426082"
+resource(9, "prev_up") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D494844520000001F00000015080300000089EBC5"
+	$"6D0000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C0000001E504C5445E3E3"
+	$"E39C9A9CDEDBDE636163EFEFEFCECBCE848284404040FFFFFFE7E7E7E071FC71"
+	$"000000A34944415478DA6260C50F00028881950D2F000820A03C270B6EC00610"
+	$"404079160EDC800D2080C0F29C38011B40001192070820247976767698309CC5"
+	$"061040D8E4D9112AD9000208539E9D1D591E2080D0E5D9D951E5010208551E01"
+	$"60F2000144483F4000A1C933A0DB0F104084DC0F104084FC0F104084C20F2080"
+	$"08C9030410489E93092760030820A03C13236EC00610404079667C0020801858"
+	$"39F1028000030094AB11758434ABDD0000000049454E44AE426082"
 };
 
-resource(13, "ffwd_up") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D494844520000002C000000180806000000816F1F"
-	$"BA000004E1494441545885D597CF6B135D1FC53F339949DB645A9BB421A615ED"
-	$"C2443118A8A84B05411071E54A04372EFD03EACEA5FF84FF869BD2551105B520"
-	$"6A95163536D686FA0332935FF3FBDE779177A64DDA3E3E799E9697F7C0ACEE61"
-	$"38F73B67CE3D57595B5B93FC1F41FD5F0B1816DA410B524A8220C0B66DBADD2E"
-	$"AEEBE2FB7EBC76985014856432C9D8D818A9548AD1D15154554551943F0B9652"
-	$"E2BA2EBF7EFD62737393AF5FBFB2BDBD4DB3D9C4F3BC43170B90482448A7D34C"
-	$"4F4F5328143879F2243333331C3B760C5DD7FB842BBB3D2C84C0B22CD6D6D678"
-	$"F1E205EFDEBD636A6A8AF9F979F2F93C939393872E1676BED8E7CF9F69341A98"
-	$"A6C9D9B367397FFE3C274E9C606C6C0C5555FB050B2168341AACACACB0B8B848"
-	$"3A9DE6FEFDFB5CBC7811210461182284404A792453869E35A494B4DB6D969797"
-	$"314D9372B91C8B561465C712DD6E970F1F3EB0B8B848A954626161014551E874"
-	$"3A789E471886472E367A344DE3DAB56BD4EB756AB51AE3E3E3689A86AEEB3DC1"
-	$"6118B2BDBDCDCB972F29140A2C2C2C2084E8130BF0F3E74FA4941886D1F7990E"
-	$"C2B0FC08AAAAA2AA2AD96C16D775B16D1BCFF3D034AD27D8711C363636D8DADA"
-	$"E2F1E3C7846148A7D3C175DDBE89D66A35AAD52A524A66676729954A4C4D4DA1"
-	$"69FB87CDB0FC0891F500344D430881A6693B96B06D9B1F3F7E50A954C8E57238"
-	$"8EB36F220441403299445114B6B6B6D8D8D82097CB71E6CC190A8502A3A3A3FF"
-	$"8ABF1B524A1445410841BD5EE7D4A953BD0D00F8BE8FE338542A157CDFC7F77D"
-	$"84107B5EA2691A966551AFD709C390E3C78F639A26CF9E3DC3300C8AC5227373"
-	$"731886117B7118FE7EA2851054AB552E5FBEBCE3612925AAAA92C96408C330F6"
-	$"EC41F03C0FD33469341AA4D369F2F93CBAAEF3F6ED5B565757999B9BA3582CC6"
-	$"9BFEBBFC4C26432291D8630FDBB669B7DB3D3B450BD14476FBE74F1042D06AB5"
-	$"68B7DB7CFFFE9DE9E96972B91C5FBE7C017A9618865FA95448A5527DD38E22D5"
-	$"75DDFE588B76F64F624B4A49B7DB657D7D9D959515128904D7AF5FA7542A0DC5"
-	$"BF70E1C21E6B4829E3488D05271289F8E718164110D0E97468369BA45229EEDD"
-	$"BBC7EDDBB749A5522C2F2FEF79E75FF11DC7C1719CBEA1054180EBBA71B7D000"
-	$"464646989C9C3CF067DB0FAEEBD26EB769B55A9C3E7D9A070F1E70E3C60D8220"
-	$"C0711C4CD3EC8BC5BFC31FFCBA6118D26AB5B02C0BC33080FFA6442A95626666"
-	$"06C771FA4EB4C1E9689A86E77954AB552CCBE2EAD5ABDCBD7B9772B98CE77934"
-	$"9BCDB8D1FD13FE20DAED36B55A0DDBB6C966B3BD3C06482693CCCECEF2EDDB37"
-	$"BADD2ED0B3C960C09F3B778E376FDE70F3E64DEEDCB943369B8DA7B35FB20CCB"
-	$"DF0DCFF3A8D56ABC7FFF9E72B98CAEEBD8B6BD537EA494FCFEFD1BCBB2F03C8F"
-	$"898909262626FAEA9DAAAAE8BA4E3299C4F7FD3D27E12086E5473A22B14B4B4B"
-	$"ACAFAFF3E4C9130CC3E8171CC1F77D5EBD7A45ABD5229FCF93CFE7310C634F2F"
-	$"3D6C443DDCB22CAAD52ACF9F3FE7D3A74F3C7AF4884B972EC597883EC1515B12"
-	$"42B0B4B4C4EAEA2A994C864C2613D7BBA3121D0401A66952ABD5F8F8F123E3E3"
-	$"E33C7CF890F9F9796CDB8EFFAF3D138E9A92A6696C6E6EF2F4E9535EBF7E4DAB"
-	$"D53A12A18328168B5CB972855BB76E31323212475DE4F93D82778BD675BD57E9"
-	$"34EDC03BD66161F0748B3C3F18B5FBF6BCE8781642100441BC81A3140CC4713A"
-	$"78C3D98DFF00F7D173EB773F2C6E0000000049454E44AE426082"
+resource(10, "play_down") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D494844520000002800000015080300000003C45C"
+	$"2C0000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C00000024504C54451818"
+	$"18BFBFBFE7E7E7636163848284636563212421CECBCE1010100000007B7D7B1C"
+	$"1C1CE52CB398000000B14944415478DA62602712000410030B71800920801858"
+	$"3888006CCC4C0001C4C0C2491830B03233010410030B0361C00654081040442B"
+	$"040820B8424646241946108F112E0452081040480A91946251081040280A4132"
+	$"DC38140204109A42A81C1685000184A1102C8B45214000116D22400061B81197"
+	$"42800022DAD70001447438020410D131031040442B0408200616362200502140"
+	$"0031B0B01201B89899000288819938C00410400C4C4402800003000BCF081A22"
+	$"DA76AF0000000049454E44AE426082"
 };
 
-resource(14, "ffwd_down") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D494844520000002C000000180806000000816F1F"
-	$"BA000004F1494441545885D597CD6B135B18C67F3967E66492499C94601BEDD4"
-	$"C434B6317E80417121D4D2858220E2DA8D7F892B03EEDCEB5EDCB8D48DEB22A9"
-	$"2022046C6C8B8234B8481B699368321F77919B344DD2DEE6DE5B2EF781C0C03C"
-	$"C9FCF29EE7BCEF99C0E7CF9F7DFE4712FF35C0B8D20EBB19080408040208217A"
-	$"D7C725DFF7F17D1FCFF37AD7A3341258088194124DD3D0757D08F8A01FFBA7C0"
-	$"AEEBF63E8EE3F4E00F059652A294C2300C344D636B6B8B0F1F3E50A954D8DEDE"
-	$"3E3660804C26C3D4D414B95C0E21048EE3E0BA2E9EE78D0696526218068661B0"
-	$"B9B9C9F3E7CF29168B48293979F224274E9C40298594F25F05F57D1FC771585D"
-	$"5DA5D168609A26F7EFDFE7EAD5ABBD95ED16A9072C8420180C621806C5629127"
-	$"4F9E108D46B97DFB36E9749A582C86520A4D3B34F67F5B9EE7F1FBF76F767777"
-	$"A956AB944A256AB51A0B0B0BBD48FABEBF07AC691A4A294AA5128542815C2EC7"
-	$"CD9B37397BF62CA669228440D77580A1653A48E3FAA153ED5FBF7E51AD56A956"
-	$"AB7CF9F205DBB60987C3C09F6D4D0881A669789EC7D3A74FC966B3DCBA758B6C"
-	$"364B341A45884EF7534AB1B2B2C2CECE0EE170184DD30EED1CE3FAA1D39942A1"
-	$"105353539C39730621049B9B9B54AB557CDFEF00775BD7CACA0A9EE771FDFA75"
-	$"92C9244AA9A17FFFF6ED5B1E3E7CC8E3C78F2997CB84C36194522341C6F5F74B"
-	$"D3344CD3249148303131C1FAFA3A8D46A31389EE97CBE532B3B3B3CCCCCC100C"
-	$"06877EC4F33CA494C4E371CAE5328F1E3DE2F4E9D3DCBB778FA5A52500DAED76"
-	$"6FF9C7F50F565AD775344D23140A51A954989E9EDE9B74DDD04F4E4E1289440E"
-	$"AD801002C33088C7E3ECEEEEF2ECD9331E3C78C08B172F68B7DB8442A17DCB3F"
-	$"AEBF1F3A100820A5C4711C7EFEFCB9B7E97CDF474AD9CBDA51140804504AA194"
-	$"C2711CDEBC79C3AB57AF585858E0CE9D3BCCCFCF8FE54F2693239F2184C0F3BC"
-	$"BD48F4DF3CCAC618A55028C4ECEC2CB66D631806EFDFBFC7308C0387CC287FAB"
-	$"D5229D4EF736793F97E338B4DBED0E7077764B297B3DEFA8324D9399991992C9"
-	$"24A669B2B1B1C1D7AF5FB16D9B76BB3D96BFD56AE1BAEE3EE06E2CBA59EF017B"
-	$"9E876559871E3CFA158FC749A5524C4F4FE3BA2EEBEBEBD4EB75E6E6E6585C5C"
-	$"C4B6ED7D7BE128FEC12876E320A5A456AB7512D005765D9753A74E51A9540E84"
-	$"F47D1F5DD7C9E7F3CCCDCDB1BDBDCDC78F1F310C835C2EC7F9F3E7999C9CDC77"
-	$"481AC73F282925BAAEF7068952AA03DC3D15D9B64DAD56DB370AFBD56C36B12C"
-	$"0BC33078F7EE1D894482C5C545CE9D3B47341A1D7AE0B8FEC1EAEABA4E301864"
-	$"797919A5149665ED6DBA76BB4DB3D9241E8F23A51C79946C369BDCB87183EFDF"
-	$"BF73E5CA1552A9D4D07019041EC7DF951002A514E17018D77579F9F225F97C9E"
-	$"582CB63738BA41DFD9D921168B619A26D0A9BEEBBAF8BE8F699A6432193299CC"
-	$"5F3E1418DBDFCD6B3018ECF5E642A1402412E1C2850BFB2B2C84201C0E138944"
-	$"28168BCCCFCF93CD6681E33BFF0EAA9B595DD7A9D7EB140A05D6D6D6B87BF72E"
-	$"E9741A5DD709F4BF847A9E47BD5EE7DBB76F7CFAF48956ABC5B56BD7B878F122"
-	$"96651DEB2B1274567A636383E5E5655EBF7E8D65592C2D2D91CFE7999898E8EC"
-	$"ADC1B766DFF769369BFCF8F183D5D5554AA5126B6B6B341A8D6385ED572291E0"
-	$"D2A54B5CBE7C99542A452412E9457608B82BD775A9D7EBD46A35B6B6B6A8D7EB"
-	$"388E73ACA09AA66118069665118FC78946A343BDF90F79FC57243CCF54F10000"
-	$"000049454E44AE426082"
+resource(11, "play_up") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D494844520000002800000015080300000003C45C"
+	$"2C0000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C0000001E504C5445E3E3"
+	$"E3EFEFEFCECBCEDEDBDE9C9A9C636163848284404040FFFFFFE7E7E7217A6570"
+	$"000000B14944415478DA62602212000410031B718013208018D8188900CCAC9C"
+	$"0001C4C0C6411870B2B072020410031B2761C00C54081040442B040820B84276"
+	$"76241976108F1D2E0452081040480A91946251081040280A41320C3814020410"
+	$"9A42A81C1685000184A1102C8B45214000116D22400061B8119742800022DAD7"
+	$"0001447438020410D131031040442B04082006366622005021400031B0B11001"
+	$"D85839010288819538C00910400C9C440280000300C6C8169FB4102432000000"
+	$"0049454E44AE426082"
 };
 
-resource(15, "rew_up") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D494844520000002C000000180806000000816F1F"
-	$"BA00000504494441545885D5974B6B535F1BC57FE7969A4B6BD25A8FA9523B31"
-	$"28C162C18A20083A7622F8091C8BC38A13877E09473A171C38291D5950A8162C"
-	$"6DA3696D6393606C3198A4B99C4BCED9FB1DC4A44DED1DCB9F77C119EDC566ED"
-	$"FD3CCFDAEB28E9745AF27F04F5BF167054E87B2D4829F13C0FCBB268341A388E"
-	$"43B3D9ECACFD4B288A42201020180C120A853875EA14AAAAA228CAC182A59438"
-	$"8EC3AF5FBFC8E7F37CFFFE9DF5F575363737715DF79F8B05D0348D7038CC9933"
-	$"6788C7E30C0F0F333434C4E9D3A7310CA34BB8B2BD878510542A15D2E9341F3E"
-	$"7C607E7E9E818101C6C6C6304D936834FACFC5C256C556565628954A94CB652E"
-	$"5FBECCD5AB57B970E102C160105555BB050B2128954ACCCECE32393949381CE6"
-	$"E1C3875CBF7E1D2104BEEF2384404A7922B70CADD6905252ABD578F7EE1DE572"
-	$"996432D911AD28CA564B341A0D52A9149393932412092626265014857ABD8EEB"
-	$"BAF8BE7FE262DB9FAEEBDCBD7B9742A140369BA5B7B7175DD7310CA325D8F77D"
-	$"D6D7D7999999211E8F3331318110A24BEC61B0B9B949A3D1201C0E130A85D034"
-	$"ED587C5555515595FEFE7E1CC7C1B22C5CD745D7F59660DBB6595B5BE3C78F1F"
-	$"3C7FFE1CDFF7A9D7EB388E73E08D4A29D9D8D820954AF1F5EB574CD364787898"
-	$"F1F1F163F3DBAD07A0EB3A4208745DDF6A09CBB2D8D8D860747494C1C1416CDB"
-	$"3ED0119ACD26F97C9EF9F9795657578944225CB972854C2683699A1886D15599"
-	$"A3F2A594288A82108242A1C0C58B175B07686F66DB36A3A3A3349B4D9ACD2642"
-	$"885D85D6EB75565757595858A05028609A26E3E3E3D46A35969797F9FCF93389"
-	$"440255553B953A0A7F673584106432196EDCB8B1D5C3524A545525168BE1FBFE"
-	$"AE3D5B2C1649A7D3A452296AB51A232323DCBC799362B1C8ECEC2C854201CFF3"
-	$"F03C0F8052A9C4DCDCDCA1F97B4108816559D46A35060606B65CA23D9DDBFBA7"
-	$"8D6AB5CAE2E2226B6B6B8C8C8C100804F8F9F327D3D3D3148BC5BFF8AEEBB2B4"
-	$"B4C4CACACAA1F80709F67D1FC771BA6DAD3DA1BB6D160C0689C7E3CCCDCD3133"
-	$"3383A228689AB6A70BE8BACED9B3672997CB87E2EF072965C7523B82354D2310"
-	$"08ECFA76031886413299E4DAB56BE47239DEBC79C3F4F4348661100A85D0F5EE"
-	$"175ED3341289044F9F3E3D147F3F789E87E3389D6CA102F4F4F4108D46F71CB6"
-	$"7610B26D9B73E7CEF1F8F1635EBE7CC9FDFBF7715D97DFBF7F77B9CA51F97BC1"
-	$"F77DAAD52A954A85482402FC8997A15088A1A1216CDBDEF7456B97C7B22C745D"
-	$"E7C18307BC7AF58A478F1E118BC528168B388E736CFE4ED46A35B2D92C9665D1"
-	$"DFDF0FFCB1B54020C0F9F3E7C9E572341A0DA055D6FD4A2784E80CC2AD5BB7B8"
-	$"73E70ECBCBCBBC7EFD1A5DD73B61E5B87CD775C966B32C2C2C904C26310C03CB"
-	$"B2B6C28F949262B148A552C1755DFAFAFAE8EBEBFB2BDEED85F660198681A669"
-	$"5DF9F9287C296547ECD4D4144B4B4BBC78F1824824D2AAD4F60D0607078946A3"
-	$"7CFCF8915C2E87699A98A6492412395078BB6F0FF2D5BDF8ED1C5EA954C86432"
-	$"BC7FFF9E6FDFBEF1ECD93362B1188D4603DFF7BBF3703B2D0921989A9A627171"
-	$"91582C462C16EBC4BBC3DCF671E0791EE572996C36CB972F5FE8EDEDE5C99327"
-	$"8C8D8D61595667BE949D3FA1EDA4A4EB3AF97C9EB76FDFF2E9D327AAD5EA8908"
-	$"DD894B972E71FBF66DEEDDBB474F4F0FB66D77C4027F0BDE2EDA308C56A4FB33"
-	$"142775BB40D7DE42089ACD66A7AFB75BEDAE36D07E9E8510789ED739C0490A06"
-	$"3A76BAF30F673BFE0765B1927DCB7ECDC10000000049454E44AE426082"
+resource(12, "next_down") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D494844520000001D0000001508030000008D1E15"
+	$"500000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C00000024504C54451818"
+	$"18BFBFBFE7E7E7636163636563212421CECBCE8482841010100000001C1C1C7B"
+	$"7D7B41373F2B000000A04944415478DA6260C307000288811D0F60020820060E"
+	$"9C8095990920801838710106166626800062C0095881B20001845F162080606C"
+	$"4646048B112E0B104048628C98B20001842C0B12E6429105082054599004B22C"
+	$"4000A1CB323222CB0204107EBD0001846E2FAA2C4000E177334000E1F72F4000"
+	$"E10F2B8000C22F0B10400CAC380150162080185870026E662680006260C60398"
+	$"00028881091F00083000D82205D9820E455D0000000049454E44AE426082"
 };
 
-resource(16, "rew_down") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D494844520000002C000000180806000000816F1F"
-	$"BA000004EB494441545885D5974D6B135D14C77F3377DE924C5E9A97C6D2169B"
-	$"56A8A6D545A9B85370A31B17EEFD027E9080DFC1951B2BB81604DD161A170A4A"
-	$"A06DA2904D43C5C4483389C9CCDC791621536BD318F5290FCF81C040FE73EFEF"
-	$"9E73EE396794DDDDDD80FF91A9FF35C0EF9A36E94F45515014055555C3E7F3B2"
-	$"20080882002965F83CCEC602ABAA8A10024DD3D075FD14F0598BFD2DB0EFFBE1"
-	$"CFF3BC107E22B01002C330B02C0B4DD368B55ABC7DFB9646A3C1D7AF5FCF0D18"
-	$"E0D2A54BE4F3798AC522AAAAE2791EBEEF23A51C0F2C84C0B22C2CCBE2E0E080"
-	$"C78F1F532E97114290CBE548241218868110E25F050D8200CFF3D8DBDBA3DBED"
-	$"128BC5B87FFF3E9B9B9B6164474E0A815555C5344D2CCBA25C2EF3E8D123E2F1"
-	$"3877EEDC61797999542A85611868DAC4B4FF639352D2EFF7E9743A349B4D2A95"
-	$"0AED769B9B376F86291904C131B0A669188641A552A1542A512C16B975EB1685"
-	$"4281582C86AAFEBAA0082150551529E5D8FC9B461F0401DFBF7FA7D96CD26C36"
-	$"A956AB2C2C2C108D460150767777035555C39C7DF8F021E9749ABB77EF522814"
-	$"300CE397A0BAAE635916A669F2EEDD3B3CCFA35028FC95DE755D3A9D0E8EE300"
-	$"303333433A9D1E7A7854BADEBC798394921B376E70F1E2C589B08AA284975351"
-	$"145EBE7CC9D6D616CD6693070F1E904824C864327FACD7348D582C463C1EA7DF"
-	$"EFF3F1E3C7A153478B01ECEFEFB3B2B2C2E2E222A6698E051D45C3344D3A9D0E"
-	$"4F9E3CE1F9F3E7F4FB7D128904ABABABB4DB6D1CC72193C9FCB6FEC703EABA8E"
-	$"A6694422111A8D06F3F3F3C7393C4AFAD9D9596CDB3ED524344D0B37AED56A3C"
-	$"7DFA94D7AF5F631846E81D5555894422C0303F6DDB9E5A7F56141545410881E7"
-	$"797CFBF6ED18380802841044A3D15395400841241261676787ADAD2D3E7CF880"
-	$"6DDBE4F3792CCB3A330AE572792AFD241BA5AB94926EB77BB20E2B8A82A669A7"
-	$"BC2BA5A452A9F0EAD52BFAFD3E6B6B6B789EC7603018BB49100454AB55767676"
-	$"A6D24F03ED791EAEEB0E8147E56454667E06F63C0FD334D9DCDC249BCD8627FE"
-	$"FCF9335FBE7CA1D7EB9D2861524A0CC3985AFF2B584551705D1729E531B09492"
-	$"64323976F0104290CFE7C966B35CB972855AAD46BD5E67767696B9B9395AAD16"
-	$"87878761095214856C36CBFCFCFC54FA49B0A3B9A6DD6E0F336004ECFB3E7373"
-	$"73341A8D3317104290C96448A7D3ACAFAF53AFD7A956ABB8AE4B369BE5E8E8E8"
-	$"4493F95DFDB8FD745D0F1B89611843E05197595858A0DD6E9F6885679D3C168B"
-	$"512C16595959A1D168B0BFBFCF6030201289D0EFF7715DF78FF5A377745DC734"
-	$"4DB6B7B7310C836432797CE95CD7A5D7EB91C96410424C3D4A9AA6C9D2D2128B"
-	$"8B8BB45A2D0E0E0EC201E64FF5AAAA621806D16814DFF779F6EC191B1B1BA452"
-	$"A9939D0EE0E8E888542A152E20A5C4F7FDA9E6825C2E472E979BA89BA41FE5AB"
-	$"699A442211344DA3542A61DB366B6B6B273DACAA2AD16814DBB62997CBACAEAE"
-	$"72F9F265E0FCE6DF7187D0751D5DD7711C8752A944AD56E3DEBD7B2C2F2FA3EB"
-	$"FA70F819BD20A5C4711CEAF53AEFDFBF67301870FDFA75D6D7D7492693E7FA89"
-	$"04C3487FFAF489EDED6D5EBC78413299E4F6EDDB6C6C6C30333333BC5B3F7F35"
-	$"074140AFD7E3F0F090BDBD3D2A950AB55A8D6EB77BAEB03FDA850B17B87AF52A"
-	$"D7AE5D63696909DBB6C3943D053C32DFF7711C8776BB4DABD5C2711C3CCF3B57"
-	$"D0D1BC924C26C96432C4E3F15363C23FD949940E9FD1AB580000000049454E44"
-	$"AE426082"
+resource(13, "next_up") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D494844520000001D0000001508030000008D1E15"
+	$"500000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C0000001E504C5445E3E3"
+	$"E3EFEFEFCECBCE848284DEDBDE9C9A9C636163404040FFFFFFE7E7E7CD8E4595"
+	$"000000A34944415478DA6260C20700028881190FE004082006469C80858D1320"
+	$"80183870014E56364E800062E0C4055880B20001845F16208060B2ECEC9C7016"
+	$"3B5C16208010B23079645980004296050933A0C8020410AA2C480259162080D0"
+	$"65D9D99165010208BF5E800042B71755162080F0BB192080F0FB172080F08715"
+	$"4000E19705082006169C00280B10400CAC3801331B27400031B0E1019C000184"
+	$"DB5E1000083000F03F1072763DB7B80000000049454E44AE426082"
 };
 
-resource(17, "prev_down") #'PNG ' array {
-	$"89504E470D0A1A0A0000000D494844520000002C000000180806000000816F1F"
-	$"BA00000543494441545885D597CD6F125B18879F99335FC0C040A9AD8D50DBD2"
-	$"C48AD504A27161D4C4851A13176EFD0FFC4348DCBA76A98BEADE8DAEBB181746"
-	$"9B10DB824DD80868A034E543603EEEA2196A6BA9D7DEDBDCDC5F42320967CE79"
-	$"CE7B7EE77DDF91D6D7D77DFE4792FF6B803F9572DC9F9224214912B22C8F9E4F"
-	$"4BBEEFE3FB3E9EE78D9E8FD291C0B22C23844051145455FD0578DC64FF14D875"
-	$"DDD1CF719C11FCB1C04208344DC3300C1445A1D96CF2E1C307AAD52ADBDBDBA7"
-	$"060CB0B8B8C8F4F434D96C165996711C07D775F13CEF6860210486616018065F"
-	$"BF7EE5F9F3E7D8B68D10823367CE108BC5D0340D21C4BF0AEAFB3E8EE3B0B1B1"
-	$"41B7DB251289F0E8D123AE5EBD3A3AD9204823605996D1751DC330B06D9BA74F"
-	$"9F128D46B977EF1E0B0B0BC4E371344D43518EB5FD89E5791EFD7E9F76BB4DA3"
-	$"D1A0582CD26AB5B875EBD6C892BEEFEF032B8A82A669148B450A8502D96C96DB"
-	$"B76F333F3F4F24124196F7138A2CCBA3498208B9AEFBB7AC2284400881E77947"
-	$"BEE3FB3E3F7EFCA0D168D0683428954AA45229C2E13000D2FAFABA2FCBF2C8B3"
-	$"4F9E3C61626282FBF7EF333F3F8FA669BF2C1A0E8769341A743A1D001CC7C1B2"
-	$"2CC2E1F058685555310C035DD7F9F4E913F57A9D7C3E3F7663C3E19076BB3D5A"
-	$"239148303131B117E12075BD7FFF1ECFF3B87EFD3AE7CF9F3F123618FFECD933"
-	$"6CDB46922462B1188F1F3FE6E6CD9B8442A103E3820B2C4912EFDEBDE3E5CB97"
-	$"7CFBF68D070F1E303535452A953A720D455188442244A351FAFD3E5FBE7CD90B"
-	$"6A3031C0E6E626994C86743A8DAEEB6377EFBA2EAAAA32333383A669A452299A"
-	$"CD26DFBF7F67767696E0C4745DA7DD6EF3E2C50B5EBD7A45BFDF271A8D92C964"
-	$"90248956AB3516589224545545511442A110D56A9573E7CEED7B3830FDD4D414"
-	$"A6699EA8480821304D135DD72997CBACACACF0F6ED5B344D23168B914C269165"
-	$"79E4C7DF29C81042081CC7616767671FD8F77D841084C3E11365822022B66DF3"
-	$"FAF56B3E7EFC88699A4C4F4F6318C61FCFF7F3BCB22CE3791EDD6EF7601E9624"
-	$"0945514E5C826BB51A6B6B6B00E47239068301BD5EEF1F171A4992701C87E170"
-	$"B8071CD46E21C48174F527F27D1F5996B978F1229AA631180C1042D06C36A9D7"
-	$"EB743A1D5CD73D11AC24490C87433CCFDB07F63C0FCBB28E6D3C7EA7582C463A"
-	$"9D666969894AA542A95462381C323939C9EEEE2EB55A8D9D9D9D3F820DFA9A56"
-	$"ABB5E78000D8755D666666A856AB2782FD7991482442369B2593C950AD56D9DC"
-	$"DC643018B0B8B848BFDF4751148410BF0D8C10025555478544D3B43DE0A02B4A"
-	$"A552B45AAD03A5F028F57A3D745DE7EEDDBB241209745D676B6B8BE17078609C"
-	$"AEEBCCCDCD914EA769369B944A252A95CAC87A87C71FDEB8AAAAE8BACEEAEA2A"
-	$"9AA66159D6FEA51B0E87F47A3D92C9244288635BC976BBCD8D1B37B06D9BCF9F"
-	$"3F138944989D9D1D9BAE82E669727292E5E5656AB51ADBDBDB24128923C7CBB2"
-	$"8CA66984C3615CD7656565857C3E4F3C1E3F58E90076777789C7E344221182E8"
-	$"1FAEF9D168945C2E472E971B1BA171518BC562C462B1B1A04208745D27140AA1"
-	$"280A854201D334B974E9D2C1080709DD344D6CDBE6C2850B2C2D2D01A7D7FF1E"
-	$"56E0595555E9743A140A05CAE5320F1F3E646161015555F79A9FE005CFF3E874"
-	$"3A542A15D6D6D6180C065CBB768DE5E5652CCB3AD54F24D83B81ADAD2D565757"
-	$"79F3E60D966571E7CE1DF2F93C894462EF6E1DFE6AF67D9F5EAF47BD5E676363"
-	$"8362B148B95CA6DBED9E2AECCF3A7BF62C972F5FE6CA952BCCCDCD619AE6C8B2"
-	$"BF0007725D974EA743ABD5A2D96CD2E974701CE754411545C1300C2CCB22994C"
-	$"128D467F6913FE025BC737CBCE654FEF0000000049454E44AE426082"
+resource(14, "repeat_up_on") #'PNG ' array {
+	$"89504E470D0A1A0A0000000D494844520000002C0000001508030000000A2FFC"
+	$"560000000467414D410000AFC837058AE90000001974455874536F6674776172"
+	$"650041646F626520496D616765526561647971C9653C000000B7504C544569BA"
+	$"59E9E9E96CBB5C86C87AD8D8D8E8E8E885C778577452F0F0F09A9A9AEAEAEA7D"
+	$"8B7AE3E3E3427538D2D2D2D9D9D9A7C7A18C8C8CADC1A962AE534F6A4B599E4B"
+	$"EBECEBCCD8CAB7B9B7529045BCBCBCA8A8A8DEDEDEC2CEC0579A4A91BD87EDED"
+	$"ED788A74597753559748C3C3C392B38BE4E7E3EBEBEB84BE7885BF7894CE8972"
+	$"7D708DA7883F7035B2B2B29797979D9D9DAAD8A1ECECEC8AA385DEDBDE9C9A9C"
+	$"EFEFEF636163848284CECBCE494949FFFFFFE7E7E72E5D330E0000010F494441"
+	$"5478DA62B0240100041083A505D1C0062080808A6DCC880226E636000104546C"
+	$"664D0CB03135B7010820B0621B2280095031400091A4182080B02AB6B2022204"

[... truncated: 645 lines follow ...]


From axeld at pinc-software.de  Tue Jun 12 19:26:38 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Tue, 12 Jun 2007 19:26:38 +0200 CEST
Subject: [Haiku-commits]
 =?iso-8859-15?q?r21389_-_in_haiku/trunk=3A_header?=
 =?iso-8859-15?q?s/private/interface_src/apps/showimage_src/kits/interface?=
In-Reply-To: 
Message-ID: <30574028300-BeMail@ibm>

"Ryan Leavengood"  wrote:
> On 6/11/07, Axel D?rfler  wrote:
> > Please move these files to src/shared and headers/shared.
> Just proving that I'm not crazy, here is the headers/shared reference
> I mentioned. It was you Axel :)

Sorry for the confusion :-)

Bye,
   Axel.



From marcusoverhagen at mail.berlios.de  Tue Jun 12 22:44:46 2007
From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS)
Date: Tue, 12 Jun 2007 22:44:46 +0200
Subject: [Haiku-commits] r21401 - in
	haiku/trunk/src/add-ons/media/plugins/avi_reader: . libOpenDML
Message-ID: <200706122044.l5CKik0k030939@sheep.berlios.de>

Author: marcusoverhagen
Date: 2007-06-12 22:44:45 +0200 (Tue, 12 Jun 2007)
New Revision: 21401
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21401&view=rev

Modified:
   haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.cpp
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.h
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/avi.h
Log:
Moved some functionality from avi_reader into OpenDMLParser.
Added basic seeking support.


Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp	2007-06-12 17:00:00 UTC (rev 21400)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp	2007-06-12 20:44:45 UTC (rev 21401)
@@ -51,21 +51,18 @@
 	char *		buffer;
 	unsigned	buffer_size;
 
-	int64		frame_count;
-	bigtime_t 	duration;
+	bool		is_audio;
+	bool		is_video;
+
 	media_format format;
 
-	bool		audio;
-
-	// audio only:	
-	int64		byte_pos;
-	uint32		bytes_per_sec_rate;
-	uint32		bytes_per_sec_scale;
-
-	// video only:
-	uint32		frame_pos;
+	bigtime_t 	duration;
+	int64		frame_count;
+	int64		frame_pos;
 	uint32		frames_per_sec_rate;
 	uint32		frames_per_sec_scale;
+	
+	// video only:
 	uint32		line_count;
 };
 
@@ -111,7 +108,7 @@
 	TRACE("aviReader::Sniff: this stream seems to be supported\n");
 	
 	fFile = new OpenDMLFile(pos_io_source);
-	if (B_OK != fFile->Init()) {
+	if (fFile->Init() < B_OK) {
 		ERROR("aviReader::Sniff: can't setup OpenDMLFile\n");
 		return B_ERROR;
 	}
@@ -144,6 +141,8 @@
 	cookie->stream = streamNumber;
 	cookie->buffer = 0;
 	cookie->buffer_size = 0;
+	cookie->is_audio = false;
+	cookie->is_video = false;
 
 	BMediaFormats formats;
 	media_format *format = &cookie->format;
@@ -167,54 +166,21 @@
 			return B_ERROR;
 		}
 		
-		if (audio_format->format_tag == 0x0001) {// PCM
-			cookie->frame_count = stream_header->length / ((stream_header->sample_size + 7) / 8);
-			TRACE("audio frame_count %Ld (is PCM)\n", cookie->frame_count);
-		} else if (stream_header->rate) { // not PCM
-			cookie->frame_count = (stream_header->length * (int64)audio_format->frames_per_sec) / stream_header->rate;
-			TRACE("audio frame_count %Ld (using rate)\n", cookie->frame_count);
-		} else { // not PCM
-			cookie->frame_count = (stream_header->length * (int64)audio_format->frames_per_sec) / (stream_header->sample_size * audio_format->avg_bytes_per_sec);
-			TRACE("audio frame_count %Ld (using fallback)\n", cookie->frame_count);
-		}
+		cookie->is_audio = true;
+		cookie->duration = fFile->StreamInfo(streamNumber)->duration;
+		cookie->frame_count = fFile->StreamInfo(streamNumber)->frame_count;
+		cookie->frame_pos = 0;
+		cookie->frames_per_sec_rate = fFile->StreamInfo(streamNumber)->frames_per_sec_rate;
+		cookie->frames_per_sec_scale = fFile->StreamInfo(streamNumber)->frames_per_sec_scale;
 
-		if (stream_header->rate && stream_header->scale) {
-			cookie->duration = (1000000LL * (int64)stream_header->length * (int64)stream_header->scale) / stream_header->rate;
-			TRACE("audio duration %.6f (%Ld) (using scale & rate)\n", cookie->duration / 1E6, cookie->duration);
-		} else if (stream_header->rate) {
-			cookie->duration = (1000000LL * (int64)stream_header->length) / stream_header->rate;
-			TRACE("audio duration %.6f (%Ld) (using rate)\n", cookie->duration / 1E6, cookie->duration);
-		} else {
-			cookie->duration = fFile->Duration();
-			TRACE("audio duration %.6f (%Ld) (using fallback)\n", cookie->duration / 1E6, cookie->duration);
-		}
-		
-		cookie->audio = true;
-		cookie->byte_pos = 0;
+		TRACE("audio frame_count %Ld\n", cookie->frame_count);
+		TRACE("audio duration %.6f (%Ld)\n", cookie->duration / 1E6, cookie->duration);
 
-		if (stream_header->scale && stream_header->rate && stream_header->sample_size) {
-			cookie->bytes_per_sec_rate = stream_header->rate * stream_header->sample_size;
-			cookie->bytes_per_sec_scale = stream_header->scale;
-			TRACE("audio bytes_per_sec_rate %ld, bytes_per_sec_scale %ld (using both)\n", cookie->bytes_per_sec_rate, cookie->bytes_per_sec_scale);
-		} else if (audio_format->avg_bytes_per_sec) {
-			cookie->bytes_per_sec_rate = audio_format->avg_bytes_per_sec;
-			cookie->bytes_per_sec_scale = 1;
-			TRACE("audio bytes_per_sec_rate %ld, bytes_per_sec_scale %ld (using avg_bytes_per_sec)\n", cookie->bytes_per_sec_rate, cookie->bytes_per_sec_scale);
-		} else if (stream_header->rate) {
-			cookie->bytes_per_sec_rate = stream_header->rate;
-			cookie->bytes_per_sec_scale = 1;
-			TRACE("audio bytes_per_sec_rate %ld, bytes_per_sec_scale %ld (using rate)\n", cookie->bytes_per_sec_rate, cookie->bytes_per_sec_scale);
-		} else {
-			cookie->bytes_per_sec_rate = 128000;
-			cookie->bytes_per_sec_scale = 8;
-			TRACE("audio bytes_per_sec_rate %ld, bytes_per_sec_scale %ld (using fallback)\n", cookie->bytes_per_sec_rate, cookie->bytes_per_sec_scale);
-		}
-
 		if (audio_format->format_tag == 0x0001) {
 			// a raw PCM format
 			description.family = B_BEOS_FORMAT_FAMILY;
 			description.u.beos.format = B_BEOS_FORMAT_RAW_AUDIO;
-			if (B_OK != formats.GetFormatFor(description, format)) 
+			if (formats.GetFormatFor(description, format) < B_OK)
 				format->type = B_MEDIA_RAW_AUDIO;
 			format->u.raw_audio.frame_rate = audio_format->frames_per_sec;
 			format->u.raw_audio.channel_count = audio_format->channels;
@@ -237,14 +203,14 @@
 			// some encoded format
 			description.family = B_WAV_FORMAT_FAMILY;
 			description.u.wav.codec = audio_format->format_tag;
-			if (B_OK != formats.GetFormatFor(description, format)) 
+			if (formats.GetFormatFor(description, format) < B_OK)
 				format->type = B_MEDIA_ENCODED_AUDIO;
 			format->u.encoded_audio.bit_rate = 8 * audio_format->avg_bytes_per_sec;
 			TRACE("bit_rate %.3f\n", format->u.encoded_audio.bit_rate);
 			format->u.encoded_audio.output.frame_rate = audio_format->frames_per_sec;
 			format->u.encoded_audio.output.channel_count = audio_format->channels;
 		}
-		// this doesn't seem to work (it's not even a fourcc)
+		// TODO: this doesn't seem to work (it's not even a fourcc)
 		format->user_data_type = B_CODEC_TYPE_INFO;
 		*(uint32 *)format->user_data = audio_format->format_tag; format->user_data[4] = 0;
 		
@@ -270,27 +236,14 @@
 			return B_ERROR;
 		}
 		
-		cookie->audio = false;
+		cookie->is_video = true;
+		cookie->duration = fFile->StreamInfo(streamNumber)->duration;
+		cookie->frame_count = fFile->StreamInfo(streamNumber)->frame_count;
 		cookie->frame_pos = 0;
+		cookie->frames_per_sec_rate = fFile->StreamInfo(streamNumber)->frames_per_sec_rate;
+		cookie->frames_per_sec_scale =  fFile->StreamInfo(streamNumber)->frames_per_sec_scale;
 		cookie->line_count = fFile->AviMainHeader()->height;
 		
-		if (stream_header->scale && stream_header->rate) {
-			cookie->frames_per_sec_rate = stream_header->rate;
-			cookie->frames_per_sec_scale = stream_header->scale;
-			TRACE("frames_per_sec_rate %ld, frames_per_sec_scale %ld (using both)\n", cookie->frames_per_sec_rate, cookie->frames_per_sec_scale);
-		} else if (fFile->AviMainHeader()->micro_sec_per_frame) {
-			cookie->frames_per_sec_rate = 1000000;
-			cookie->frames_per_sec_scale = fFile->AviMainHeader()->micro_sec_per_frame;
-			TRACE("frames_per_sec_rate %ld, frames_per_sec_scale %ld (using micro_sec_per_frame)\n", cookie->frames_per_sec_rate, cookie->frames_per_sec_scale);
-		} else {
-			cookie->frames_per_sec_rate = 25;
-			cookie->frames_per_sec_scale = 1;
-			TRACE("frames_per_sec_rate %ld, frames_per_sec_scale %ld (using fallback)\n", cookie->frames_per_sec_rate, cookie->frames_per_sec_scale);
-		}
-
-		cookie->frame_count = stream_header->length;
-		cookie->duration = (cookie->frame_count * (int64)cookie->frames_per_sec_scale * 1000000LL) / cookie->frames_per_sec_rate;
-		
 		TRACE("video frame_count %Ld\n", cookie->frame_count);
 		TRACE("video duration %.6f (%Ld)\n", cookie->duration / 1E6, cookie->duration);
 
@@ -299,13 +252,13 @@
 			description.u.avi.codec = video_format->compression;
 		else
 			description.u.avi.codec = stream_header->fourcc_handler;
-		if (B_OK != formats.GetFormatFor(description, format)) 
+		if (formats.GetFormatFor(description, format) < B_OK)
 			format->type = B_MEDIA_ENCODED_VIDEO;
 			
 		format->user_data_type = B_CODEC_TYPE_INFO;
 		*(uint32 *)format->user_data = description.u.avi.codec; format->user_data[4] = 0;
 		format->u.encoded_video.max_bit_rate = 8 * fFile->AviMainHeader()->max_bytes_per_sec;
-		format->u.encoded_video.avg_bit_rate = format->u.encoded_video.max_bit_rate / 2; // XXX fix this
+		format->u.encoded_video.avg_bit_rate = (format->u.encoded_video.max_bit_rate * 3 / 4); // XXX fix this
 		format->u.encoded_video.output.field_rate = cookie->frames_per_sec_rate / (float)cookie->frames_per_sec_scale;
 		format->u.encoded_video.output.interlace = 1; // 1: progressive
 		format->u.encoded_video.output.first_active = 0;
@@ -360,18 +313,25 @@
 
 
 status_t
-aviReader::Seek(void *cookie,
-				uint32 seekTo,
+aviReader::Seek(void *_cookie, uint32 seekTo,
 				int64 *frame, bigtime_t *time)
 {
-	TRACE("aviReader::Seek: seekTo%s%s%s%s, time %Ld, frame %Ld\n",
+	avi_cookie *cookie = (avi_cookie *)_cookie;
+
+	TRACE("aviReader::Seek: stream %d, seekTo%s%s%s%s, time %Ld, frame %Ld\n",
+		cookie->stream,
 		(seekTo & B_MEDIA_SEEK_TO_TIME) ? " B_MEDIA_SEEK_TO_TIME" : "",
 		(seekTo & B_MEDIA_SEEK_TO_FRAME) ? " B_MEDIA_SEEK_TO_FRAME" : "",
 		(seekTo & B_MEDIA_SEEK_CLOSEST_FORWARD) ? " B_MEDIA_SEEK_CLOSEST_FORWARD" : "",
 		(seekTo & B_MEDIA_SEEK_CLOSEST_BACKWARD) ? " B_MEDIA_SEEK_CLOSEST_BACKWARD" : "",
 		*time, *frame);
 
-	return B_ERROR;
+	status_t rv = fFile->Seek(cookie->stream, seekTo, frame, time);
+	if (rv == B_OK) {
+		cookie->frame_pos = *frame;
+		TRACE("aviReader::Seek: stream %d, success, setting frame_pos to %lld\n", cookie->stream, cookie->frame_pos);
+	}
+	return rv;
 }
 
 
@@ -396,24 +356,26 @@
 		cookie->buffer_size = (size + 15) & ~15;
 		cookie->buffer = new char [cookie->buffer_size];
 	}
+
+	mediaHeader->start_time = (cookie->frame_pos * 1000000 * cookie->frames_per_sec_scale) / cookie->frames_per_sec_rate;
 	
-	if (cookie->audio) {
-		mediaHeader->start_time = (cookie->byte_pos * 1000000LL * (int64)cookie->bytes_per_sec_scale) / cookie->bytes_per_sec_rate;
+	if (cookie->is_audio) {
 		mediaHeader->type = B_MEDIA_ENCODED_AUDIO;
 		mediaHeader->u.encoded_audio.buffer_flags = keyframe ? B_MEDIA_KEY_FRAME : 0;
-		
-		cookie->byte_pos += size;
-	} else {
-		mediaHeader->start_time = (cookie->frame_pos * 1000000LL * (int64)cookie->frames_per_sec_scale) / cookie->frames_per_sec_rate;
+		cookie->frame_pos += size;
+	} else if (cookie->is_video) {
 		mediaHeader->type = B_MEDIA_ENCODED_VIDEO;
 		mediaHeader->u.encoded_video.field_flags = keyframe ? B_MEDIA_KEY_FRAME : 0;
 		mediaHeader->u.encoded_video.first_active_line = 0;
-		mediaHeader->u.encoded_video.line_count = cookie->line_count;
-	
+		mediaHeader->u.encoded_video.line_count = cookie->line_count;	
 		cookie->frame_pos += 1;
+	} else {
+		return B_BAD_VALUE;
 	}
 	
-	TRACE("stream %d: start_time %.6f\n", cookie->stream, mediaHeader->start_time / 1000000.0);
+	TRACE("stream %d (%s): start_time %.6f, pos %.3f %%\n", 
+		cookie->stream, cookie->is_audio ? "A" : cookie->is_video ? "V" : "?", 
+		mediaHeader->start_time / 1000000.0, cookie->frame_pos * 100.0 / cookie->frame_count);
 
 	*chunkBuffer = cookie->buffer;
 	*chunkSize = size;

Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp	2007-06-12 17:00:00 UTC (rev 21400)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp	2007-06-12 20:44:45 UTC (rev 21401)
@@ -96,18 +96,10 @@
 {
 	fParser = new OpenDMLParser(fSource);
 
-	if (fParser->Parse() < B_OK) {
-		ERROR("OpenDMLFile::SetTo: warning, file parsing failed\n");		
-	}
-	
-	if (!fParser->AviMainHeader()) {
-		ERROR("OpenDMLFile::SetTo: avi main header not found\n");
+	if (fParser->Init() < B_OK) {
+		ERROR("OpenDMLFile::SetTo: parser init failed\n");
 		return B_ERROR;
 	}
-	
-	if (fParser->StreamCount() == 0) {
-		ERROR("OpenDMLFile::SetTo: no streams found\n");
-	}
 
 	if (fParser->StreamInfo(0)->odml_index_size != 0) {
 		fIndex = new OpenDMLIndex(fSource, fParser);
@@ -391,18 +383,26 @@
 }
 #endif
 
+
 status_t
 OpenDMLFile::GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe)
 {
 	return fIndex->GetNextChunkInfo(stream_index, start, size, keyframe);
 }
 
+status_t
+OpenDMLFile::Seek(int stream_index, uint32 seekTo, int64 *frame, bigtime_t *time)
+{
+	return fIndex->Seek(stream_index, seekTo, frame, time);
+}
+
 int
 OpenDMLFile::StreamCount()
 {
 	return fParser->StreamCount();
 }
 
+/*
 bigtime_t
 OpenDMLFile::Duration()
 {
@@ -422,7 +422,8 @@
 		return fParser->AviMainHeader()->total_frames;
 	return 0;
 }
-	
+*/
+
 bool
 OpenDMLFile::IsVideo(int stream_index)
 {
@@ -466,3 +467,9 @@
 	return (fParser->StreamInfo(stream_index)->stream_header_valid) ?
 		&fParser->StreamInfo(stream_index)->stream_header : 0;
 }
+
+const stream_info *
+OpenDMLFile::StreamInfo(int index)
+{
+	return fParser->StreamInfo(index);
+}

Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h	2007-06-12 17:00:00 UTC (rev 21400)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h	2007-06-12 20:44:45 UTC (rev 21401)
@@ -40,10 +40,14 @@
 	status_t			Init();
 	
 	int					StreamCount();
+
+	const stream_info * StreamInfo(int index);
 	
+/*
 	bigtime_t			Duration();
 	uint32				FrameCount();
-	
+*/
+
 	bool				IsVideo(int stream_index);
 	bool				IsAudio(int stream_index);
 
@@ -54,6 +58,7 @@
 	const avi_stream_header *	StreamFormat(int stream_index);
 	
 	status_t			GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe);
+	status_t			Seek(int stream_index, uint32 seekTo, int64 *frame, bigtime_t *time);
 	
 	BPositionIO *Source() { return fSource; }
 		

Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp	2007-06-12 17:00:00 UTC (rev 21400)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp	2007-06-12 20:44:45 UTC (rev 21401)
@@ -41,12 +41,6 @@
 	#define DO_SWAP_INT16(x)	x = B_SWAP_INT16(x)
 #endif
 
-struct movie_chunk
-{
-	movie_chunk *	next;
-	int64			start;
-	uint32			size;
-};
 
 OpenDMLParser::OpenDMLParser(BPositionIO *source)
  :	fSource(source),
@@ -128,6 +122,10 @@
 	info->video_format_valid = false;
 	info->odml_index_start = 0;
 	info->odml_index_size = 0;
+	info->duration = 0;
+	info->frame_count = 0;
+	info->frames_per_sec_rate = 1;
+	info->frames_per_sec_scale = 1;
 	
 	// append the new stream_info to the fStreams list and point fCurrentStream to it
 	if (fStreams) {
@@ -142,18 +140,128 @@
 }
 
 status_t
-OpenDMLParser::Parse()
+OpenDMLParser::Init()
 {
-	TRACE("OpenDMLParser::Parse\n");
+	TRACE("OpenDMLParser::Init\n");
 
 	if (!fSource) {
-		ERROR("OpenDMLParser::Parse: no source\n");
+		ERROR("OpenDMLParser::Init: no source\n");
 		return B_ERROR;
 	}
 	if (fSize < 32) {
-		ERROR("OpenDMLParser::Parse: file too small\n");
+		ERROR("OpenDMLParser::Init: file too small\n");
 		return B_ERROR;
 	}
+
+	if (Parse() < B_OK) {
+		ERROR("OpenDMLParser::Init: warning: file parsing failed\n");
+	}
+	
+	if (AviMainHeader() == NULL) {
+		ERROR("OpenDMLParser::Init: avi main header not found\n");
+		return B_ERROR;
+	}
+	
+	if (StreamCount() == 0) {
+		ERROR("OpenDMLParser::Init: no streams found\n");
+		return B_ERROR;
+	}	
+
+	uint32 frame_count = OdmlExtendedHeader() ? OdmlExtendedHeader()->total_frames : AviMainHeader()->total_frames;
+	bigtime_t duration = frame_count * AviMainHeader()->micro_sec_per_frame;
+	printf("AVI Header frame count %lu, duration %.6f\n", frame_count, duration / 1E6);
+	
+	for (int i = 0; i < fStreamCount; i++) {
+		SetupStreamLength(const_cast(StreamInfo(i)));
+	}
+	return B_OK;
+}
+
+void
+OpenDMLParser::SetupStreamLength(stream_info *stream)
+{
+	if (stream->is_audio)
+		SetupAudioStreamLength(stream);
+	if (stream->is_video)
+		SetupVideoStreamLength(stream);
+}
+
+// F:\avi-info\Information on AVI file.htm
+
+void
+OpenDMLParser::SetupAudioStreamLength(stream_info *stream)
+{
+	stream->frame_count = stream->stream_header.length;
+
+	if (stream->audio_format->format_tag == 0x0001 
+	  && stream->stream_header.sample_size != 0
+	  && stream->stream_header.sample_size != 1) { // PCM
+		stream->frame_count /= (stream->stream_header.sample_size + 7) / 8;
+		printf("audio: messing up PCM frame_count?\n");
+	}
+
+	if (stream->stream_header.rate && stream->stream_header.scale) {
+		stream->frames_per_sec_rate = stream->stream_header.rate;
+		stream->frames_per_sec_scale = stream->stream_header.scale;
+		stream->duration = (stream->frame_count * stream->frames_per_sec_scale * 1000000) / stream->frames_per_sec_rate;
+		printf("audio: using rate+scale\n");
+	} else if (stream->audio_format->avg_bytes_per_sec) {
+		stream->frames_per_sec_rate = stream->audio_format->avg_bytes_per_sec;
+		stream->frames_per_sec_scale = 1;
+		stream->duration = (stream->frame_count * stream->frames_per_sec_scale * 1000000) / stream->frames_per_sec_rate;
+		printf("audio: using avg_bytes_per_sec\n");
+	} else if (AviMainHeader()->micro_sec_per_frame) {
+		uint32 video_frame_count = OdmlExtendedHeader() ? OdmlExtendedHeader()->total_frames : AviMainHeader()->total_frames;
+		stream->duration = video_frame_count * AviMainHeader()->micro_sec_per_frame;
+		stream->frames_per_sec_rate = (stream->frame_count * 1000 * 1000000) / stream->duration;
+		stream->frames_per_sec_scale = 1000;
+		printf("audio: using micro_sec_per_frame\n");
+	} else {
+		printf("audio: no idea what to do\n");
+	}
+
+	if (stream->audio_format->avg_bytes_per_sec) {
+		int64 expected_frame_count = (stream->duration * stream->audio_format->avg_bytes_per_sec) / 1000000;
+		printf("audio: expected frame_count %lld, calculated stream frame_count %lld\n", expected_frame_count, stream->frame_count);
+		if (expected_frame_count * 9 > stream->frame_count * 10) {
+			printf("audio: something is wrong, ignoring calculated stream frame_count, rate and scale\n");
+			stream->frame_count = expected_frame_count;
+			stream->frames_per_sec_rate = stream->audio_format->avg_bytes_per_sec;
+			stream->frames_per_sec_scale = 1;
+		}
+	}
+
+	printf("audio: frame_count %lld, duration %.6f, fps %.3f\n", 
+		stream->frame_count, stream->duration / 1E6, stream->frames_per_sec_rate / (double)stream->frames_per_sec_scale);
+}
+
+void
+OpenDMLParser::SetupVideoStreamLength(stream_info *stream)
+{
+	stream->frame_count = stream->stream_header.length;
+	if (stream->stream_header.rate && stream->stream_header.scale) {
+		stream->frames_per_sec_rate = stream->stream_header.rate;
+		stream->frames_per_sec_scale = stream->stream_header.scale;
+		printf("video: using rate+scale\n");
+	} else if (AviMainHeader()->micro_sec_per_frame) {
+		stream->frames_per_sec_rate = 1000000;
+		stream->frames_per_sec_scale = AviMainHeader()->micro_sec_per_frame;
+		printf("video: using micro_sec_per_frame\n");
+	} else {
+		stream->frames_per_sec_rate = 25;
+		stream->frames_per_sec_scale = 1;
+		printf("video: using fallback\n");
+	}
+	stream->duration = (stream->frame_count * stream->frames_per_sec_scale * 1000000) / stream->frames_per_sec_rate;
+
+	printf("video: frame_count %lld, duration %.6f, fps %.3f\n", 
+		stream->frame_count, stream->duration / 1E6, stream->frames_per_sec_rate / (double)stream->frames_per_sec_scale);
+}
+
+status_t
+OpenDMLParser::Parse()
+{
+	TRACE("OpenDMLParser::Parse\n");
 		
 	uint64 pos = 0;
 	int riff_chunk_number = 0;
@@ -460,11 +568,6 @@
 		DO_SWAP_INT16(fCurrentStream->stream_header.rect_bottom);
 	#endif
 
-	if (fCurrentStream->stream_header.scale == 0) {
-		printf("OpenDMLParser::ParseChunk_strh: scale is 0\n");
-		fCurrentStream->stream_header.scale = 1;
-	}
-
 	fCurrentStream->stream_header_valid = true;
 	fCurrentStream->is_audio = fCurrentStream->stream_header.fourcc_type == FOURCC('a','u','d','s');
 	fCurrentStream->is_video = fCurrentStream->stream_header.fourcc_type == FOURCC('v','i','d','s');
@@ -478,7 +581,6 @@
 	TRACE("initial_frames        = %lu\n", fCurrentStream->stream_header.initial_frames);
 	TRACE("scale                 = %lu\n", fCurrentStream->stream_header.scale);
 	TRACE("rate                  = %lu\n", fCurrentStream->stream_header.rate);
-	TRACE("frames/sec            = %.3f\n", fCurrentStream->stream_header.rate / (float)fCurrentStream->stream_header.scale);
 	TRACE("start                 = %lu\n", fCurrentStream->stream_header.start);
 	TRACE("length                = %lu\n", fCurrentStream->stream_header.length);
 	TRACE("suggested_buffer_size = %lu\n", fCurrentStream->stream_header.suggested_buffer_size);

Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h	2007-06-12 17:00:00 UTC (rev 21400)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h	2007-06-12 20:44:45 UTC (rev 21401)
@@ -30,7 +30,7 @@
 
 struct stream_info
 {
-	stream_info *		next;
+	stream_info *		next; // TODO: replace with a vector<>
 	bool				is_audio;
 	bool				is_video;
 	bool				stream_header_valid;
@@ -41,6 +41,11 @@
 	bitmap_info_header	video_format;
 	int64				odml_index_start;
 	uint32				odml_index_size;
+	
+	bigtime_t 			duration;
+	int64				frame_count;
+	uint32				frames_per_sec_rate;
+	uint32				frames_per_sec_scale;
 };
 
 class OpenDMLParser
@@ -49,7 +54,7 @@
 					OpenDMLParser(BPositionIO *source);
 					~OpenDMLParser();
 
-	status_t 		Parse();
+	status_t 		Init();
 	
 	int				StreamCount();
 
@@ -64,6 +69,7 @@
 	const odml_extended_header * OdmlExtendedHeader();
 
 private:
+	status_t 		Parse();
 	status_t		ParseChunk_AVI(int number, uint64 start, uint32 size);
 	status_t		ParseChunk_LIST(uint64 start, uint32 size);
 	status_t		ParseChunk_idx1(uint64 start, uint32 size);
@@ -78,9 +84,13 @@
 	status_t		ParseList_INFO(uint64 start, uint32 size);
 	status_t		ParseList_strl(uint64 start, uint32 size);
 
-private:
 	void			CreateNewStreamInfo();
+	void			SetupStreamLength(stream_info *stream);
+	void			SetupAudioStreamLength(stream_info *stream);
+	void			SetupVideoStreamLength(stream_info *stream);
 
+private:
+
 	BPositionIO *	fSource;
 	int64 			fSize;
 	

Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.cpp	2007-06-12 17:00:00 UTC (rev 21400)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.cpp	2007-06-12 20:44:45 UTC (rev 21401)
@@ -33,12 +33,6 @@
 #include 
 
 
-struct StandardIndex::stream_data
-{
-	uint32 chunk_id;
-	uint32 pos;
-};
-
 StandardIndex::StandardIndex(BPositionIO *source, OpenDMLParser *parser)
  :	Index(source, parser)
  ,	fIndex(NULL)
@@ -53,6 +47,10 @@
 StandardIndex::~StandardIndex()
 {
 	delete [] fIndex;
+	if (fStreamData) {
+		for (int i = 0; i < fStreamCount; i++)
+			delete [] fStreamData[i].seek_hints;
+	}
 	delete [] fStreamData;
 }
 
@@ -63,6 +61,11 @@
 	uint32 indexBytes = fParser->StandardIndexSize();
 	fIndexSize = indexBytes / sizeof(avi_standard_index_entry);
 	indexBytes = fIndexSize * sizeof(avi_standard_index_entry);
+	uint32 seekHintsStride = 1800 * fStreamCount;
+	uint32 seekHintsMax = fIndexSize / seekHintsStride;
+	
+	printf("StandardIndex::Init: seekHintsStride %lu\n", seekHintsStride);
+	printf("StandardIndex::Init: seekHintsMax %lu\n", seekHintsMax);
 
  { BStopWatch w("StandardIndex::Init: malloc");
 
@@ -92,14 +95,62 @@
 	}
 }
 
+	//DumpIndex();
+
 	fStreamData = new stream_data[fStreamCount];
 	for (int i = 0; i < fStreamCount; i++) {
 		fStreamData[i].chunk_id = i / 10 + '0' + (i % 10 + '0') * 256;
-		fStreamData[i].pos = 0;
+		fStreamData[i].chunk_count = 0;
+		fStreamData[i].keyframe_count = 0;
+		fStreamData[i].stream_pos = 0;
+		fStreamData[i].stream_size = 0;
+		fStreamData[i].seek_hints = new seek_hint[seekHintsMax];
+		fStreamData[i].seek_hints_count = 0;
+		fStreamData[i].seek_hints_next = seekHintsStride;
 	}
+
+{ BStopWatch w("StandardIndex::Init: scan index");
 	
-	//DumpIndex();
+	for (int stream = 0; stream < fStreamCount; stream++) {
+		uint32 chunk_id = fStreamData[stream].chunk_id;
+		uint64 stream_size = 0;
+		uint32 chunk_count = 0;
+		uint32 keyframe_count = 0;
+		int seek_hints_next = seekHintsStride;
+		int seek_hints_count = 0;
+		for (int i = 0; i < fIndexSize; i++) {
+			if ((fIndex[i].chunk_id & 0xffff) == chunk_id) {
+				stream_size += fIndex[i].chunk_length;
+				chunk_count++;
+				keyframe_count += (fIndex[i].flags >> AVIIF_KEYFRAME_SHIFT) & 1;
 
+				if (i >= seek_hints_next) {
+					seek_hints_next = i + seekHintsStride;
+					seek_hint *hint = &fStreamData[stream].seek_hints[seek_hints_count++];
+					hint->stream_pos = fIndex[i].chunk_offset;
+					hint->index_pos = i;
+				}
+			}
+		}
+		fStreamData[stream].stream_size = stream_size;
+		fStreamData[stream].chunk_count = chunk_count;
+		fStreamData[stream].keyframe_count = keyframe_count;
+		fStreamData[stream].seek_hints_count = seek_hints_count;
+	}
+}
+
+	for (int i = 0; i < fStreamCount; i++) {
+		printf("stream %d, stream_size %llu\n", i, fStreamData[i].stream_size);
+		printf("stream %d, chunk_count %lu\n", i, fStreamData[i].chunk_count);
+		printf("stream %d, keyframe_count %lu\n", i, fStreamData[i].keyframe_count);
+		printf("stream %d, seek_hints_count %lu\n", i, fStreamData[i].seek_hints_count);
+		for (int j = 0; j < fStreamData[i].seek_hints_count; j++) {
+			printf("  seek_hint %3d, index_pos %6lu, stream_pos %lld\n", j,
+				fStreamData[i].seek_hints[j].index_pos, 
+				fStreamData[i].seek_hints[j].stream_pos);
+		}
+	}
+
 	return B_OK;
 }
 
@@ -132,15 +183,15 @@
 StandardIndex::GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, bool *keyframe)
 {
 	stream_data *data = &fStreamData[stream_index];
-	while (data->pos < fIndexSize) {
-		if ((fIndex[data->pos].chunk_id & 0xffff) == data->chunk_id) {
-			*keyframe = fIndex[data->pos].flags & AVIIF_KEYFRAME;
-			*start = fDataOffset + fIndex[data->pos].chunk_offset + 8;  // skip 8 bytes (chunk id + chunk size)
-			*size = fIndex[data->pos].chunk_length;
-			data->pos++;
+	while (data->stream_pos < fIndexSize) {
+		if ((fIndex[data->stream_pos].chunk_id & 0xffff) == data->chunk_id) {
+			*keyframe = fIndex[data->stream_pos].flags & AVIIF_KEYFRAME;
+			*start = fDataOffset + fIndex[data->stream_pos].chunk_offset + 8;  // skip 8 bytes (chunk id + chunk size)
+			*size = fIndex[data->stream_pos].chunk_length;
+			data->stream_pos++;
 			return B_OK;
 		}
-		data->pos++;
+		data->stream_pos++;
 	}
 
 	return B_ERROR;
@@ -150,13 +201,59 @@
 status_t
 StandardIndex::Seek(int stream_index, uint32 seekTo, int64 *frame, bigtime_t *time)
 {
-/*
-	printf("StandardIndex::Seek: seekTo%s%s%s%s, time %Ld, frame %Ld\n",
+	printf("StandardIndex::Seek: stream %d, seekTo%s%s%s%s, time %Ld, frame %Ld\n",
+		stream_index,
 		(seekTo & B_MEDIA_SEEK_TO_TIME) ? " B_MEDIA_SEEK_TO_TIME" : "",
 		(seekTo & B_MEDIA_SEEK_TO_FRAME) ? " B_MEDIA_SEEK_TO_FRAME" : "",
 		(seekTo & B_MEDIA_SEEK_CLOSEST_FORWARD) ? " B_MEDIA_SEEK_CLOSEST_FORWARD" : "",
-		(seekTo & B_MEDIA_SEEK_CLOSEST_BACKWARD) ? " B_MEDIA_SEEK_CLOSEST_BACKWARD" : "");
-*/
+		(seekTo & B_MEDIA_SEEK_CLOSEST_BACKWARD) ? " B_MEDIA_SEEK_CLOSEST_BACKWARD" : "",
+		*time, *frame);
+	
+	const stream_info *stream = fParser->StreamInfo(stream_index);
+	stream_data *data = &fStreamData[stream_index];
+
+	int64 frame_pos;
+	if (seekTo & B_MEDIA_SEEK_TO_FRAME)
+		frame_pos = *frame;
+	else if (seekTo & B_MEDIA_SEEK_TO_TIME)
+		frame_pos = (*time * stream->frames_per_sec_rate) / (1000000 * stream->frames_per_sec_scale);
+	else
+		return B_BAD_VALUE;
+
+	if (stream->is_audio) {
+		int64 bytes = 0;
+		for (int i = 0; i < fIndexSize; i++) {
+			if ((fIndex[i].chunk_id & 0xffff) == data->chunk_id) {
+				int64 bytesNext = bytes + fIndex[i].chunk_length;
+				if (bytes <= frame_pos && bytesNext > frame_pos) {
+					data->stream_pos = i;
+					goto done;
+				}
+				bytes = bytesNext;
+			}
+		}
+	} else if (stream->is_video) {
+		int pos = 0;
+		for (int i = 0; i < fIndexSize; i++) {
+			if ((fIndex[i].chunk_id & 0xffff) == data->chunk_id) {
+				if (pos == frame_pos) {
+					data->stream_pos = i;
+					goto done;
+				}
+				pos++;
+			}
+		}
+	} else {
+		return B_BAD_VALUE;
+	}
+
+	printf("seek failed, position not found\n");
 	return B_ERROR;
+
+done:
+	printf("seek done: index: pos %d, size  %d\n", data->stream_pos, fIndexSize);
+	*frame = frame_pos;
+	*time = (frame_pos * 1000000 * stream->frames_per_sec_scale) / stream->frames_per_sec_rate;
+	return B_OK;
 }
 

Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.h
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.h	2007-06-12 17:00:00 UTC (rev 21400)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.h	2007-06-12 20:44:45 UTC (rev 21401)
@@ -43,7 +43,24 @@
 	void				DumpIndex();
 
 private:
-	struct stream_data;
+	struct seek_hint
+	{
+		uint64			stream_pos;
+		uint32			index_pos;
+	};
+
+	struct stream_data
+	{
+		uint32			chunk_id;
+		uint32			chunk_count;
+		uint32			keyframe_count;
+		uint32			stream_pos;
+		uint64			stream_size;		
+		seek_hint *		seek_hints;
+		int				seek_hints_count;
+		uint32			seek_hints_next;
+	};
+		
 	avi_standard_index_entry *fIndex;
 	uint32				fIndexSize;
 	stream_data *		fStreamData;

Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/avi.h
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/avi.h	2007-06-12 17:00:00 UTC (rev 21400)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/avi.h	2007-06-12 20:44:45 UTC (rev 21401)
@@ -57,6 +57,7 @@
 } _PACKED;
 #define AVIIF_LIST      0x00000001 
 #define AVIIF_KEYFRAME  0x00000010 
+#define AVIIF_KEYFRAME_SHIFT 4 
 #define AVIIF_FIRSTPART 0x00000020 
 #define AVIIF_LASTPART  0x00000040 
 #define AVIIF_MIDPART   (AVIIF_LASTPART | AVIFF_FIRSTPART) 



From leavengood at gmail.com  Tue Jun 12 23:16:34 2007
From: leavengood at gmail.com (Ryan Leavengood)
Date: Tue, 12 Jun 2007 17:16:34 -0400
Subject: [Haiku-commits] r21392 - haiku/trunk/src/apps/showimage
In-Reply-To: <20070612105453.400.1@stippis.mindwork.office>
References: <200706120402.l5C42pJT001076@sheep.berlios.de>
	<20070612105453.400.1@stippis.mindwork.office>
Message-ID: 

On 6/12/07, Stephan Assmus  wrote:
>
> I know this might be out of scope, but I actually liked this feature in some
> cases. Could we make this "optional"? Like if the new picture has the same
> resolution, and I'm holding down some additional modifier when I switch to a
> new picture, it doesn't mess with the zoom and view region? I like this very
> much when comparing images, especially looking at certain details.

I think it would work if I don't touch the zoom factor if the image
size is the same resolution as the last. The code is starting to get a
bit hairy though with little special cases like this. I actually want
to refactor a lot of this stuff in ShowImage at some point, I think
the code could be clearer and more efficient about certain things.

Ryan


From leavengood at mail.berlios.de  Wed Jun 13 04:35:30 2007
From: leavengood at mail.berlios.de (leavengood at BerliOS)
Date: Wed, 13 Jun 2007 04:35:30 +0200
Subject: [Haiku-commits] r21402 - in haiku/trunk: build/jam headers
	src/apps/showimage src/shared
Message-ID: <200706130235.l5D2ZUHw008244@sheep.berlios.de>

Author: leavengood
Date: 2007-06-13 04:35:29 +0200 (Wed, 13 Jun 2007)
New Revision: 21402
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21402&view=rev

Removed:
   haiku/trunk/headers/shared/
Modified:
   haiku/trunk/build/jam/FileRules
   haiku/trunk/build/jam/HeadersRules
   haiku/trunk/src/apps/showimage/Jamfile
   haiku/trunk/src/apps/showimage/ShowImageApp.cpp
   haiku/trunk/src/shared/AboutWindow.cpp
Log:
As I said I would:

1. Deleted headers/shared/
2. Added a Jamfile to src/shared to build it into a static library libshared.a.
3. Removed my changes in the build/jam directory.
4. Have ShowImage include libshared.a.

I forgot to add AboutWindow.h to headers/private/shared. I will do that next.



Modified: haiku/trunk/build/jam/FileRules
===================================================================
--- haiku/trunk/build/jam/FileRules	2007-06-12 20:44:45 UTC (rev 21401)
+++ haiku/trunk/build/jam/FileRules	2007-06-13 02:35:29 UTC (rev 21402)
@@ -250,14 +250,3 @@
 	$(2[2]) $(1) ${revision}
 }
 
-rule UseSharedSource
-{
-	UseSharedHeaders ;
-
-	for file in $(1) {
-		local gristed_file = [ FGristFiles $(file) ] ;
-		SEARCH on $(gristed_file) = [ FDirName $(HAIKU_TOP) src shared ] ;
-		LOCATE on $(gristed_file) = [ FDirName $(HAIKU_TOP) src shared ] ;
-		SEARCH_SOURCE on $(gristed_file) = [ FDirName $(HAIKU_TOP) src shared ] ;
-	}
-}

Modified: haiku/trunk/build/jam/HeadersRules
===================================================================
--- haiku/trunk/build/jam/HeadersRules	2007-06-12 20:44:45 UTC (rev 21401)
+++ haiku/trunk/build/jam/HeadersRules	2007-06-13 02:35:29 UTC (rev 21402)
@@ -338,11 +338,6 @@
 	SourceSysHdrs $(1) : [ FDirName $(HAIKU_TOP) headers legacy ] : $(2) ;
 }
 
-rule UseSharedHeaders
-{
-	UseHeaders [ FDirName $(HAIKU_TOP) headers shared ] ;
-}
-
 rule FStandardOSHeaders
 {
 	local osIncludes = add-ons add-ons/file_system add-ons/graphics

Modified: haiku/trunk/src/apps/showimage/Jamfile
===================================================================
--- haiku/trunk/src/apps/showimage/Jamfile	2007-06-12 20:44:45 UTC (rev 21401)
+++ haiku/trunk/src/apps/showimage/Jamfile	2007-06-13 02:35:29 UTC (rev 21402)
@@ -1,13 +1,10 @@
 SubDir HAIKU_TOP src apps showimage ;
 
-UsePrivateHeaders tracker ;
+UsePrivateHeaders tracker shared ;
 
 SetSubDirSupportedPlatformsBeOSCompatible ;
 
-UseSharedSource AboutWindow.cpp ;
-
 Application ShowImage :
-	AboutWindow.cpp
 	ShowImageApp.cpp
 	ShowImageSettings.cpp
 	ShowImageStatusView.cpp
@@ -20,7 +17,8 @@
 	BackgroundImage.cpp
 	ProgressWindow.cpp
 	ResizerWindow.cpp
-	: be tracker translation
+	: libshared.a
+	be tracker translation
 	: ShowImage.rdef
 	;
 

Modified: haiku/trunk/src/apps/showimage/ShowImageApp.cpp
===================================================================
--- haiku/trunk/src/apps/showimage/ShowImageApp.cpp	2007-06-12 20:44:45 UTC (rev 21401)
+++ haiku/trunk/src/apps/showimage/ShowImageApp.cpp	2007-06-13 02:35:29 UTC (rev 21402)
@@ -10,11 +10,11 @@
  */
 
 
-#include "AboutWindow.h" // Shared source
 #include "ShowImageApp.h"
 #include "ShowImageConstants.h"
 #include "ShowImageWindow.h"
 
+#include 
 #include 
 #include 
 #include 

Modified: haiku/trunk/src/shared/AboutWindow.cpp
===================================================================
--- haiku/trunk/src/shared/AboutWindow.cpp	2007-06-12 20:44:45 UTC (rev 21401)
+++ haiku/trunk/src/shared/AboutWindow.cpp	2007-06-13 02:35:29 UTC (rev 21402)
@@ -6,8 +6,7 @@
  *		Ryan Leavengood, leavengood at gmail.com
  */
 
-#include "AboutWindow.h"
-
+#include 
 #include 
 #include 
 #include 



From leavengood at mail.berlios.de  Wed Jun 13 04:36:18 2007
From: leavengood at mail.berlios.de (leavengood at BerliOS)
Date: Wed, 13 Jun 2007 04:36:18 +0200
Subject: [Haiku-commits] r21403 - haiku/trunk/headers/private/shared
Message-ID: <200706130236.l5D2aIh5008381@sheep.berlios.de>

Author: leavengood
Date: 2007-06-13 04:36:18 +0200 (Wed, 13 Jun 2007)
New Revision: 21403
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21403&view=rev

Added:
   haiku/trunk/headers/private/shared/AboutWindow.h
Log:
Adding the header.


Added: haiku/trunk/headers/private/shared/AboutWindow.h
===================================================================
--- haiku/trunk/headers/private/shared/AboutWindow.h	2007-06-13 02:35:29 UTC (rev 21402)
+++ haiku/trunk/headers/private/shared/AboutWindow.h	2007-06-13 02:36:18 UTC (rev 21403)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2007 Haiku, Inc.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *		Ryan Leavengood, leavengood at gmail.com
+ */
+#ifndef B_ABOUT_WINDOW_H
+#define B_ABOUT_WINDOW_H
+
+
+#include 
+
+
+class BAboutWindow {
+	public:
+		BAboutWindow(char *appName, int32 firstCopyrightYear,
+			const char **authors, char *extraInfo = NULL);
+		virtual ~BAboutWindow();
+
+		void Show();
+
+	private:
+		BString* 		fAppName;
+		BString*		fText;
+};
+
+#endif	// B_ABOUT_WINDOW_H



From nielx at mail.berlios.de  Wed Jun 13 14:53:51 2007
From: nielx at mail.berlios.de (nielx at BerliOS)
Date: Wed, 13 Jun 2007 14:53:51 +0200
Subject: [Haiku-commits] r21404 - haiku/trunk/docs/user
Message-ID: <200706131253.l5DCrprD010733@sheep.berlios.de>

Author: nielx
Date: 2007-06-13 14:53:48 +0200 (Wed, 13 Jun 2007)
New Revision: 21404
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21404&view=rev

Modified:
   haiku/trunk/docs/user/Doxyfile
Log:
Update to Doxygen 1.5.2.

Please update your executable if you are generating the documentation.

Modified: haiku/trunk/docs/user/Doxyfile
===================================================================
--- haiku/trunk/docs/user/Doxyfile	2007-06-13 02:36:18 UTC (rev 21403)
+++ haiku/trunk/docs/user/Doxyfile	2007-06-13 12:53:48 UTC (rev 21404)
@@ -1,4 +1,4 @@
-# Doxyfile 1.5.1-p1
+# Doxyfile 1.5.2
 
 # This file describes the settings to be used by the documentation system
 # doxygen (www.doxygen.org) for a project
@@ -14,6 +14,14 @@
 # Project related configuration options
 #---------------------------------------------------------------------------
 
+# This tag specifies the encoding used for all characters in the config file that 
+# follow. The default is UTF-8 which is also the encoding used for all text before 
+# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into 
+# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of 
+# possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
 # by quotes) that should identify the project.
 
@@ -53,16 +61,6 @@
 
 OUTPUT_LANGUAGE        = English
 
-# This tag can be used to specify the encoding used in the generated output. 
-# The encoding is not always determined by the language that is chosen, 
-# but also whether or not the output is meant for Windows or non-Windows users. 
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
-# forces the Windows encoding (this is the default for the Windows binary), 
-# whereas setting the tag to NO uses a Unix-style encoding (the default for 
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING   = YES
-
 # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
 # include brief member descriptions after the members that are listed in 
 # the file and class documentation (similar to JavaDoc). 
@@ -204,6 +202,11 @@
 
 BUILTIN_STL_SUPPORT    = NO
 
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
 # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
 # tag is set to YES, then doxygen will reuse the documentation of the first 
 # member in the group (if any) for the other members of the group. By default 
@@ -471,6 +474,13 @@
                          ../../headers/os/support \
                          ../../headers/posix/syslog.h
 
+# This tag can be used to specify the character encoding of the source files that 
+# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default 
+# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. 
+# See http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
 # If the value of the INPUT tag contains directories, you can use the 
 # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
 # and *.h) to filter out the source-files in the directories. If left 
@@ -509,6 +519,13 @@
 
 EXCLUDE_PATTERNS       = */libkernelppp/_KPPP*
 
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
+# (namespaces, classes, functions, etc.) that should be excluded from the output. 
+# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, 
+# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = 
+
 # The EXAMPLE_PATH tag can be used to specify one or more files or 
 # directories that contain example code fragments that are included (see 
 # the \include command).
@@ -1031,7 +1048,8 @@
 #   check whether or not types.h has already been included. There is no need
 #   to put these definitions in our docs.
 
-PREDEFINED             = __cplusplus _SYS_TYPES_H
+PREDEFINED             = __cplusplus \
+                         _SYS_TYPES_H
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
 # this tag can be used to specify a list of macro names that should be expanded. 
@@ -1104,6 +1122,14 @@
 
 CLASS_DIAGRAMS         = YES
 
+# You can define message sequence charts within doxygen comments using the \msc 
+# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to 
+# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to 
+# specify the directory where the mscgen tool resides. If left empty the tool is assumed to 
+# be found in the default search path.
+
+MSCGEN_PATH            = 
+
 # If set to YES, the inheritance and collaboration graphs will hide 
 # inheritance and usage relations if the target is undocumented 
 # or is not a class.
@@ -1206,34 +1232,14 @@
 
 DOTFILE_DIRS           = 
 
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
-# this value, doxygen will try to truncate the graph, so that it fits within 
-# the specified constraint. Beware that most browsers cannot cope with very 
-# large images.
+# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
+# nodes that will be shown in the graph. If the number of nodes in a graph 
+# becomes larger than this value, doxygen will truncate the graph, which is 
+# visualized by representing a node as a red box. Note that doxygen will always 
+# show the root nodes and its direct children regardless of this setting.
 
-MAX_DOT_GRAPH_WIDTH    = 1024
+DOT_GRAPH_MAX_NODES    = 50
 
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
-# this value, doxygen will try to truncate the graph, so that it fits within 
-# the specified constraint. Beware that most browsers cannot cope with very 
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT   = 1024
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
-# graphs generated by dot. A depth value of 3 means that only nodes reachable 
-# from the root by following a path via at most 3 edges will be shown. Nodes 
-# that lay further from the root node will be omitted. Note that setting this 
-# option to 1 or 2 may greatly reduce the computation time needed for large 
-# code bases. Also note that a graph may be further truncated if the graph's 
-# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH 
-# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), 
-# the graph is not depth-constrained.
-
-MAX_DOT_GRAPH_DEPTH    = 0
-
 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
 # background. This is disabled by default, which results in a white background. 
 # Warning: Depending on the platform used, enabling this option may lead to 



From jonas at kirilla.com  Wed Jun 13 16:40:28 2007
From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=)
Date: Wed, 13 Jun 2007 16:40:28 +0200 CEST
Subject: [Haiku-commits]
 =?iso-8859-1?q?r21402_-_in_haiku/trunk=3A_build/j?=
 =?iso-8859-1?q?am_headers_src/apps/showimage_src/shared?=
In-Reply-To: <200706130235.l5D2ZUHw008244@sheep.berlios.de>
Message-ID: <14311129024-BeMail@kirilla>

leavengood at BerliOS  wrote:
> Author: leavengood
> Date: 2007-06-13 04:35:29 +0200 (Wed, 13 Jun 2007)
> New Revision: 21402
> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21402&view=rev
> 
> Removed:
>    haiku/trunk/headers/shared/
> Modified:
>    haiku/trunk/build/jam/FileRules
>    haiku/trunk/build/jam/HeadersRules
>    haiku/trunk/src/apps/showimage/Jamfile
>    haiku/trunk/src/apps/showimage/ShowImageApp.cpp
>    haiku/trunk/src/shared/AboutWindow.cpp
> Log:
> As I said I would:
> 
> 1. Deleted headers/shared/
> 2. Added a Jamfile to src/shared to build it into a static library 
> libshared.a.
> 3. Removed my changes in the build/jam directory.
> 4. Have ShowImage include libshared.a.

I think (2) is missing:
http://svn.berlios.de/viewcvs/haiku/haiku/trunk/src/shared/

/Jonas.


From leavengood at gmail.com  Wed Jun 13 16:52:06 2007
From: leavengood at gmail.com (Ryan Leavengood)
Date: Wed, 13 Jun 2007 10:52:06 -0400
Subject: [Haiku-commits] r21402 - in haiku/trunk: build/jam headers
	src/apps/showimage src/shared
In-Reply-To: <14311129024-BeMail@kirilla>
References: <200706130235.l5D2ZUHw008244@sheep.berlios.de>
	<14311129024-BeMail@kirilla>
Message-ID: 

On 6/13/07, Jonas Sundstr?m  wrote:
>
> I think (2) is missing:
> http://svn.berlios.de/viewcvs/haiku/haiku/trunk/src/shared/

Yeah it is, sorry about that. I don't want the build broken so could
you add it. From memory (hehe) I believe it was:

SubDir HAIKU_TOP src shared ;

UsePrivateHeaders shared ;

StaticLibrary libshared.a :
    AboutWindow.cpp
;

Please use a tab, not spaces before AboutWindow.cpp above.

Thanks :)

Ryan


From kirilla at mail.berlios.de  Wed Jun 13 18:20:18 2007
From: kirilla at mail.berlios.de (kirilla at BerliOS)
Date: Wed, 13 Jun 2007 18:20:18 +0200
Subject: [Haiku-commits] r21405 - in haiku/trunk/src: . shared
Message-ID: <200706131620.l5DGKIB6000068@sheep.berlios.de>

Author: kirilla
Date: 2007-06-13 18:20:18 +0200 (Wed, 13 Jun 2007)
New Revision: 21405
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21405&view=rev

Added:
   haiku/trunk/src/shared/Jamfile
Modified:
   haiku/trunk/src/Jamfile
Log:
Jamfile edit/addition for libshared.a

Modified: haiku/trunk/src/Jamfile
===================================================================
--- haiku/trunk/src/Jamfile	2007-06-13 12:53:48 UTC (rev 21404)
+++ haiku/trunk/src/Jamfile	2007-06-13 16:20:18 UTC (rev 21405)
@@ -10,6 +10,7 @@
 SubInclude HAIKU_TOP src libs ;
 SubInclude HAIKU_TOP src preferences ;
 SubInclude HAIKU_TOP src servers ;
+SubInclude HAIKU_TOP src shared ;
 SubInclude HAIKU_TOP src system ;
 SubInclude HAIKU_TOP src tests ;
 SubInclude HAIKU_TOP src tools ;

Added: haiku/trunk/src/shared/Jamfile
===================================================================
--- haiku/trunk/src/shared/Jamfile	2007-06-13 12:53:48 UTC (rev 21404)
+++ haiku/trunk/src/shared/Jamfile	2007-06-13 16:20:18 UTC (rev 21405)
@@ -0,0 +1,7 @@
+SubDir HAIKU_TOP src shared ;
+
+UsePrivateHeaders shared ;
+
+StaticLibrary libshared.a :
+	AboutWindow.cpp
+;



From jonas at kirilla.com  Wed Jun 13 18:24:34 2007
From: jonas at kirilla.com (Jonas =?iso-8859-1?q?Sundstr=F6m?=)
Date: Wed, 13 Jun 2007 18:24:34 +0200 CEST
Subject: [Haiku-commits]
 =?iso-8859-1?q?r21402_-_in_haiku/trunk=3A_build/j?=
 =?iso-8859-1?q?am_headers_src/apps/showimage_src/shared?=
In-Reply-To: 
Message-ID: <4825812602-BeMail@kirilla>

"Ryan Leavengood"  wrote:
 ...
> Yeah it is, sorry about that. I don't want the build broken so 
> could you add it. From memory (hehe) I believe it was:
 ...


From leavengood at gmail.com  Wed Jun 13 18:34:45 2007
From: leavengood at gmail.com (Ryan Leavengood)
Date: Wed, 13 Jun 2007 12:34:45 -0400
Subject: [Haiku-commits] r21405 - in haiku/trunk/src: . shared
In-Reply-To: <200706131620.l5DGKIB6000068@sheep.berlios.de>
References: <200706131620.l5DGKIB6000068@sheep.berlios.de>
Message-ID: 

On 6/13/07, kirilla at BerliOS  wrote:
> Author: kirilla
>
> Log:
> Jamfile edit/addition for libshared.a

Thank you sir! :)

Ryan


From axeld at mail.berlios.de  Thu Jun 14 01:12:02 2007
From: axeld at mail.berlios.de (axeld at BerliOS)
Date: Thu, 14 Jun 2007 01:12:02 +0200
Subject: [Haiku-commits] r21406 - in haiku/trunk: data/system/boot
	src/system/runtime_loader
Message-ID: <200706132312.l5DNC2Ln008407@sheep.berlios.de>

Author: axeld
Date: 2007-06-14 01:12:00 +0200 (Thu, 14 Jun 2007)
New Revision: 21406
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21406&view=rev

Modified:
   haiku/trunk/data/system/boot/SetupEnvironment
   haiku/trunk/src/system/runtime_loader/runtime_loader.c
Log:
* Removed all user paths from the default runtime_loader paths.
* $PATH is now set differently when booted in safe mode (just like LIBRARY_PATH,
  and ADDON_PATH already were).
* This closes ticket #1103.


Modified: haiku/trunk/data/system/boot/SetupEnvironment
===================================================================
--- haiku/trunk/data/system/boot/SetupEnvironment	2007-06-13 16:20:18 UTC (rev 21405)
+++ haiku/trunk/data/system/boot/SetupEnvironment	2007-06-13 23:12:00 UTC (rev 21406)
@@ -42,13 +42,13 @@
 export BE_DEFAULT_C_FLAGS=""
 export BE_DEFAULT_CPLUS_FLAGS=""
 
-export PATH=.:$HOME/config/bin:/bin:/boot/apps:/boot/preferences:/boot/beos/apps:/boot/beos/preferences:$BETOOLS
-
 if [ "$SAFEMODE" != "yes" ]
 then
+	export PATH=.:$HOME/config/bin:/bin:/boot/apps:/boot/preferences:/boot/beos/apps:/boot/beos/preferences:$BETOOLS
 	export LIBRARY_PATH="%A/lib:$HOME/config/lib:/boot/beos/system/lib"
 	export ADDON_PATH="%A/add-ons:$HOME/config/add-ons:/boot/beos/system/add-ons"
 else
+	export PATH=.:/bin:/boot/apps:/boot/preferences:/boot/beos/apps:/boot/beos/preferences:$BETOOLS
 	export LIBRARY_PATH="%A/lib:/boot/beos/system/lib"
 	export ADDON_PATH="%A/add-ons:/boot/beos/system/add-ons"
 fi

Modified: haiku/trunk/src/system/runtime_loader/runtime_loader.c
===================================================================
--- haiku/trunk/src/system/runtime_loader/runtime_loader.c	2007-06-13 16:20:18 UTC (rev 21405)
+++ haiku/trunk/src/system/runtime_loader/runtime_loader.c	2007-06-13 23:12:00 UTC (rev 21406)
@@ -49,14 +49,17 @@
 			return NULL;
 	}
 
-	// ToDo: for now, if the variable was not set, return default paths
 	if (path != NULL)
 		return path;
 
+	// The environment variables may not have been set yet - in that case,
+	// we're returning some useful defaults.
+	// Since the kernel does not set any variables, this is also needed
+	// to start the root shell.
+
 	switch (type) {
 		case B_APP_IMAGE:
-			return "/boot/home/config/bin:"
-				"/bin:"
+			return "/bin:"
 				"/boot/apps:"
 				"/boot/preferences:"
 				"/boot/beos/apps:"
@@ -64,11 +67,10 @@
 				"/boot/develop/tools/gnupro/bin";
 
 		case B_LIBRARY_IMAGE:
-			return "%A/lib:/boot/home/config/lib:/boot/beos/system/lib";
+			return "%A/lib:/boot/beos/system/lib";
 
 		case B_ADD_ON_IMAGE:
 			return "%A/add-ons"
-				":/boot/home/config/add-ons"
 				":/boot/beos/system/add-ons";
 
 		default:



From geist at mail.berlios.de  Thu Jun 14 07:18:00 2007
From: geist at mail.berlios.de (geist at BerliOS)
Date: Thu, 14 Jun 2007 07:18:00 +0200
Subject: [Haiku-commits] r21407 - in haiku/trunk/src: build/libroot
	tools/fs_shell tools/rc
Message-ID: <200706140518.l5E5I0S4017967@sheep.berlios.de>

Author: geist
Date: 2007-06-14 07:17:59 +0200 (Thu, 14 Jun 2007)
New Revision: 21407
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21407&view=rev

Modified:
   haiku/trunk/src/build/libroot/Jamfile
   haiku/trunk/src/tools/fs_shell/driver_settings.cpp
   haiku/trunk/src/tools/rc/Jamfile
Log:
fix the build on darwin:
-fs_shell was using weak aliases, which is apparently not supported on the darwin toolchain 
	(or it's supported in some different way)
-remove building strl* routines for some of the host tools, since that already exists in libSystem


Modified: haiku/trunk/src/build/libroot/Jamfile
===================================================================
--- haiku/trunk/src/build/libroot/Jamfile	2007-06-13 23:12:00 UTC (rev 21406)
+++ haiku/trunk/src/build/libroot/Jamfile	2007-06-14 05:17:59 UTC (rev 21407)
@@ -21,6 +21,11 @@
 # locate the library
 MakeLocate libroot_build.so : $(HOST_BUILD_COMPATIBILITY_LIB_DIR) ;
 
+# darwin already has strlcpy and strlcat in libSystem
+if $(HOST_PLATFORM) != darwin {
+STRLSRC = strlcpy.c strlcat.c ;
+}
+
 BuildPlatformSharedLibrary libroot_build.so :
 	atomic.cpp
 	byteorder.cpp
@@ -32,8 +37,7 @@
 	sem.cpp
 	thread.cpp
 
-	strlcpy.c
-	strlcat.c
+	$(STRLSRC)
 	strnlen.c
 
 	:

Modified: haiku/trunk/src/tools/fs_shell/driver_settings.cpp
===================================================================
--- haiku/trunk/src/tools/fs_shell/driver_settings.cpp	2007-06-13 23:12:00 UTC (rev 21406)
+++ haiku/trunk/src/tools/fs_shell/driver_settings.cpp	2007-06-14 05:17:59 UTC (rev 21407)
@@ -869,9 +869,18 @@
 	return &((settings_handle *)handle)->settings;
 }
 
-
+#ifndef HAIKU_HOST_PLATFORM_DARWIN
 // this creates an alias of the above function
 // unload_driver_settings() is the same as delete_driver_settings()
 extern "C" __typeof(fssh_unload_driver_settings) fssh_delete_driver_settings
 	__attribute__ ((alias ("fssh_unload_driver_settings")));
+#else
+// can't use weak aliases on darwin apparently
+fssh_status_t
+fssh_delete_driver_settings(void *handle)
+{
+	return fssh_unload_driver_settings(handle);
+}
+#endif
 
+

Modified: haiku/trunk/src/tools/rc/Jamfile
===================================================================
--- haiku/trunk/src/tools/rc/Jamfile	2007-06-13 23:12:00 UTC (rev 21406)
+++ haiku/trunk/src/tools/rc/Jamfile	2007-06-14 05:17:59 UTC (rev 21407)
@@ -13,12 +13,16 @@
 BuildPlatformStaticLibrary librdef.a :
 	compile.cpp decompile.cpp lexer.l parser.y rdef.cpp ;
 
+# these platforms do not need a second copy of the strl routines
+if $(HOST_PLATFORM) != darwin && $(HOST_PLATFORM) != linux && $(HOST_PLATFORM) != freebsd {
+STRLSRC = strlcpy.c strlcat.c ;
+}
+
 BuildPlatformMain rc :
 	rc.cpp
 
 	# these two are needed for R5 only
-	strlcpy.c
-	strlcat.c
+	$(STRLSRC)
 ;
 LinkAgainst rc
 	: librdef.a $(HOST_LIBSTDC++) $(HOST_LIBBE) $(HOST_LIBSUPC++) ;



From jackburton at mail.berlios.de  Thu Jun 14 12:25:16 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Thu, 14 Jun 2007 12:25:16 +0200
Subject: [Haiku-commits] r21408 - haiku/trunk/src/kits/game
Message-ID: <200706141025.l5EAPGw7028142@sheep.berlios.de>

Author: jackburton
Date: 2007-06-14 12:25:14 +0200 (Thu, 14 Jun 2007)
New Revision: 21408
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21408&view=rev

Modified:
   haiku/trunk/src/kits/game/WindowScreen.cpp
Log:
Call get_clone_info and get_clone_info_size instead of using the 
driver's path. More correct. Now we could remove the app_server's 
command to retrieve the driver's path.



Modified: haiku/trunk/src/kits/game/WindowScreen.cpp
===================================================================
--- haiku/trunk/src/kits/game/WindowScreen.cpp	2007-06-14 05:17:59 UTC (rev 21407)
+++ haiku/trunk/src/kits/game/WindowScreen.cpp	2007-06-14 10:25:14 UTC (rev 21408)
@@ -1006,23 +1006,36 @@
 		return status;
 	}
 	
+	accelerant_clone_info_size clone_info_size;
+	get_accelerant_clone_info clone_info;
+	clone_accelerant clone;
+	clone_info_size = (accelerant_clone_info_size)fGetAccelerantHook(B_ACCELERANT_CLONE_INFO_SIZE, NULL);
+	clone_info = (get_accelerant_clone_info)fGetAccelerantHook(B_GET_ACCELERANT_CLONE_INFO, NULL);
+	clone = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL);
+
 	status = B_ERROR;
-	clone_accelerant clone = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, 0);
-	if (clone == NULL) {
+	if (!clone_info_size || !clone_info || !clone) {
 		printf("InitClone: cannot get clone hook\n");
 		unload_add_on(fAddonImage);
 		fAddonImage = -1;
 		return status;
 	}
 
-	link.StartMessage(AS_GET_DRIVER_PATH);
-	link.Attach(fWorkspaceIndex);
-	if (link.FlushWithReply(status) == B_OK && status == B_OK) {
-		BString driverPath;
-		link.ReadString(driverPath);
-		status = clone((void *)driverPath.String());
+	ssize_t cloneInfoSize = clone_info_size();
+	void *cloneInfo = malloc(cloneInfoSize);
+	if (!cloneInfo) {
+		unload_add_on(fAddonImage);
+		fAddonImage = -1;
+		return B_NO_MEMORY;
 	}
+
+	clone_info(cloneInfo);
+		// no way to see if this call fails
+
+	status = clone(cloneInfo);
 	
+	free(cloneInfo);
+
 	if (status < B_OK) {
 		printf("InitClone: cannot clone accelerant\n");
 		unload_add_on(fAddonImage);



From axeld at pinc-software.de  Thu Jun 14 13:41:07 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Thu, 14 Jun 2007 13:41:07 +0200 CEST
Subject: [Haiku-commits] r21408 - haiku/trunk/src/kits/game
In-Reply-To: <200706141025.l5EAPGw7028142@sheep.berlios.de>
Message-ID: <9050840455-BeMail@ibm>

jackburton at BerliOS  wrote:
> Log:
> Call get_clone_info and get_clone_info_size instead of using the 
> driver's path. More correct. Now we could remove the app_server's 
> command to retrieve the driver's path.

Actually, I planned to phase out the clone info stuff completely, as it 
doesn't make much sense the way it's done. But I first wanted to 
implement a proper multi-head protocol before deciding anything there, 
as that might give new insights.

Furthermore:
+	accelerant_clone_info_size clone_info_size;
+	get_accelerant_clone_info clone_info;

would be cloneInfoSize and cloneInfo :-)

Bye,
   Axel.



From stefano.ceccherini at gmail.com  Thu Jun 14 13:46:58 2007
From: stefano.ceccherini at gmail.com (Stefano Ceccherini)
Date: Thu, 14 Jun 2007 13:46:58 +0200
Subject: [Haiku-commits] r21408 - haiku/trunk/src/kits/game
In-Reply-To: <9050840455-BeMail@ibm>
References: <200706141025.l5EAPGw7028142@sheep.berlios.de>
	<9050840455-BeMail@ibm>
Message-ID: <894b9700706140446m44fd758dq57b3d83e546a7f2a@mail.gmail.com>

2007/6/14, Axel D?rfler :

> Actually, I planned to phase out the clone info stuff completely, as it
> doesn't make much sense the way it's done. But I first wanted to
> implement a proper multi-head protocol before deciding anything there,
> as that might give new insights.

Ok. I just thought it would be more correct this way, given our
current accelerant interface.

> Furthermore:
> +       accelerant_clone_info_size clone_info_size;
> +       get_accelerant_clone_info clone_info;
>
> would be cloneInfoSize and cloneInfo :-)

Indeed. I'll fix that.


From axeld at pinc-software.de  Thu Jun 14 13:53:01 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Thu, 14 Jun 2007 13:53:01 +0200 CEST
Subject: [Haiku-commits] r21408 - haiku/trunk/src/kits/game
In-Reply-To: <894b9700706140446m44fd758dq57b3d83e546a7f2a@mail.gmail.com>
Message-ID: <9764240543-BeMail@ibm>

"Stefano Ceccherini"  wrote:
> 2007/6/14, Axel D?rfler :
> > Actually, I planned to phase out the clone info stuff completely, 
> > as it
> > doesn't make much sense the way it's done. But I first wanted to
> > implement a proper multi-head protocol before deciding anything 
> > there,
> > as that might give new insights.
> Ok. I just thought it would be more correct this way, given our
> current accelerant interface.

Yes, you're right, I just wanted to make clear why it was done the way 
it was :-)

Bye,
   Axel.



From stefano.ceccherini at gmail.com  Thu Jun 14 14:00:46 2007
From: stefano.ceccherini at gmail.com (Stefano Ceccherini)
Date: Thu, 14 Jun 2007 14:00:46 +0200
Subject: [Haiku-commits] r21408 - haiku/trunk/src/kits/game
In-Reply-To: <9050840455-BeMail@ibm>
References: <200706141025.l5EAPGw7028142@sheep.berlios.de>
	<9050840455-BeMail@ibm>
Message-ID: <894b9700706140500r139e3db0ya31031229a96c890@mail.gmail.com>

2007/6/14, Axel D?rfler :
> jackburton at BerliOS  wrote:
> > Log:
> > Call get_clone_info and get_clone_info_size instead of using the
> > driver's path. More correct. Now we could remove the app_server's
> > command to retrieve the driver's path.
>
> Actually, I planned to phase out the clone info stuff completely, as it
> doesn't make much sense the way it's done. But I first wanted to
> implement a proper multi-head protocol before deciding anything there,
> as that might give new insights.
>
> Furthermore:
> +       accelerant_clone_info_size clone_info_size;
> +       get_accelerant_clone_info clone_info;
>
> would be cloneInfoSize and cloneInfo :-)
>
BTW now I see why I called them this way: because they are function
pointers, and right after that, I called the variables returned by
them exactly "cloneInfoSize" and "cloneInfo"...


From stippi at mail.berlios.de  Thu Jun 14 16:40:59 2007
From: stippi at mail.berlios.de (stippi at BerliOS)
Date: Thu, 14 Jun 2007 16:40:59 +0200
Subject: [Haiku-commits] r21409 - in
	haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5:
	headers/shared src/test/netfs/client
	src/test/netfs/headers/shared src/test/netfs/server
	src/test/netfs/shared
Message-ID: <200706141440.l5EEexpF006708@sheep.berlios.de>

Author: stippi
Date: 2007-06-14 16:40:58 +0200 (Thu, 14 Jun 2007)
New Revision: 21409
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21409&view=rev

Modified:
   haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/headers/shared/Compatibility.h
   haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/client/ServerManager.cpp
   haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/headers/shared/InsecureConnection.h
   haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/headers/shared/NetAddress.h
   haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/headers/shared/Utils.h
   haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/server/InsecureConnectionListener.h
   haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/server/NetFSServer.cpp
   haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/server/SecurityContext.cpp
   haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/InsecureChannel.cpp
   haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/KMessage.cpp
Log:
with Ingo's help:
* fixed the build of netfs under BONE/Dano by using
  the already existing build system defines instead of wrong checks
  for wether to use BONE headers
* the client tried to bind to a non existing address for receiving
  broadcasts from the server (but the broadcasts are still not received,
  which will be worked on next)


Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/headers/shared/Compatibility.h
===================================================================
--- haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/headers/shared/Compatibility.h	2007-06-14 10:25:14 UTC (rev 21408)
+++ haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/headers/shared/Compatibility.h	2007-06-14 14:40:58 UTC (rev 21409)
@@ -30,7 +30,7 @@
 
 #include 
 
-#if B_BEOS_VERSION <= B_BEOS_VERSION_5
+#ifdef HAIKU_TARGET_PLATFORM_BEOS
 //#	define B_BAD_DATA -2147483632L
 #else
 #	ifndef closesocket

Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/client/ServerManager.cpp
===================================================================
--- haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/client/ServerManager.cpp	2007-06-14 10:25:14 UTC (rev 21408)
+++ haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/client/ServerManager.cpp	2007-06-14 14:40:58 UTC (rev 21409)
@@ -3,7 +3,7 @@
 #include 
 #include 
 
-#if B_BEOS_VERSION <= B_BEOS_VERSION_5
+#ifdef HAIKU_TARGET_PLATFORM_BEOS
 #	include 
 #else
 #	include 
@@ -293,7 +293,7 @@
 		sockaddr_in addr;
 		addr.sin_family = AF_INET;
 		addr.sin_port = htons(kDefaultBroadcastPort);
-		addr.sin_addr.s_addr = INADDR_BROADCAST;
+		addr.sin_addr.s_addr = INADDR_ANY;
 		int addrSize = sizeof(addr);
 		BroadcastMessage message;
 //PRINT(("ServerManager::_BroadcastListener(): recvfrom()...\n"));

Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/headers/shared/InsecureConnection.h
===================================================================
--- haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/headers/shared/InsecureConnection.h	2007-06-14 10:25:14 UTC (rev 21408)
+++ haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/headers/shared/InsecureConnection.h	2007-06-14 14:40:58 UTC (rev 21409)
@@ -3,7 +3,7 @@
 #ifndef NET_FS_INSECURE_CONNECTION_H
 #define NET_FS_INSECURE_CONNECTION_H
 
-#if B_BEOS_VERSION <= B_BEOS_VERSION_5
+#ifdef HAIKU_TARGET_PLATFORM_BEOS
 #	include 
 #else
 #	include 

Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/headers/shared/NetAddress.h
===================================================================
--- haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/headers/shared/NetAddress.h	2007-06-14 10:25:14 UTC (rev 21408)
+++ haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/headers/shared/NetAddress.h	2007-06-14 14:40:58 UTC (rev 21409)
@@ -3,7 +3,7 @@
 #ifndef NET_FS_NET_ADDRESS_H
 #define NET_FS_NET_ADDRESS_H
 
-#if B_BEOS_VERSION <= B_BEOS_VERSION_5
+#ifdef HAIKU_TARGET_PLATFORM_BEOS
 #	include 
 #else
 #	include 

Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/headers/shared/Utils.h
===================================================================
--- haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/headers/shared/Utils.h	2007-06-14 10:25:14 UTC (rev 21408)
+++ haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/headers/shared/Utils.h	2007-06-14 14:40:58 UTC (rev 21409)
@@ -3,9 +3,10 @@
 #ifndef UTILS_H
 #define UTILS_H
 
-#if B_BEOS_VERSION <= B_BEOS_VERSION_5
+#ifdef HAIKU_TARGET_PLATFORM_BEOS
 #	include 
 #else
+#	include 
 #	include 
 #endif
 
@@ -26,8 +27,12 @@
 safe_closesocket(vint32& socketVar)
 {
 	int32 socket = atomic_or(&socketVar, -1);
-	if (socket >= 0)
+	if (socket >= 0) {
+#ifndef HAIKU_TARGET_PLATFORM_BEOS
+		shutdown(socket, SHUTDOWN_BOTH);
+#endif
 		closesocket(socket);
+	}
 }
 
 #endif	// UTILS_H

Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/server/InsecureConnectionListener.h
===================================================================
--- haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/server/InsecureConnectionListener.h	2007-06-14 10:25:14 UTC (rev 21408)
+++ haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/server/InsecureConnectionListener.h	2007-06-14 14:40:58 UTC (rev 21409)
@@ -3,7 +3,7 @@
 #ifndef NET_FS_INSECURE_CONNECTION_LISTENER_H
 #define NET_FS_INSECURE_CONNECTION_LISTENER_H
 
-#if B_BEOS_VERSION <= B_BEOS_VERSION_5
+#ifdef HAIKU_TARGET_PLATFORM_BEOS
 #	include 
 #else
 #	include 

Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/server/NetFSServer.cpp
===================================================================
--- haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/server/NetFSServer.cpp	2007-06-14 10:25:14 UTC (rev 21408)
+++ haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/server/NetFSServer.cpp	2007-06-14 14:40:58 UTC (rev 21409)
@@ -6,7 +6,7 @@
 #include 
 #include 
 
-#if B_BEOS_VERSION <= B_BEOS_VERSION_5
+#ifdef HAIKU_TARGET_PLATFORM_BEOS
 #	include 
 #else
 #	include 
@@ -1172,7 +1172,7 @@
 	}
 
 	// set the socket broadcast option
-	#if B_BEOS_VERSION > B_BEOS_VERSION_5
+	#ifndef HAIKU_TARGET_PLATFORM_BEOS
 		int soBroadcastValue = 1;
 		if (setsockopt(fBroadcastingSocket, SOL_SOCKET, SO_BROADCAST,
 			&soBroadcastValue, sizeof(soBroadcastValue)) < 0) {

Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/server/SecurityContext.cpp
===================================================================
--- haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/server/SecurityContext.cpp	2007-06-14 10:25:14 UTC (rev 21408)
+++ haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/server/SecurityContext.cpp	2007-06-14 14:40:58 UTC (rev 21409)
@@ -423,10 +423,10 @@
 	BMessage permissionsArchive;
 	if (archive->FindMessage("permissions", &permissionsArchive) != B_OK)
 		return;
-	#if B_BEOS_VERSION <= B_BEOS_VERSION_5
+	#ifdef HAIKU_TARGET_PLATFORM_DANO
+		const char* userName;
+	#else
 		char* userName;
-	#else
-		const char* userName;
 	#endif
 	type_code type;
 	for (int32 userIndex = 0; 
@@ -442,10 +442,10 @@
 			return;
 
 		// got a user: iterate through its permissions
-		#if B_BEOS_VERSION <= B_BEOS_VERSION_5
+		#ifdef HAIKU_TARGET_PLATFORM_DANO
+			const char* path;
+		#else
 			char* path;
-		#else
-			const char* path;
 		#endif
 		for (int32 i = 0; 
 			 userArchive.GetInfo(B_INT32_TYPE, i, &path, &type) == B_OK;

Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/InsecureChannel.cpp
===================================================================
--- haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/InsecureChannel.cpp	2007-06-14 10:25:14 UTC (rev 21408)
+++ haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/InsecureChannel.cpp	2007-06-14 14:40:58 UTC (rev 21409)
@@ -2,7 +2,7 @@
 
 #include 
 
-#if B_BEOS_VERSION <= B_BEOS_VERSION_5
+#ifdef HAIKU_TARGET_PLATFORM_BEOS
 #	include 
 #else
 #	include 
@@ -30,7 +30,7 @@
 		int dontBlock = 0;
 		setsockopt(fSocket, SOL_SOCKET, SO_NONBLOCK, &dontBlock, sizeof(int));
 
-#if B_BEOS_VERSION > B_BEOS_VERSION_5
+#ifndef HAIKU_TARGET_PLATFORM_BEOS
 		int txLowWater = 1;
 		setsockopt(fSocket, SOL_SOCKET, SO_SNDLOWAT, &txLowWater, sizeof(int));
 		setsockopt(fSocket, SOL_SOCKET, SO_RCVLOWAT, &txLowWater, sizeof(int));

Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/KMessage.cpp
===================================================================
--- haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/KMessage.cpp	2007-06-14 10:25:14 UTC (rev 21408)
+++ haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/KMessage.cpp	2007-06-14 14:40:58 UTC (rev 21409)
@@ -21,9 +21,6 @@
 static const uint32 kMessageHeaderMagic = 'kMsG';
 static const int32 kMessageReallocChunkSize = 64;
 
-#if B_BEOS_VERSION <= B_BEOS_VERSION_5
-//#	define B_BAD_DATA -2147483632L
-#endif
 #ifndef B_BUFFER_OVERFLOW
 #	define B_BUFFER_OVERFLOW	EOVERFLOW
 #endif



From jackburton at mail.berlios.de  Thu Jun 14 16:41:45 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Thu, 14 Jun 2007 16:41:45 +0200
Subject: [Haiku-commits] r21410 - in haiku/trunk:
	headers/private/graphics/vmware src/add-ons/accelerants/vmware
	src/add-ons/kernel/drivers/graphics/vmware
Message-ID: <200706141441.l5EEfjh4007063@sheep.berlios.de>

Author: jackburton
Date: 2007-06-14 16:41:45 +0200 (Thu, 14 Jun 2007)
New Revision: 21410
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21410&view=rev

Modified:
   haiku/trunk/headers/private/graphics/vmware/DriverInterface.h
   haiku/trunk/src/add-ons/accelerants/vmware/InitAccelerant.c
   haiku/trunk/src/add-ons/accelerants/vmware/ProposeDisplayMode.c
   haiku/trunk/src/add-ons/accelerants/vmware/SetDisplayMode.c
   haiku/trunk/src/add-ons/kernel/drivers/graphics/vmware/device.c
Log:
Implemented needed methods to be able to clone the accelerant.
Implemented SetIndexedColors hook, although not really correct.
I don't know why the driver's 8 bit mode were disabled. They seem to 
work fine. I had to enable at least 640x480x8 to be able to test 
WindowScreen. There are some TODOs in the code. I'll look into them 
later.


Modified: haiku/trunk/headers/private/graphics/vmware/DriverInterface.h
===================================================================
--- haiku/trunk/headers/private/graphics/vmware/DriverInterface.h	2007-06-14 14:40:58 UTC (rev 21409)
+++ haiku/trunk/headers/private/graphics/vmware/DriverInterface.h	2007-06-14 14:41:45 UTC (rev 21410)
@@ -72,6 +72,8 @@
 	VMWARE_SET_MODE,
 	VMWARE_SHOW_CURSOR,
 	VMWARE_MOVE_CURSOR,
+	VMWARE_GET_DEVICE_NAME,
+	VMWARE_SET_PALETTE
 };
 
 

Modified: haiku/trunk/src/add-ons/accelerants/vmware/InitAccelerant.c
===================================================================
--- haiku/trunk/src/add-ons/accelerants/vmware/InitAccelerant.c	2007-06-14 14:40:58 UTC (rev 21409)
+++ haiku/trunk/src/add-ons/accelerants/vmware/InitAccelerant.c	2007-06-14 14:41:45 UTC (rev 21410)
@@ -28,7 +28,7 @@
 	gFd = fd;
 
 	/* Contact driver and get a pointer to the registers and shared data */
-	if ((ret = ioctl(fd, VMWARE_GET_PRIVATE_DATA, &gSharedArea,
+	if ((ret = ioctl(gFd, VMWARE_GET_PRIVATE_DATA, &gSharedArea,
 			sizeof(area_id))) != B_OK) {
 		TRACE("VMWARE_GET_PRIVATE_DATA failed (%d\n", ret);
 		return ret;
@@ -76,22 +76,50 @@
 ssize_t
 ACCELERANT_CLONE_INFO_SIZE()
 {
-	return MAX_SAMPLE_DEVICE_NAME_LENGTH;
+	return B_PATH_NAME_LENGTH;
 }
 
 
 void
 GET_ACCELERANT_CLONE_INFO(void *data)
 {
-	/* TODO */
+	TRACE("GET_ACCELERANT_CLONE_INFO (%d)\n", gFd);
+
+	// TODO: I have no idea why this doesn't work: gFd is 0 here !?!?
+	//ioctl(gFd, VMWARE_GET_DEVICE_NAME, data, B_PATH_NAME_LENGTH);
+	strlcpy(data, "graphics/vmware", B_PATH_NAME_LENGTH);	
+	
 }
 
 
 status_t
 CLONE_ACCELERANT(void *data)
 {
-	/* TODO */
-	return B_ERROR;
+	int fd;
+	char path[B_PATH_NAME_LENGTH];
+	status_t ret;
+
+	// create full device name
+	strcpy(path, "/dev/");
+	strlcat(path, (const char *)data, sizeof(path));
+
+	TRACE("CLONE_ACCELERANT: %s\n", (const char *)path);
+
+	fd = open(path, B_READ_WRITE);
+	if (fd < 0)
+		return fd;
+
+	gAccelerantIsClone = 1;
+
+	/* Common initialization for the primary accelerant and clones */
+	if ((ret = InitCommon(fd)) == B_OK) {
+		/* Init semaphores */
+		INIT_BEN(gSi->engineLock);
+		INIT_BEN(gSi->fifoLock);
+	}
+
+	TRACE("CLONE_ACCELERANT: %d\n", ret);
+	return ret;
 }
 
 

Modified: haiku/trunk/src/add-ons/accelerants/vmware/ProposeDisplayMode.c
===================================================================
--- haiku/trunk/src/add-ons/accelerants/vmware/ProposeDisplayMode.c	2007-06-14 14:40:58 UTC (rev 21409)
+++ haiku/trunk/src/add-ons/accelerants/vmware/ProposeDisplayMode.c	2007-06-14 14:41:45 UTC (rev 21410)
@@ -16,6 +16,7 @@
 
 static const display_mode kModeList[] =
 { { { 19660,  640,  672,  744,  776,  480,  490,  494,  505,  0 }, B_RGB32_LITTLE, 640,  480,  0, 0, MODE_FLAGS }, /* 640x480 at 50Hz */
+  { { 19660,  640,  672,  744,  776,  480,  490,  494,  505,  0 }, B_CMAP8,	   640,  480,  0, 0, MODE_FLAGS }, /* 640x480 at 50Hz */
   { { 25250,  800,  832,  920,  952,  500,  511,  515,  526,  0 }, B_RGB32_LITTLE, 800,  500,  0, 0, MODE_FLAGS }, /* 800x500 at 50Hz */
   { { 30970,  800,  832,  944,  976,  600,  613,  618,  631,  0 }, B_RGB32_LITTLE, 800,  600,  0, 0, MODE_FLAGS }, /* 800x600 at 50Hz */
   { { 41980,  1024, 1056, 1208, 1240, 640,  653,  659,  673,  0 }, B_RGB32_LITTLE, 1024, 640,  0, 0, MODE_FLAGS }, /* 1024x640 at 50Hz */
@@ -51,9 +52,6 @@
 		target->virtual_height > gSi->maxHeight)
 		return B_ERROR;
 
-	if (target->space != B_RGB32_LITTLE)
-		return B_ERROR;
-
 	/* Any such mode is OK, even if it isn't in our propose list */
 	return B_OK;
 }

Modified: haiku/trunk/src/add-ons/accelerants/vmware/SetDisplayMode.c
===================================================================
--- haiku/trunk/src/add-ons/accelerants/vmware/SetDisplayMode.c	2007-06-14 14:40:58 UTC (rev 21409)
+++ haiku/trunk/src/add-ons/accelerants/vmware/SetDisplayMode.c	2007-06-14 14:41:45 UTC (rev 21410)
@@ -63,7 +63,17 @@
 void
 SET_INDEXED_COLORS(uint count, uint8 first, uint8 *color_data, uint32 flags)
 {
+	// TODO: Take first and count into account.
+	// Currently we always pass 256 colors (random, most of the times) to the driver. Cool!
+	uint8 colors[256];
+	uint32 i;	
 	TRACE("SET_INDEXED_COLORS\n");
+
+	for (i = 0; i < count; i++) {
+		colors[i + first] = color_data[i];
+	}
+ 
+	ioctl(gFd, VMWARE_SET_PALETTE, colors, sizeof(count));
 }
 
 

Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/vmware/device.c
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/graphics/vmware/device.c	2007-06-14 14:40:58 UTC (rev 21409)
+++ haiku/trunk/src/add-ons/kernel/drivers/graphics/vmware/device.c	2007-06-14 14:41:45 UTC (rev 21410)
@@ -299,9 +299,29 @@
 			WriteReg(SVGA_REG_BITS_PER_PIXEL, BppForSpace(dm->space));
 			si->fbOffset = ReadReg(SVGA_REG_FB_OFFSET);
 			si->bytesPerRow = ReadReg(SVGA_REG_BYTES_PER_LINE);
+			ReadReg(SVGA_REG_DEPTH);
+			ReadReg(SVGA_REG_PSEUDOCOLOR);
+			ReadReg(SVGA_REG_RED_MASK);
+			ReadReg(SVGA_REG_GREEN_MASK);
+			ReadReg(SVGA_REG_BLUE_MASK);
 			return B_OK;
 		}
 
+		case VMWARE_SET_PALETTE:
+		{
+			uint8 *color = (uint8 *)buf;
+			uint32 i;
+			if (ReadReg(SVGA_REG_PSEUDOCOLOR) != 1)
+				return B_ERROR;
+
+			for (i = 0; i < 256; i++) {
+				WriteReg(SVGA_PALETTE_BASE + 3 * i, *color++);
+				WriteReg(SVGA_PALETTE_BASE + 3 * i + 1, *color++);
+				WriteReg(SVGA_PALETTE_BASE + 3 * i + 2, *color++);	
+			}		
+			return B_OK;
+		}
+
 		case VMWARE_MOVE_CURSOR:
 		{
 			uint16 *pos = buf;
@@ -318,6 +338,14 @@
 				SVGA_CURSOR_ON_SHOW);
 			return B_OK;
 		}
+		
+		case VMWARE_GET_DEVICE_NAME:
+			dprintf("device: VMWARE_GET_DEVICE_NAME %s\n", gPd->names[0]);
+			if (user_strlcpy((char *)buf, gPd->names[0],
+					B_PATH_NAME_LENGTH) < B_OK)
+				return B_BAD_ADDRESS;
+			return B_OK;
+			
 	}
 
 	TRACE("ioctl: %ld, %p, %ld\n", msg, buf, len);



From jackburton at mail.berlios.de  Thu Jun 14 16:43:46 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Thu, 14 Jun 2007 16:43:46 +0200
Subject: [Haiku-commits] r21411 - in haiku/trunk/src/tests/kits/game: .
	ParticlesII
Message-ID: <200706141443.l5EEhkgR007779@sheep.berlios.de>

Author: jackburton
Date: 2007-06-14 16:43:45 +0200 (Thu, 14 Jun 2007)
New Revision: 21411
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21411&view=rev

Added:
   haiku/trunk/src/tests/kits/game/ParticlesII/
   haiku/trunk/src/tests/kits/game/ParticlesII/Jamfile
   haiku/trunk/src/tests/kits/game/ParticlesII/particlesII.cpp
Modified:
   haiku/trunk/src/tests/kits/game/Jamfile
Log:
Particles II, which uses BWindowScreen


Modified: haiku/trunk/src/tests/kits/game/Jamfile
===================================================================
--- haiku/trunk/src/tests/kits/game/Jamfile	2007-06-14 14:41:45 UTC (rev 21410)
+++ haiku/trunk/src/tests/kits/game/Jamfile	2007-06-14 14:43:45 UTC (rev 21411)
@@ -7,3 +7,5 @@
 SubInclude HAIKU_TOP src tests kits game direct_window_info_test ;
 SubInclude HAIKU_TOP src tests kits game page_flipper ;
 SubInclude HAIKU_TOP src tests kits game chart ;
+SubInclude HAIKU_TOP src tests kits game ParticlesII ;
+

Added: haiku/trunk/src/tests/kits/game/ParticlesII/Jamfile
===================================================================
--- haiku/trunk/src/tests/kits/game/ParticlesII/Jamfile	2007-06-14 14:41:45 UTC (rev 21410)
+++ haiku/trunk/src/tests/kits/game/ParticlesII/Jamfile	2007-06-14 14:43:45 UTC (rev 21411)
@@ -0,0 +1,7 @@
+SubDir HAIKU_TOP src tests kits game ParticlesII ;
+
+SimpleTest ParticlesII
+	: particlesII.cpp
+	: game be root
+;
+

Added: haiku/trunk/src/tests/kits/game/ParticlesII/particlesII.cpp
===================================================================
--- haiku/trunk/src/tests/kits/game/ParticlesII/particlesII.cpp	2007-06-14 14:41:45 UTC (rev 21410)
+++ haiku/trunk/src/tests/kits/game/ParticlesII/particlesII.cpp	2007-06-14 14:43:45 UTC (rev 21411)
@@ -0,0 +1,645 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include  // min_c() and max_c()
+
+#ifdef DEBUGGING
+#define PRINT(x) printf x
+#else
+#define PRINT(x)
+#endif
+
+// macros
+#define set_pixel(x,y,color) (frame_buffer[x + (line_length*y)] = color)
+#define get_pixel(x,y) (frame_buffer[x + (line_length*y)])
+
+class NApplication : public BApplication {
+public:
+	NApplication();
+	bool is_quitting; // So that the WindowScreen knows what
+                     //       to do when disconnected.
+private:
+	bool QuitRequested();
+	void ReadyToRun();
+};
+
+class NWindowScreen : public BWindowScreen {
+public:
+	NWindowScreen(status_t*);
+private:
+	void ScreenConnected(bool);
+	long MyCode();
+	static long Entry(void*);
+	// handy stuff
+	void set_frame_rate(float fps) {frame_pause = (bigtime_t)((1000 * 1000)/fps);}
+	// special for demos
+	enum {
+		// used for star->last_draw
+			INVALID	= 0x7fffffff
+	};
+	typedef struct {
+		float init_velocity;
+		float gravity;
+		double cos_z_theta;
+		int32 y;
+		int32 x;
+		int32 timeval;
+		uint32 last_draw;
+		int32 lx,ly;
+	} particle;
+	uint32 particle_count;
+	particle *particle_list;
+	// simple raster functions
+	void draw_line(int x1, int y1, int x2, int y2, int color);
+	void draw_rect(int x, int y, int w, int h, int color);
+	void fill_rect(int x, int y, int w, int h, int color);
+	void draw_ellipse(int cx, int cy, int wide, int deep, int color);
+	void fill_ellipse(int x, int y, int xradius, int yradius, int color);
+	void ellipse_points(int x, int y, int x_offset, int y_offset, int color);
+	void ellipse_fill_points(int x, int y, int x_offset, int y_offset, int color);
+	thread_id tid;
+	sem_id sem;
+	area_id area;
+	uint8* save_buffer;
+	uint8* frame_buffer;
+	ulong line_length;
+	bigtime_t frame_pause; // time between frames
+	int width,height;
+	int COLORS;
+	bool thread_is_locked;	// small hack to allow to quit the
+							// 	app from ScreenConnected()
+};
+
+main()
+{
+	NApplication app;
+}
+
+NApplication::NApplication()
+      :BApplication("application/x-vnd.Prok-DemoTemplate")
+{
+	Run(); // see you in ReadyToRun()
+}
+
+void NApplication::ReadyToRun()
+{
+	PRINT(("ReadyToRun()\n"));
+	status_t ret = B_ERROR;
+	is_quitting = false;
+	NWindowScreen *ws = new NWindowScreen(&ret);
+	PRINT(("WindowScreen ctor returned. ret = %s\n", strerror(ret)));
+	// exit if constructing the WindowScreen failed.
+	if((ws == NULL) || (ret < B_OK) || !ws->CanControlFrameBuffer())
+	{
+		//printf("the window screen was NULL, or there was an error\n");
+		PostMessage(B_QUIT_REQUESTED);
+	}
+	else
+		PRINT(("everything's just peachy. done with ReadyToRun().\n"));
+}
+
+bool NApplication::QuitRequested()
+{
+	PRINT(("QuitRequested()\n"));
+	status_t ret;
+	is_quitting = true;
+	wait_for_thread(find_thread("rendering thread"), &ret); // wait for the render thread to finish	
+	return true;
+}
+
+NWindowScreen::NWindowScreen(status_t *ret)
+	: BWindowScreen("Example", B_8_BIT_640x480, ret), width(640), height(480), COLORS(256)
+{
+	PRINT(("WindowScreen ctor.\n"));
+	thread_is_locked = true;
+	tid = 0;
+	if(*ret == B_OK)
+	{
+		PRINT(("creating blocking sem and save_buffer area.\n"));
+		// this semaphore controls the access to the WindowScreen
+		sem = create_sem(0,"WindowScreen Access");
+		// this area is used to save the whole framebuffer when
+		//       switching workspaces. (better than malloc()).
+		area = create_area("save", (void**)&save_buffer, B_ANY_ADDRESS, 640*480, B_NO_LOCK, B_READ_AREA|B_WRITE_AREA);
+		// exit if an error occured.
+		if((sem < B_OK) || (area < B_OK))
+		{
+			PRINT(("create_area() or create_sem() failed\n"));
+			*ret = B_ERROR;
+		}
+		else
+		{
+			PRINT(("calling Show().\n"));
+			Show(); // let's go. See you in ScreenConnected.
+		}
+	}
+	else
+	{
+		PRINT(("BWindowScreen base class ctor returned failure\n"));
+		be_app->PostMessage(B_QUIT_REQUESTED);
+	}
+	// set the frame rate
+	set_frame_rate(30.);
+}
+
+void NWindowScreen::ScreenConnected(bool connected)
+{
+	PRINT(("ScreenConnected()\n"));
+	fflush(stdout);
+	if(connected)
+	{
+		if(SetSpace(B_8_BIT_640x480) < B_OK)
+		{
+			SetFrameBuffer(640,480);
+			PRINT(("SetSpace() failed\n"));
+			// properly set the framebuffer. exit if an error occurs.
+			be_app->PostMessage(B_QUIT_REQUESTED);
+			return;
+		}
+		// get the framebuffer-related info, each time the
+		// WindowScreen is connected (multiple monitor)
+		frame_buffer = (uint8*)(CardInfo()->frame_buffer);
+		line_length = FrameBufferInfo()->bytes_per_row;
+		if(tid == 0)
+		{
+			// clean the framebuffer
+			PRINT(("zeroing the framebuffer\n"));
+			memset(frame_buffer,0,480*line_length);
+			// spawn the rendering thread. exit if an error occurs.
+			PRINT(("spawning the render thread.\n"));
+			if(resume_thread((tid = spawn_thread(Entry,"rendering thread", B_URGENT_DISPLAY_PRIORITY,this))) < B_OK)
+			{
+				be_app->PostMessage(B_QUIT_REQUESTED);
+				return;
+			}
+		}
+		else
+		{
+			for(int y=0;y<480;y++)
+			{
+				// restore the framebuffer when switching back from
+				// another workspace.
+            	memcpy(frame_buffer+y*line_length,save_buffer+640*y,640);
+            }
+		}
+		// set our color list.
+		rgb_color palette[256];
+		rgb_color c1;
+		for(int i=0,j=0;i<256;i++,j++)
+		{
+			if(i<64)
+			{
+				c1.red = j*4; // greys
+				c1.green = j*4;
+				c1.blue = j*4;
+				c1.alpha = 255;
+			}
+			if((i>=64) && (i<128))
+			{
+				c1.red = j*4; // reds
+				c1.green = 0;
+				c1.blue = 0;
+				c1.alpha = 255;
+			}
+			if((i>=128) && (i<192))
+			{
+				c1.red = 0; // greens
+				c1.green = j*4;
+				c1.blue = 0;
+				c1.alpha = 255;
+			}
+			if((i>=192) && (i<256))
+			{
+				c1.red = 0; // blues
+				c1.green = 0;
+				c1.blue = j*4;
+				c1.alpha = 255;
+			}
+			if(j == 64)
+				j=0;
+			palette[i]=c1;
+		}
+		SetColorList(palette);
+		
+		// allow the rendering thread to run.
+		thread_is_locked = false;
+		release_sem(sem);
+	}
+	else /* !connected */
+	{
+		// block the rendering thread.
+		if(!thread_is_locked)
+		{
+			acquire_sem(sem);
+			thread_is_locked = true;
+		}
+		// kill the rendering and clean up when quitting
+		if((((NApplication*)be_app)->is_quitting))
+		{
+			status_t ret;
+			kill_thread(tid);
+			wait_for_thread(tid,&ret);
+			delete_sem(sem);
+			delete_area(area);
+			free(particle_list);
+		}
+		else
+		{
+			// set the color list black so that the screen doesn't seem
+			// to freeze while saving the framebuffer
+			rgb_color c={0,0,0,255};
+			rgb_color palette[256];
+			// build the palette
+			for(int i=0;i<256;i++)
+				palette[i] = c;
+			// set the palette
+			SetColorList(palette);
+			// save the framebuffer
+			for(int y=0;y<480;y++)
+				memcpy(save_buffer+640*y,frame_buffer+y*line_length,640);
+		}
+	}
+}
+
+long NWindowScreen::Entry(void* p) {
+   return ((NWindowScreen*)p)->MyCode();
+}
+
+long NWindowScreen::MyCode()
+{
+	bigtime_t trgt = system_time() + frame_pause;
+	srandom(system_time());
+	// beforehand stuff
+	particle_count = 1024*2;
+	particle_list = (particle *)malloc(sizeof(particle)*particle_count);
+	for (uint32 i=0; i>1)+(random()%(rand_max>>1)))/rand_max)*3.333; // magic number
+		particle_list[i].gravity = -(((double)((rand_max>>1)+(random()%(rand_max>>1)))/rand_max))*0.599; // more magic
+		
+		// make the particle initialy invisible and fixed, but at a random moment in time
+		particle_list[i].lx = 0;
+		particle_list[i].ly = 0;
+		particle_list[i].last_draw = INVALID;
+		particle_list[i].timeval = random() & 64;
+		particle_list[i].x = 0; // this gets figured out at drawtime
+		particle_list[i].y = 0; // same here
+		particle_list[i].cos_z_theta = cos(random() % 360); // grab an angle
+	}
+	
+	
+	// the loop o' fun
+	while(!(((NApplication*)be_app)->is_quitting))
+	{
+		// try to sync with the vertical retrace
+		if(BScreen(this).WaitForRetrace() != B_OK)
+		{
+			// snoze for a bit so that other threads can be happy. 
+			// We are realtime priority you know
+			if(system_time() < trgt)
+				snooze(trgt - system_time());
+			trgt = system_time() + frame_pause;
+		}
+		
+		// gain access to the framebuffer before writing to it.
+		acquire_sem(sem); // block until we're allowed to own the framebuffer
+		
+		///////////////////////////////
+		// do neat stuff here //
+		//////////////////////////////
+		PRINT(("rendering a frame.\n"));
+	
+		
+		// eye candy VII - particles! - my own cookin
+		particle *s;
+		int32 x, y, cx,cy;
+		set_frame_rate(60.); // woo. ntsc
+		// calculate the center
+		cx = width/2;
+		cy = height/2;
+		
+		// palette test
+		//set_frame_rate(0.1);
+		//for(int i=0;i<256;i++)
+		//	draw_line(i,0,i,height, i);
+		
+		PRINT(("Starting particle drawing loop\n"));
+		s = particle_list;
+		for (uint32 i=0; ilx = s->x;
+			s->ly = s->y;
+			
+			PRINT(("cx=%d, cy=%d\n", cx,cy));
+							
+			// move the particle			
+			// find y and x
+			// (s->gravity/2)*(s->timeval*s->timeval) * 1.85 is magic
+			y = s->y = (int32)(cy + (int32)((s->gravity/2)*(s->timeval*s->timeval)*1.94) + ((s->init_velocity - (s->gravity*s->timeval)) * s->timeval));
+			x = s->x = (int32)(cx + (int32)(s->timeval * s->cos_z_theta)); // 3d rotation
+		
+			// interate timeval
+			s->timeval++;
+		
+			// sanity check
+			if(x <= 0)
+				goto erase_and_reset;
+			if(x > width)
+				goto erase_and_reset;
+			if(y < 0)
+				goto erase; // invisible + erase last position
+			if(y > height)
+				goto erase_and_reset;
+					
+			// erase the previous position, if necessary
+			if (s->last_draw != INVALID)
+				set_pixel(s->lx,s->ly,0);
+			
+			// if it's visible, then draw it.
+			set_pixel(s->x,s->y, 169);
+			s->last_draw = 1;
+			goto loop;
+			
+			erase_and_reset:
+			if((s->lx <= width) && (s->lx >= 0) && (s->ly <= height) && (s->ly >= 0))
+				set_pixel(s->lx, s->ly,0);
+			s->x = 0;
+			s->y = 0;
+			s->lx = 0;
+			s->ly = 0;
+			s->timeval = 0;
+			s->last_draw = INVALID;
+			goto loop;
+			
+			erase:
+			// erase it.
+			if(s->last_draw != INVALID)
+				set_pixel(s->lx, s->ly,0);
+			s->lx = s->x;
+			s->ly = s->y;
+			s->last_draw = INVALID;
+			loop:
+				s++;
+			//printf("end draw loop\n");
+		}
+		PRINT(("frame done\n"));
+		
+		//////////////////////////////////
+		// stop doing neat stuff //
+		/////////////////////////////////
+		
+		// release the semaphore while waiting. gotta release it
+		// at some point or nasty things will happen!
+		release_sem(sem);
+		// loop for another frame!
+	}
+	return B_OK;
+}
+
+//////////////////////////////
+// Misc - a place for demos to put their convenience functions
+//////////////////////////////
+
+
+//////////////////////////////
+// My Silly Raster Lib 
+//////////////////////////////
+
+/*
+
+	Functions:
+void draw_line(int x1, int y1, int x2, int y2, int color);
+void draw_rect(int x, int y, int w, int h, int color);
+void fill_rect(int x, int y, int w, int h, int color);
+void draw_ellipse(int x, int y, int xradius, int yradius, int color);
+void fill_ellipse(int x, int y, int xradius, int yradius, int color);
+
+*/
+
+void NWindowScreen::draw_line(int x1, int y1, int x2, int y2, int color)
+{
+	// Simple Bresenham's line drawing algorithm
+	int d,x,y,ax,ay,sx,sy,dx,dy;
+	
+#define ABS(x) (((x)<0) ? -(x) : (x))
+#define SGN(x) (((x)<0) ? -1 : 1)
+
+	dx=x2-x1; ax=ABS(dx)<<1; sx=SGN(dx);
+	dy=y2-y1; ay=ABS(dy)<<1; sy=SGN(dy);
+	
+	x=x1;
+	y=y1;
+	if(ax>ay)
+	{
+		d=ay-(ax>>1);
+		for(;;)
+		{
+			set_pixel(x,y,color);
+			if(x==x2) return;
+			if(d>=0)
+			{
+				y+=sy;
+				d-=ax;
+			}
+			x+=sx;
+			d+=ay;
+		}
+	}
+	else
+	{
+		d=ax-(ay>>1);
+		for(;;)
+		{
+			set_pixel(x,y,color);
+			if(y==y2) return;
+			if(d>=0)
+			{
+				x+=sx;
+				d-=ay;
+			}
+			y+=sy;
+			d+=ax;
+		}
+	}
+}
+
+void NWindowScreen::draw_rect(int x, int y, int w, int h, int color)
+{
+	draw_line(x,y,x+w,y,color);
+	draw_line(x,y,x,y+h,color);
+	draw_line(x,y+h,x+w,y+h,color);
+	draw_line(x+w,y,x+w,y+h,color);
+}
+
+void NWindowScreen::fill_rect(int x, int y, int w, int h, int color)
+{
+	for(int i=0;i (deep_squared*(x + 1)))
+	{
+		if(d < 0)
+			d += deep_squared*(2*x + 3);
+		else
+		{
+			d += deep_squared*(2*x + 3) + wide_squared*(-2*y + 2);
+			y--;
+		}
+		x++;
+		ellipse_points(x, y, cx, cy, color);
+	}
+	
+	d = deep_squared*((x+0.5)*(x+0.5)) + wide_squared*((y-1)*(y-1)) - deep_squared*wide_squared;
+	while(y > 0)
+	{
+		if(d < 0)
+		{
+			d += deep_squared*(2*x + 2) + wide_squared*(-2*y + 3);
+			x++;
+		}
+		else
+			d += wide_squared*(-2*y + 3);
+		y--;
+		ellipse_points(x, y, cx, cy, color);
+	}
+}
+
+void NWindowScreen::fill_ellipse(int cx, int cy, int wide, int deep, int color)
+{
+	// if we're asked to draw a really small ellipse, put a single pixel in the buffer
+	// and bail
+	if((wide < 1) || (deep < 1))
+	{
+		set_pixel(cx,cy,color);
+		return;
+	}
+	
+	// MidPoint Ellipse algorithm. 
+	// page 90 of Computer Graphics Principles and Practice 2nd edition (I highly recommend this book)
+	int16 x, y;
+	int16 wide_squared, deep_squared;
+	double d;
+
+	x = 0;	
+	y = deep;
+	wide_squared = wide * wide;
+	deep_squared = deep * deep;
+	d = deep_squared - (wide_squared*deep) + (wide_squared/4);
+	
+	ellipse_fill_points(x, y, cx, cy, color);
+	while((wide_squared*(y - 0.5)) > (deep_squared*(x + 1)))
+	{
+		if(d < 0)
+			d += deep_squared*(2*x + 3);
+		else
+		{
+			d += deep_squared*(2*x + 3) + wide_squared*(-2*y + 2);
+			y--;
+		}
+		x++;
+		ellipse_fill_points(x, y, cx, cy, color);
+	}
+	
+	d = deep_squared*((x+0.5)*(x+0.5)) + wide_squared*((y-1)*(y-1)) - deep_squared*wide_squared;
+	while(y > 0)
+	{
+		if(d < 0)
+		{
+			d += deep_squared*(2*x + 2) + wide_squared*(-2*y + 3);
+			x++;
+		}
+		else
+			d += wide_squared*(-2*y + 3);
+		y--;
+		ellipse_fill_points(x, y, cx, cy, color);
+	}
+}
+
+void NWindowScreen::ellipse_points(int x, int y, int x_offset, int y_offset, int color)
+{
+	// fill four pixels for every iteration in draw_ellipse
+	
+	// the x_offset and y_offset values are needed since the midpoint ellipse algorithm 
+	// assumes the midpoint to be at the origin
+	// do a sanity check before each set_pixel, that way we clip to the edges
+	
+	int xCoord, yCoord;
+
+	xCoord = x_offset + x;
+	yCoord = y_offset + y;
+	if((xCoord > 0) && (yCoord > 0) && (xCoord < width) && (yCoord < height))
+		set_pixel(xCoord,yCoord,color);
+	xCoord = x_offset - x;
+	if((xCoord > 0) && (yCoord > 0) && (xCoord < width) && (yCoord < height))
+		set_pixel(xCoord,yCoord,color);
+	xCoord = x_offset + x;
+	yCoord = y_offset - y;
+	if((xCoord > 0) && (yCoord > 0) && (xCoord < width) && (yCoord < height))
+		set_pixel(xCoord,yCoord,color);
+	xCoord = x_offset - x;
+	if((xCoord > 0) && (yCoord > 0) && (xCoord < width) && (yCoord < height))
+		set_pixel(xCoord,yCoord,color);
+}
+
+void NWindowScreen::ellipse_fill_points(int x, int y, int x_offset, int y_offset, int color)
+{
+	// put lines between two pixels twice. once for y positive, the other for y negative (symmetry)
+	// for every iteration in fill_ellipse
+	
+	// the x_offset and y_offset values are needed since the midpoint ellipse algorithm 
+	// assumes the midpoint to be at the origin
+	// do a sanity check before each set_pixel, that way we clip to the edges
+	
+	int xCoord1, yCoord1;
+	int xCoord2, yCoord2;
+
+	xCoord1 = x_offset - x;
+	yCoord1 = y_offset + y;
+	xCoord2 = x_offset + x;
+	yCoord2 = y_offset + y;
+	if((xCoord1 > 0) && (yCoord1 > 0) && (xCoord1 < width) && (yCoord1 < height))	
+		if((xCoord2 > 0) && (yCoord2 > 0) && (xCoord2 < width) && (yCoord2 < height))
+			draw_line(xCoord1,yCoord1,xCoord2,yCoord2,color);
+	
+	xCoord1 = x_offset - x;
+	yCoord1 = y_offset - y;
+	xCoord2 = x_offset + x;
+	yCoord2 = y_offset - y;
+	if((xCoord1 > 0) && (yCoord1 > 0) && (xCoord1 < width) && (yCoord1 < height))	
+		if((xCoord2 > 0) && (yCoord2 > 0) && (xCoord2 < width) && (yCoord2 < height))
+			draw_line(xCoord1,yCoord1,xCoord2,yCoord2,color);
+
+}



From marcusoverhagen at arcor.de  Thu Jun 14 17:16:58 2007
From: marcusoverhagen at arcor.de (Marcus Overhagen)
Date: Thu, 14 Jun 2007 17:16:58 +0200 (CEST)
Subject: [Haiku-commits] r21410 - in
	haiku/trunk:	headers/private/graphics/vmware
	src/add-ons/accelerants/vmware	src/add-ons/kernel/drivers/graphics/vmware
In-Reply-To: <200706141441.l5EEfjh4007063@sheep.berlios.de>
References: <200706141441.l5EEfjh4007063@sheep.berlios.de>
Message-ID: <12735399.1181834218216.JavaMail.ngmail@webmail17>

jackburton wrote:

>  SET_INDEXED_COLORS(uint count, uint8 first, uint8 *color_data, uint32
> flags)
>  {
Please check for invalid parameters that would cause memory corruption:
	if (count > 256 || (count + first) > 256)
		return B_BAD_VALUE;


> +		case VMWARE_SET_PALETTE:
> +		{
> +			uint8 *color = (uint8 *)buf;

you should use user_memcpy() here (and all other places that copy from user pointers)

regards
Marcus



Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren
ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: g?nstig
und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer,
nur  39,85 ?  inkl. DSL- und ISDN-Grundgeb?hr!
http://www.arcor.de/rd/emf-dsl-2


From marcusoverhagen at arcor.de  Thu Jun 14 17:27:00 2007
From: marcusoverhagen at arcor.de (Marcus Overhagen)
Date: Thu, 14 Jun 2007 17:27:00 +0200 (CEST)
Subject: [Haiku-commits] r21411 - in haiku/trunk/src/tests/kits/game:
	.	ParticlesII
In-Reply-To: <200706141443.l5EEhkgR007779@sheep.berlios.de>
References: <200706141443.l5EEhkgR007779@sheep.berlios.de>
Message-ID: <7424868.1181834820720.JavaMail.ngmail@webmail17>

jackburton at BerliOS wrote:

> +		particle_list[i].timeval = random() & 64;
This gives you just a single bit. Is this wanted?

> +	if((xCoord > 0) && (yCoord > 0) && (xCoord < width) && (yCoord < height))
> +		set_pixel(xCoord,yCoord,color);
Checks like this one can possibly be speed up by casting the variables to unsigned:

	if (unsigned(xCoord) < width && unsigned(yCoord) < height)

Finally, please look into the http://haiku-os.org/documents/dev/haiku_coding_guidelines

have fun

Marcus





Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren
ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: g?nstig
und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer,
nur  39,85 ?  inkl. DSL- und ISDN-Grundgeb?hr!
http://www.arcor.de/rd/emf-dsl-2


From korli at users.berlios.de  Thu Jun 14 17:30:23 2007
From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=)
Date: Thu, 14 Jun 2007 17:30:23 +0200
Subject: [Haiku-commits] r21410 - in haiku/trunk:
	headers/private/graphics/vmware src/add-ons/accelerants/vmware
	src/add-ons/kernel/drivers/graphics/vmware
In-Reply-To: <200706141441.l5EEfjh4007063@sheep.berlios.de>
References: <200706141441.l5EEfjh4007063@sheep.berlios.de>
Message-ID: 

Hello Stefano,

2007/6/14, jackburton at BerliOS :
>
> +
> +       fd = open(path, B_READ_WRITE);
> +       if (fd < 0)
> +               return fd;
> +


It should return errno after a open().

Bye,
J?r?me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From axeld at mail.berlios.de  Thu Jun 14 18:54:08 2007
From: axeld at mail.berlios.de (axeld at BerliOS)
Date: Thu, 14 Jun 2007 18:54:08 +0200
Subject: [Haiku-commits] r21412 -
	haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared
Message-ID: <200706141654.l5EGs8pN025952@sheep.berlios.de>

Author: axeld
Date: 2007-06-14 18:54:04 +0200 (Thu, 14 Jun 2007)
New Revision: 21412
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21412&view=rev

Modified:
   haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/NetAddress.cpp
Log:
NetAddress::IsLocal() did not work under BONE - we now work around this by using
the route table to determine if an address is local or not (BONE incorrectly allows
you to bind against non-existing and non-local interfaces).


Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/NetAddress.cpp
===================================================================
--- haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/NetAddress.cpp	2007-06-14 14:43:45 UTC (rev 21411)
+++ haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/NetAddress.cpp	2007-06-14 16:54:04 UTC (rev 21412)
@@ -5,6 +5,12 @@
 #include 
 #include 
 
+#if defined(HAIKU_TARGET_PLATFORM_DANO) || defined(HAIKU_TARGET_PLATFORM_DANO)
+#	include 
+#	include 
+#	include 
+#endif
+
 #include "AutoLocker.h"
 #include "Compatibility.h"
 #include "Locker.h"
@@ -87,11 +93,42 @@
 	int fd = socket(AF_INET, SOCK_STREAM, 0);
 	if (fd < 0)
 		return false;
+#if defined(HAIKU_TARGET_PLATFORM_DANO) || defined(HAIKU_TARGET_PLATFORM_DANO)
+	// BONE does allow you to bind to any address!
+	// Therefore, we iterate over all routes, and see if there are any local
+	// ones for this address.
+
+	bool result = false;
+	uint32 count;
+	if (ioctl(fd, SIOCGRTSIZE, &count) == 0) {
+		route_req_t* routes = (route_req_t*)malloc(count * sizeof(route_req_t));
+		if (routes != NULL) {
+			route_table_req table;
+			table.rrtp = routes;
+			table.len = count * sizeof(route_req_t);
+			table.cnt = count;
+			if (ioctl(fd, SIOCGRTTABLE, &table) == 0) {
+				for (uint32 i = 0; i < table.cnt; i++) {
+					if ((routes[i].flags & RTF_LOCAL) == 0)
+						continue;
+					if (((sockaddr_in*)&routes[i].dst)->sin_addr.s_addr
+							== fAddress.sin_addr.s_addr) {
+						result = true;
+						break;
+					}
+				}
+			}
+			free(routes);
+		}
+	}
+#else
 	// bind it to a port
 	sockaddr_in addr = fAddress;
 	addr.sin_port = 0;
 	bool result = (bind(fd, (sockaddr*)&addr, sizeof(addr)) == 0);
+#endif
 	closesocket(fd);
+
 	return result;
 }
 



From axeld at mail.berlios.de  Thu Jun 14 19:15:10 2007
From: axeld at mail.berlios.de (axeld at BerliOS)
Date: Thu, 14 Jun 2007 19:15:10 +0200
Subject: [Haiku-commits] r21413 -
	haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared
Message-ID: <200706141715.l5EHFA13018963@sheep.berlios.de>

Author: axeld
Date: 2007-06-14 19:15:09 +0200 (Thu, 14 Jun 2007)
New Revision: 21413
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21413&view=rev

Modified:
   haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/NetAddress.cpp
Log:
Apparently, BONE's management ioctl's only work on datagram sockets...
This should be retested on R5 to make sure it'll still work there.


Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/NetAddress.cpp
===================================================================
--- haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/NetAddress.cpp	2007-06-14 16:54:04 UTC (rev 21412)
+++ haiku/trunk/src/tests/add-ons/kernel/file_systems/userlandfs/r5/src/test/netfs/shared/NetAddress.cpp	2007-06-14 17:15:09 UTC (rev 21413)
@@ -90,7 +90,7 @@
 		return false;
 	}
 	// create a socket and try to bind it to a port of this address
-	int fd = socket(AF_INET, SOCK_STREAM, 0);
+	int fd = socket(AF_INET, SOCK_DGRAM, 0);
 	if (fd < 0)
 		return false;
 #if defined(HAIKU_TARGET_PLATFORM_DANO) || defined(HAIKU_TARGET_PLATFORM_DANO)



From leavengood at mail.berlios.de  Fri Jun 15 03:17:13 2007
From: leavengood at mail.berlios.de (leavengood at BerliOS)
Date: Fri, 15 Jun 2007 03:17:13 +0200
Subject: [Haiku-commits] r21414 - haiku/trunk/src/shared
Message-ID: <200706150117.l5F1HD7m001858@sheep.berlios.de>

Author: leavengood
Date: 2007-06-15 03:17:12 +0200 (Fri, 15 Jun 2007)
New Revision: 21414
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21414&view=rev

Modified:
   haiku/trunk/src/shared/Jamfile
Log:
Small change to make the shared library buildable for BeOS.


Modified: haiku/trunk/src/shared/Jamfile
===================================================================
--- haiku/trunk/src/shared/Jamfile	2007-06-14 17:15:09 UTC (rev 21413)
+++ haiku/trunk/src/shared/Jamfile	2007-06-15 01:17:12 UTC (rev 21414)
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src shared ;
 
+SetSubDirSupportedPlatformsBeOSCompatible ;
+
 UsePrivateHeaders shared ;
 
 StaticLibrary libshared.a :



From phoudoin at mail.berlios.de  Fri Jun 15 08:32:49 2007
From: phoudoin at mail.berlios.de (phoudoin at BerliOS)
Date: Fri, 15 Jun 2007 08:32:49 +0200
Subject: [Haiku-commits] r21415 - haiku/trunk/build/jam
Message-ID: <200706150632.l5F6WnFV001269@sheep.berlios.de>

Author: phoudoin
Date: 2007-06-15 08:32:48 +0200 (Fri, 15 Jun 2007)
New Revision: 21415
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21415&view=rev

Modified:
   haiku/trunk/build/jam/HaikuImage
Log:
Add libglut.so -> libGL.so symlink to haiku image build.


Modified: haiku/trunk/build/jam/HaikuImage
===================================================================
--- haiku/trunk/build/jam/HaikuImage	2007-06-15 01:17:12 UTC (rev 21414)
+++ haiku/trunk/build/jam/HaikuImage	2007-06-15 06:32:48 UTC (rev 21415)
@@ -171,6 +171,8 @@
 AddSymlinkToHaikuImage beos system lib : libnetwork.so : libnet.so ;
 AddSymlinkToHaikuImage beos system lib : libnetwork.so : libnetapi.so ;
 AddSymlinkToHaikuImage beos system lib : libnetwork.so : libbnetapi.so ;
+# libGL.so have GLUT built-in
+AddSymlinkToHaikuImage beos system lib : $(X86_ONLY)libGL.so : libglut.so ;
 
 # servers
 AddFilesToHaikuImage beos system servers : $(BEOS_SYSTEM_SERVERS) ;



From stefano.ceccherini at gmail.com  Fri Jun 15 11:00:55 2007
From: stefano.ceccherini at gmail.com (Stefano Ceccherini)
Date: Fri, 15 Jun 2007 11:00:55 +0200
Subject: [Haiku-commits] r21410 - in haiku/trunk:
	headers/private/graphics/vmware src/add-ons/accelerants/vmware
	src/add-ons/kernel/drivers/graphics/vmware
In-Reply-To: 
References: <200706141441.l5EEfjh4007063@sheep.berlios.de>
	
Message-ID: <894b9700706150200g76176b51u4794c46c4275ad51@mail.gmail.com>

2007/6/14, J?r?me Duval :

Hi J?r?me,

> It should return errno after a open().

That's right.
TBH I copypasted the code from Axel's intel_extreme accelerant without
checking. I promise I'll never trust his code again :)


From bonefish at mail.berlios.de  Fri Jun 15 20:13:40 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Fri, 15 Jun 2007 20:13:40 +0200
Subject: [Haiku-commits] r21416 - haiku/trunk/src/tools/rc
Message-ID: <200706151813.l5FIDe8t026033@sheep.berlios.de>

Author: bonefish
Date: 2007-06-15 20:13:39 +0200 (Fri, 15 Jun 2007)
New Revision: 21416
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21416&view=rev

Modified:
   haiku/trunk/src/tools/rc/Jamfile
Log:
Mostly aesthetical change.


Modified: haiku/trunk/src/tools/rc/Jamfile
===================================================================
--- haiku/trunk/src/tools/rc/Jamfile	2007-06-15 06:32:48 UTC (rev 21415)
+++ haiku/trunk/src/tools/rc/Jamfile	2007-06-15 18:13:39 UTC (rev 21416)
@@ -13,20 +13,21 @@
 BuildPlatformStaticLibrary librdef.a :
 	compile.cpp decompile.cpp lexer.l parser.y rdef.cpp ;
 
-# these platforms do not need a second copy of the strl routines
-if $(HOST_PLATFORM) != darwin && $(HOST_PLATFORM) != linux && $(HOST_PLATFORM) != freebsd {
-STRLSRC = strlcpy.c strlcat.c ;
+# On BeOS incompatible platforms we implicitly link against libroot_build.so,
+# which does already include the strl*() routines.
+local strlSources ;
+if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
+	strlSources = strlcpy.c strlcat.c ;
 }
 
 BuildPlatformMain rc :
 	rc.cpp
 
 	# these two are needed for R5 only
-	$(STRLSRC)
+	$(strlSources)
 ;
 LinkAgainst rc
 	: librdef.a $(HOST_LIBSTDC++) $(HOST_LIBBE) $(HOST_LIBSUPC++) ;
 
-SEARCH on [ FGristFiles
-		strlcat.c strlcpy.c
-	] = [ FDirName $(HAIKU_TOP) src system libroot posix string ] ;
+SEARCH on [ FGristFiles $(strlSources) ]
+	= [ FDirName $(HAIKU_TOP) src system libroot posix string ] ;



From bonefish at mail.berlios.de  Fri Jun 15 20:17:18 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Fri, 15 Jun 2007 20:17:18 +0200
Subject: [Haiku-commits] r21417 - haiku/trunk/src/build/libroot
Message-ID: <200706151817.l5FIHIeT026308@sheep.berlios.de>

Author: bonefish
Date: 2007-06-15 20:17:18 +0200 (Fri, 15 Jun 2007)
New Revision: 21417
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21417&view=rev

Modified:
   haiku/trunk/src/build/libroot/Jamfile
Log:
Aesthetical change.


Modified: haiku/trunk/src/build/libroot/Jamfile
===================================================================
--- haiku/trunk/src/build/libroot/Jamfile	2007-06-15 18:13:39 UTC (rev 21416)
+++ haiku/trunk/src/build/libroot/Jamfile	2007-06-15 18:17:18 UTC (rev 21417)
@@ -22,8 +22,9 @@
 MakeLocate libroot_build.so : $(HOST_BUILD_COMPATIBILITY_LIB_DIR) ;
 
 # darwin already has strlcpy and strlcat in libSystem
+local strlSources ;
 if $(HOST_PLATFORM) != darwin {
-STRLSRC = strlcpy.c strlcat.c ;
+	strlSources = strlcpy.c strlcat.c ;
 }
 
 BuildPlatformSharedLibrary libroot_build.so :
@@ -37,12 +38,12 @@
 	sem.cpp
 	thread.cpp
 
-	$(STRLSRC)
+	$(strlSources)
 	strnlen.c
 
 	:
 	$(HOST_LIBSTDC++)
 ;
 
-SEARCH on [ FGristFiles strlcat.c strlcpy.c strnlen.c ]
+SEARCH on [ FGristFiles $(strlSources) strnlen.c ]
 	= [ FDirName $(HAIKU_TOP) src system libroot posix string ] ;



From bonefish at mail.berlios.de  Fri Jun 15 20:23:28 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Fri, 15 Jun 2007 20:23:28 +0200
Subject: [Haiku-commits] r21418 - haiku/trunk/src/tools/fs_shell
Message-ID: <200706151823.l5FINS3d026854@sheep.berlios.de>

Author: bonefish
Date: 2007-06-15 20:23:28 +0200 (Fri, 15 Jun 2007)
New Revision: 21418
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21418&view=rev

Modified:
   haiku/trunk/src/tools/fs_shell/driver_settings.cpp
Log:
Just go with the portable code.


Modified: haiku/trunk/src/tools/fs_shell/driver_settings.cpp
===================================================================
--- haiku/trunk/src/tools/fs_shell/driver_settings.cpp	2007-06-15 18:17:18 UTC (rev 21417)
+++ haiku/trunk/src/tools/fs_shell/driver_settings.cpp	2007-06-15 18:23:28 UTC (rev 21418)
@@ -869,18 +869,9 @@
 	return &((settings_handle *)handle)->settings;
 }
 
-#ifndef HAIKU_HOST_PLATFORM_DARWIN
-// this creates an alias of the above function
-// unload_driver_settings() is the same as delete_driver_settings()
-extern "C" __typeof(fssh_unload_driver_settings) fssh_delete_driver_settings
-	__attribute__ ((alias ("fssh_unload_driver_settings")));
-#else
-// can't use weak aliases on darwin apparently
+
 fssh_status_t
 fssh_delete_driver_settings(void *handle)
 {
 	return fssh_unload_driver_settings(handle);
 }
-#endif
-
-



From bonefish at mail.berlios.de  Fri Jun 15 20:32:51 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Fri, 15 Jun 2007 20:32:51 +0200
Subject: [Haiku-commits] r21419 - in haiku/trunk/src: . kits kits/shared
Message-ID: <200706151832.l5FIWp6Y027505@sheep.berlios.de>

Author: bonefish
Date: 2007-06-15 20:32:50 +0200 (Fri, 15 Jun 2007)
New Revision: 21419
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21419&view=rev

Added:
   haiku/trunk/src/kits/shared/
Removed:
   haiku/trunk/src/shared/
Modified:
   haiku/trunk/src/Jamfile
   haiku/trunk/src/kits/Jamfile
   haiku/trunk/src/kits/shared/Jamfile
Log:
libshared.a doesn't deserve a src/ subdirectory. Moved to
src/kits/shared.


Modified: haiku/trunk/src/Jamfile
===================================================================
--- haiku/trunk/src/Jamfile	2007-06-15 18:23:28 UTC (rev 21418)
+++ haiku/trunk/src/Jamfile	2007-06-15 18:32:50 UTC (rev 21419)
@@ -10,7 +10,6 @@
 SubInclude HAIKU_TOP src libs ;
 SubInclude HAIKU_TOP src preferences ;
 SubInclude HAIKU_TOP src servers ;
-SubInclude HAIKU_TOP src shared ;
 SubInclude HAIKU_TOP src system ;
 SubInclude HAIKU_TOP src tests ;
 SubInclude HAIKU_TOP src tools ;

Modified: haiku/trunk/src/kits/Jamfile
===================================================================
--- haiku/trunk/src/kits/Jamfile	2007-06-15 18:23:28 UTC (rev 21418)
+++ haiku/trunk/src/kits/Jamfile	2007-06-15 18:32:50 UTC (rev 21419)
@@ -97,6 +97,7 @@
 SubInclude HAIKU_TOP src kits network ;
 SubInclude HAIKU_TOP src kits opengl ;
 SubInclude HAIKU_TOP src kits screensaver ;
+SubInclude HAIKU_TOP src kits shared ;
 SubInclude HAIKU_TOP src kits storage ;
 SubInclude HAIKU_TOP src kits support ;
 SubInclude HAIKU_TOP src kits textencoding ;

Copied: haiku/trunk/src/kits/shared (from rev 21418, haiku/trunk/src/shared)

Modified: haiku/trunk/src/kits/shared/Jamfile
===================================================================
--- haiku/trunk/src/shared/Jamfile	2007-06-15 18:23:28 UTC (rev 21418)
+++ haiku/trunk/src/kits/shared/Jamfile	2007-06-15 18:32:50 UTC (rev 21419)
@@ -1,4 +1,4 @@
-SubDir HAIKU_TOP src shared ;
+SubDir HAIKU_TOP src kits shared ;
 
 SetSubDirSupportedPlatformsBeOSCompatible ;
 



From kirilla at mail.berlios.de  Fri Jun 15 22:28:07 2007
From: kirilla at mail.berlios.de (kirilla at BerliOS)
Date: Fri, 15 Jun 2007 22:28:07 +0200
Subject: [Haiku-commits] r21420 -
	haiku/trunk/src/preferences/datatranslations
Message-ID: <200706152028.l5FKS7LR002662@sheep.berlios.de>

Author: kirilla
Date: 2007-06-15 22:28:07 +0200 (Fri, 15 Jun 2007)
New Revision: 21420
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21420&view=rev

Modified:
   haiku/trunk/src/preferences/datatranslations/IconView.cpp
Log:
Draw icon with transparency.

Modified: haiku/trunk/src/preferences/datatranslations/IconView.cpp
===================================================================
--- haiku/trunk/src/preferences/datatranslations/IconView.cpp	2007-06-15 18:32:50 UTC (rev 21419)
+++ haiku/trunk/src/preferences/datatranslations/IconView.cpp	2007-06-15 20:28:07 UTC (rev 21420)
@@ -25,7 +25,11 @@
 		
 	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
 
+#if __HAIKU__
+	fIconBitmap = new BBitmap(BRect(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1), B_RGBA32);
+#else
 	fIconBitmap = new BBitmap(BRect(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1), B_CMAP8);
+#endif
 }
 
 IconView::~IconView()
@@ -65,7 +69,15 @@
 void
 IconView::Draw(BRect area)
 {
+#if __HAIKU__
+	SetDrawingMode(B_OP_ALPHA);
+	SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
+#else
+	SetDrawingMode(B_OP_OVER);
+#endif
 	if (fDrawIcon)
 		DrawBitmap(fIconBitmap);
+
+	SetDrawingMode(B_OP_COPY);
 }
 



From korli at mail.berlios.de  Fri Jun 15 23:02:12 2007
From: korli at mail.berlios.de (korli at BerliOS)
Date: Fri, 15 Jun 2007 23:02:12 +0200
Subject: [Haiku-commits] r21421 - in haiku/trunk:
	headers/private/graphics/s3savage src/add-ons/accelerants/s3savage
	src/add-ons/kernel/drivers/graphics/s3savage
Message-ID: <200706152102.l5FL2C6V005110@sheep.berlios.de>

Author: korli
Date: 2007-06-15 23:02:08 +0200 (Fri, 15 Jun 2007)
New Revision: 21421
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21421&view=rev

Added:
   haiku/trunk/src/add-ons/accelerants/s3savage/AccelerantPrototypes.h
   haiku/trunk/src/add-ons/accelerants/s3savage/GetDeviceInfo.c
   haiku/trunk/src/add-ons/accelerants/s3savage/savage.h
   haiku/trunk/src/add-ons/accelerants/s3savage/savage_accel.c
   haiku/trunk/src/add-ons/accelerants/s3savage/savage_cursor.c
   haiku/trunk/src/add-ons/accelerants/s3savage/savage_dpms.c
   haiku/trunk/src/add-ons/accelerants/s3savage/savage_driver.c
Removed:
   haiku/trunk/src/add-ons/accelerants/s3savage/datatype.h
   haiku/trunk/src/add-ons/accelerants/s3savage/generic.h
   haiku/trunk/src/add-ons/accelerants/s3savage/s3accel.c
   haiku/trunk/src/add-ons/accelerants/s3savage/s3accel.h
   haiku/trunk/src/add-ons/accelerants/s3savage/s3drv.c
   haiku/trunk/src/add-ons/accelerants/s3savage/s3drv.h
   haiku/trunk/src/add-ons/accelerants/s3savage/s3mmio.h
   haiku/trunk/src/add-ons/accelerants/s3savage/s3vga.c
Modified:
   haiku/trunk/headers/private/graphics/s3savage/DriverInterface.h
   haiku/trunk/src/add-ons/accelerants/s3savage/Acceleration.c
   haiku/trunk/src/add-ons/accelerants/s3savage/Cursor.c
   haiku/trunk/src/add-ons/accelerants/s3savage/EngineManagement.c
   haiku/trunk/src/add-ons/accelerants/s3savage/GetAccelerantHook.c
   haiku/trunk/src/add-ons/accelerants/s3savage/GetModeInfo.c
   haiku/trunk/src/add-ons/accelerants/s3savage/GlobalData.c
   haiku/trunk/src/add-ons/accelerants/s3savage/GlobalData.h
   haiku/trunk/src/add-ons/accelerants/s3savage/InitAccelerant.c
   haiku/trunk/src/add-ons/accelerants/s3savage/Jamfile
   haiku/trunk/src/add-ons/accelerants/s3savage/ProposeDisplayMode.c
   haiku/trunk/src/add-ons/accelerants/s3savage/SetDisplayMode.c
   haiku/trunk/src/add-ons/kernel/drivers/graphics/s3savage/driver.c
Log:
incorporated savage driver sources from Gerald Zajac. I hope it's the good place for this.
fixed warnings and code style. Please, from now on, provide *patches* to this version.


Modified: haiku/trunk/headers/private/graphics/s3savage/DriverInterface.h
===================================================================
--- haiku/trunk/headers/private/graphics/s3savage/DriverInterface.h	2007-06-15 20:28:07 UTC (rev 21420)
+++ haiku/trunk/headers/private/graphics/s3savage/DriverInterface.h	2007-06-15 21:02:08 UTC (rev 21421)
@@ -1,194 +1,241 @@
 /*
-    Copyright 1999, Be Incorporated.   All Rights Reserved.
-    This file may be used under the terms of the Be Sample Code License.
+	Copyright 1999, Be Incorporated.   All Rights Reserved.
+	This file may be used under the terms of the Be Sample Code License.
+
+	Other authors:
+	Gerald Zajac 2006-2007
 */
 
 #ifndef DRIVERINTERFACE_H
 #define DRIVERINTERFACE_H
 
 #include 
+#include 
 #include 
 #include 
 #include 
 
 /*
-    This is the info that needs to be shared between the kernel driver and
-    the accelerant for the sample driver.
+	This is the info that needs to be shared between the kernel driver and
+	the accelerant for the sample driver.
 */
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
+
+#define NUM_ELEMENTS(a) ((int)(sizeof(a) / sizeof(a[0]))) 	// for computing number of elements in an array
+
 typedef struct
 {
-    sem_id  sem;
-    int32   ben;
+	sem_id	sem;
+	int32	ben;
 } benaphore;
 
-#define INIT_BEN(x)     x.sem = create_sem(0, "SAVAGE "#x" benaphore");  x.ben = 0;
-#define AQUIRE_BEN(x)   if((atomic_add(&(x.ben), 1)) >= 1) acquire_sem(x.sem);
-#define RELEASE_BEN(x)  if((atomic_add(&(x.ben), -1)) > 1) release_sem(x.sem);
-#define DELETE_BEN(x)   delete_sem(x.sem);
+#define INIT_BEN(x) 	x.sem = create_sem(0, "SAVAGE "#x" benaphore");  x.ben = 0;
+#define AQUIRE_BEN(x)	if((atomic_add(&(x.ben), 1)) >= 1) acquire_sem(x.sem);
+#define RELEASE_BEN(x)	if((atomic_add(&(x.ben), -1)) > 1) release_sem(x.sem);
+#define DELETE_BEN(x)	delete_sem(x.sem);
 
 
-#define SAVAGE_PRIVATE_DATA_MAGIC    0x1234 /* a private driver rev, of sorts */
+#define SAVAGE_PRIVATE_DATA_MAGIC	 0x5791 // a private driver rev, of sorts
 
-#define MAX_SAVAGE_DEVICE_NAME_LENGTH 32
 
-#define SKD_MOVE_CURSOR    0x00000001
-#define SKD_PROGRAM_CLUT   0x00000002
-#define SKD_SET_START_ADDR 0x00000004
-#define SKD_SET_CURSOR     0x00000008
-#define SKD_HANDLER_INSTALLED 0x80000000
-
 enum
 {
-    SAVAGE_GET_PRIVATE_DATA = B_DEVICE_OP_CODES_END + 1,
-    SAVAGE_GET_PCI,
-    SAVAGE_SET_PCI,
-    SAVAGE_DEVICE_NAME,
-    SAVAGE_RUN_INTERRUPTS,
-    SAVAGE_DPRINTF
+	SAVAGE_GET_PRIVATE_DATA = B_DEVICE_OP_CODES_END + 1,
+	SAVAGE_GET_PCI,
+	SAVAGE_SET_PCI,
+	SAVAGE_DEVICE_NAME,
+	SAVAGE_RUN_INTERRUPTS,
 };
 
-typedef struct
+
+// Chip tags.  These are used to group the adapters into related
+// families.  See table SavageChipsetTable in driver.c
+
+enum S3ChipTags
 {
-    uint16  vendor_id;  /* PCI vendor ID, from pci_info */
-    uint16  device_id;  /* PCI device ID, from pci_info */
-    uint8   revision;   /* PCI device revsion, from pci_info */
-    area_id regs_area;  /* Kernel's area_id for the memory mapped registers.
-                           It will be cloned into the accelerant's address
-                           space. */
-    area_id fb_area;    /* Frame buffer's area_id.  The addresses are shared
-                           with all teams. */
-    void    *framebuffer;   /* As viewed from virtual memory */
-    void    *framebuffer_pci;   /* As viewed from the PCI bus (for DMA) */
-    area_id rom_area;   /* Mapped ROM's area_id */
-    void    *rom;       /* As viewed from virtual memory.  Shared by all teams */
-    area_id mode_area;  /* Contains the list of display modes the driver supports */
-    uint32  mode_count; /* Number of display modes in the list */
-    sem_id  vblank; /* The vertical blank semaphore.  Ownership will be
-                       transfered to the team opening the device first */
-    int32   flags;    
-    int32   start_addr;
+	S3_UNKNOWN = 0,
+	S3_SAVAGE3D,
+	S3_SAVAGE_MX,
+	S3_SAVAGE4,
+	S3_PROSAVAGE,
+	S3_TWISTER,
+	S3_PROSAVAGEDDR,
+	S3_SUPERSAVAGE,
+	S3_SAVAGE2000,
+};
 
-    struct
-    {
-        uint8*  data;   /*  Pointer into the frame buffer to where the
-                            cursor data starts */
-        uint16  hot_x;  /* Cursor hot spot. The top left corner of the cursor */
-        uint16  hot_y;  /* is 0,0 */
-        uint16  x;      /* The location of the cursor hot spot on the */
-        uint16  y;      /* display (or desktop?) */
-        uint16  width;  /* Width and height of the cursor shape */
-        uint16  height;
-        bool    is_visible; /* Is the cursor currently displayed? */
-    }   cursor;
-    uint16  first_color;
-    uint16  color_count;
-    bigtime_t   refresh_period; /* Duration of one frame (ie 1/refresh rate) */
-    bigtime_t   blank_period;   /* Duration of the blanking period.   These are
-                                   usefull when faking vertical blanking
-                                   interrupts. */
-    uint8   color_data[3 * 256];    /* */
-    uint8   cursor0[64*64/8];       /* AND mask for a 64x64 cursor */
-    uint8   cursor1[512];    	    /* XOR mask for a 64x64 cursor */
-    display_mode dm;    /* current display mode configuration */
-    frame_buffer_config
-            fbc;	/* bytes_per_row and start of frame buffer */
-    struct
-    {
-        uint64  count;       /* last fifo slot used */
-        uint64  last_idle;   /* last fifo slot we *know* the engine was idle after */ 
-        benaphore    lock;   /* for serializing access to the acceleration engine */
-    }   engine;
+#define S3_SAVAGE3D_SERIES(chip)	((chip==S3_SAVAGE3D) || (chip==S3_SAVAGE_MX))
 
-    uint32    pix_clk_max8;    	/* The maximum speed the pixel clock should run */
-    uint32    pix_clk_max16;    /*  at for a given pixel width.  Usually a function */
-    uint32    pix_clk_max32;    /*  of memory and DAC bandwidths. */
-    uint32    mem_size;         /* Frame buffer memory, in bytes. */
-} shared_info;
+#define S3_SAVAGE4_SERIES(chip)		((chip==S3_SAVAGE4)		\
+									|| (chip==S3_PROSAVAGE)		\
+									|| (chip==S3_TWISTER)		\
+									|| (chip==S3_PROSAVAGEDDR))
 
-/* Read or write a value in PCI configuration space */
+#define	S3_SAVAGE_MOBILE_SERIES(chip)	((chip==S3_SAVAGE_MX) || (chip==S3_SUPERSAVAGE))
+
+#define S3_MOBILE_TWISTER_SERIES(chip)	((chip==S3_TWISTER) || (chip==S3_PROSAVAGEDDR))
+
+
+typedef enum {
+	MT_NONE,
+	MT_CRT,
+	MT_LCD,
+	MT_DFP,
+	MT_TV
+} SavageMonitorType;
+
+
+// Bitmap descriptor structures for BCI
+typedef struct _HIGH {
+	unsigned short Stride;
+	unsigned char Bpp;
+	unsigned char ResBWTile;
+} HIGH;
+
+typedef struct _BMPDESC1 {
+	unsigned long Offset;
+	HIGH  HighPart;
+} BMPDESC1;
+
+typedef struct _BMPDESC2 {
+	unsigned long LoPart;
+	unsigned long HiPart;
+} BMPDESC2;
+
+typedef union _BMPDESC {
+	BMPDESC1 bd1;
+	BMPDESC2 bd2;
+} BMPDESC;
+
+
+
 typedef struct
 {
-    uint32    magic;    /* magic number to make sure the caller groks us */
-    uint32    offset;   /* Offset to read/write */
-    uint32    size;    	/* Number of bytes to transfer */
-    uint32    value;   	/* The value read or written */
-} savage_get_set_pci;
+	// Device ID info.
+	uint16	vendorID;			// PCI vendor ID, from pci_info
+	uint16	deviceID;			// PCI device ID, from pci_info
+	uint8	revision;			// PCI device revsion, from pci_info
+	uint32	chipset;			// indicates family in which chipset belongs (a family has similar functionality)
+	char	chipsetName[32];	// user recognizable name of chipset
 
-/* Set some boolean condition (like enabling or disabling interrupts) */
+	bool	bAccelerantInUse;	// true = accelerant has been initialized
+	bool	bInterruptAssigned;	// card has a useable interrupt assigned to it
+
+	// Memory mappings.
+	area_id regsArea;			// area_id for the memory mapped registers. It will
+								// be cloned into accelerant's address space.
+	area_id videoMemArea;		// video memory area_id.  The addresses are shared with all teams.
+	void*	videoMemAddr;		// video memory addr as viewed from virtual memory
+	void*	videoMemPCI;		// video memory addr as viewed from the PCI bus (for DMA)
+	uint32	videoMemSize; 		// video memory size in bytes.
+
+	uint32	cursorOffset;		// offset of cursor in video memory
+	uint32	frameBufferOffset;	// offset of frame buffer in video memory
+	uint32	maxFrameBufferSize;	// max available video memory for frame buffer
+
+	// List of screen modes.
+	area_id modeArea;			// Contains the list of display modes the driver supports
+	uint32	modeCount;			// Number of display modes in the list
+
+	// Vertical blank semaphore.
+	sem_id	vblank;				// vertical blank semaphore; if < 0, there is no semaphore
+								// Ownership will be transfered to team opening device first
+	// Flags used by driver.
+	int32	flags;
+
+	// Cursor info.
+	struct
+	{
+		uint16	hot_x;			// Cursor hot spot. The top left corner of the cursor
+		uint16	hot_y;			// is 0,0
+		uint16	x;				// The location of the cursor hot spot on the
+		uint16	y;				// display (or desktop?)
+		uint16	width;			// Width and height of the cursor shape
+		uint16	height;
+		bool	bIsVisible;		// Is the cursor currently displayed?
+	} cursor;
+
+	display_mode dm;			// current display mode configuration
+	int			 bitsPerPixel;	// bits per pixel of current display mode
+
+	frame_buffer_config fbc;	// frame buffer addresses and bytes_per_row
+
+	// Acceleration engine.
+	struct
+	{
+		uint64		count;		// last fifo slot used
+		uint64		lastIdle;	// last fifo slot we *know* the engine was idle after
+		benaphore	lock;	 	// for serializing access to the acceleration engine
+	} engine;
+
+	int		mclk;
+	uint32	pix_clk_max8;		// The maximum speed the pixel clock should run
+	uint32	pix_clk_max16;		// at for a given pixel width.  Usually a function
+	uint32	pix_clk_max32;		// of memory and DAC bandwidths.
+
+	// Command Overflow Buffer (COB) parameters.
+	bool	bDisableCOB;		// enable/disable COB for Savage 4 & ProSavage
+	uint32	cobIndex;			// size index
+	uint32	cobSize;			// size in bytes
+	uint32	cobOffset;			// offset in video memory
+	uint32	bciThresholdLo; 	// low and high thresholds for
+	uint32  bciThresholdHi; 	// shadow status update (32bit words)
+
+	BMPDESC GlobalBD;			// Bitmap Descriptor for BCI
+
+	int		panelX;				// LCD panel width
+	int		panelY;				// LCD panel height
+
+	int		frameX0;			// viewport position
+	int		frameY0;
+
+	// The various Savage wait handlers.
+	bool	(*WaitQueue)(int);
+	bool	(*WaitIdleEmpty)();
+
+	SavageMonitorType	displayType;
+
+} SharedInfo;
+
+
+// Read or write a value in PCI configuration space
 typedef struct
 {
-    uint32  magic; /* magic number to make sure the caller groks us */
-    bool    do_it; /* state to set */
-} savage_set_bool_state;
+	uint32	  magic;	// magic number to make sure the caller groks us
+	uint32	  offset;	// Offset to read/write
+	uint32	  size;		// Number of bytes to transfer
+	uint32	  value;	// The value read or written
+} SavageGetSetPci;
 
-/* Retrieve the area_id of the kernel/accelerant shared info */
+
+// Set some boolean condition (like enabling or disabling interrupts)
 typedef struct
 {
-    uint32  magic;        /* magic number to make sure the caller groks us */
-    area_id shared_info_area;    /* area_id containing the shared information */
-} savage_get_private_data;
+	uint32	magic;		// magic number to make sure the caller groks us
+	bool	bEnable;	// state to set
+} SavageSetBoolState;
 
-/* Retrieve the device name.  Usefull for when we have a file handle, but want
-to know the device name (like when we are cloning the accelerant) */
+
+// Retrieve the area_id of the kernel/accelerant shared info
 typedef struct
 {
-    uint32    magic;        /* magic number to make sure the caller groks us */
-    char    *name;        /* The name of the device, less the /dev root */
-} savage_device_name;
+	uint32	magic;		// magic number to make sure the caller groks us
+	area_id sharedInfoArea;	// ID of area containing shared information
+} SavageGetPrivateData;
 
-enum
-{
-    SAVAGE_WAIT_FOR_VBLANK = (0 << 0)
-};
 
-enum 
+// Retrieve the device name.  Usefull for when we have a file handle, but want
+// to know the device name (like when we are cloning the accelerant)
+typedef struct
 {
-	/* Savage3D series */
-	PCI_PID_SAVAGE3D = 0x8a20,		/* Savage3D */
-	PCI_PID_SAVAGE3DMV = 0x8a21,	/* Savage3D/MV */
-	PCI_PID_SAVAGEMXMV = 0x8c10,	/* Savage/MX-MV */
-	PCI_PID_SAVAGEMX = 0x8c11,		/* Savage/MX */
-	PCI_PID_SAVAGEIXMV = 0x8c12,	/* Savage/IX-MV */
-	PCI_PID_SAVAGEIX = 0x8c13,		/* Savage/IX */
+	uint32	magic;		// magic number to make sure the caller groks us
+	char	*name;		// The name of the device, less the /dev root
+} SavageDeviceName;
 
-	/* Savage4 series */
-	PCI_PID_SAVAGE4_2 = 0x8a22,		/* Savage4 */
-	PCI_PID_SAVAGE4_3 = 0x8a23,		/* Savage4 */
-	PCI_PID_SAVAGE2000 = 0x9102,	/* Savage2000 */
-	PCI_PID_PM133 = 0x8a25,			/* ProSavage PM133 */
-	PCI_PID_KM133 = 0x8a26,			/* ProSavage KM133 */
-	PCI_PID_PN133 = 0x8d01,			/* ProSavage PN133, 86C380 [ProSavageDDR K4M266] */
-	PCI_PID_KN133 = 0x8d02,			/* ProSavage KN133/TwisterK AGP4X VT8636A */
-	PCI_PID_KM266 = 0x8d04,			/* ProSavage8 KM266/KL266 VT8375  */
-	PCI_PID_PN266 = 0x8d03,			/* VT8751 [ProSavageDDR P4M266] */
 
-	/* SuperSavage series (unsupported) */
-	PCI_PID_SUPERSAVAGE_MX128 = 0x8c22,		/* SuperSavage MX/128 */
-	PCI_PID_SUPERSAVAGE_MX64 = 0x8c24,		/* SuperSavage MX/64 */
-	PCI_PID_SUPERSAVAGE_MX64C = 0x8c26,		/* SuperSavage MX/64C */
-	PCI_PID_SUPERSAVAGE_IX128_SDR = 0x8c2a,	/* SuperSavage IX/128 SDR */
-	PCI_PID_SUPERSAVAGE_IX128_DDR = 0x8c2b,	/* SuperSavage IX/128 DDR */
-	PCI_PID_SUPERSAVAGE_IX64_SDR = 0x8c2c,	/* SuperSavage IX/64 SDR */
-	PCI_PID_SUPERSAVAGE_IX64_DDR = 0x8c2d,	/* SuperSavage IX/64 DDR */
-	PCI_PID_SUPERSAVAGE_IXC_SDR = 0x8c2e,	/* SuperSavage IX/C SDR */
-	PCI_PID_SUPERSAVAGE_IXC_DDR = 0x8c2f,	/* SuperSavage IX/C DDR */
-};
-
-#define	isSavage4Family(p)		\
-	((p) == PCI_PID_SAVAGE4_2 ||	\
-	 (p) == PCI_PID_SAVAGE4_3 ||	\
-	 (p) == PCI_PID_SAVAGE2000 ||	\
-	 (p) == PCI_PID_PM133 ||	\
-	 (p) == PCI_PID_KM133 ||	\
-	 (p) == PCI_PID_PN133 ||	\
-	 (p) == PCI_PID_KN133 ||	\
-	 (p) == PCI_PID_KM266)
-
-
 #if defined(__cplusplus)
 }
 #endif

Added: haiku/trunk/src/add-ons/accelerants/s3savage/AccelerantPrototypes.h
===================================================================
--- haiku/trunk/src/add-ons/accelerants/s3savage/AccelerantPrototypes.h	2007-06-15 20:28:07 UTC (rev 21420)
+++ haiku/trunk/src/add-ons/accelerants/s3savage/AccelerantPrototypes.h	2007-06-15 21:02:08 UTC (rev 21421)
@@ -0,0 +1,56 @@
+/*
+	Copyright 1999, Be Incorporated.   All Rights Reserved.
+	This file may be used under the terms of the Be Sample Code License.
+*/
+
+#ifndef ACCELERANT_PROTOTYPES_H
+#define ACCELERANT_PROTOTYPES_H
+
+#include 
+
+status_t INIT_ACCELERANT(int fd);
+ssize_t ACCELERANT_CLONE_INFO_SIZE(void);
+void GET_ACCELERANT_CLONE_INFO(void *data);
+status_t CLONE_ACCELERANT(void *data);
+void UNINIT_ACCELERANT(void);
+status_t GET_ACCELERANT_DEVICE_INFO(accelerant_device_info *adi);
+sem_id ACCELERANT_RETRACE_SEMAPHORE(void);
+
+uint32 ACCELERANT_MODE_COUNT(void);
+status_t GET_MODE_LIST(display_mode *dm);
+status_t PROPOSE_DISPLAY_MODE(display_mode *target, const display_mode *low, const display_mode *high);
+status_t SET_DISPLAY_MODE(display_mode *mode_to_set);
+status_t GET_DISPLAY_MODE(display_mode *current_mode);
+status_t GET_FRAME_BUFFER_CONFIG(frame_buffer_config *a_frame_buffer);
+status_t GET_PIXEL_CLOCK_LIMITS(display_mode *dm, uint32 *low, uint32 *high);
+status_t MOVE_DISPLAY(uint16 h_display_start, uint16 v_display_start);
+status_t GET_TIMING_CONSTRAINTS(display_timing_constraints *dtc);
+void SET_INDEXED_COLORS(uint count, uint8 first, uint8 *color_data, uint32 flags);
+
+uint32 DPMS_CAPABILITIES(void);
+uint32 DPMS_MODE(void);
+status_t SET_DPMS_MODE(uint32 dpms_flags);
+
+status_t SET_CURSOR_SHAPE(uint16 width, uint16 height, uint16 hot_x, uint16 hot_y, uint8 *andMask, uint8 *xorMask);
+void MOVE_CURSOR(uint16 x, uint16 y);
+void SHOW_CURSOR(bool is_visible);
+
+uint32 ACCELERANT_ENGINE_COUNT(void);
+status_t ACQUIRE_ENGINE(uint32 capabilities, uint32 max_wait, sync_token *st, engine_token **et);
+status_t RELEASE_ENGINE(engine_token *et, sync_token *st);
+void WAIT_ENGINE_IDLE(void);
+status_t GET_SYNC_TOKEN(engine_token *et, sync_token *st);
+status_t SYNC_TO_TOKEN(sync_token *st);
+
+void SCREEN_TO_SCREEN_BLIT(engine_token *et, blit_params *list, uint32 count);
+void FILL_RECTANGLE(engine_token *et, uint32 color, fill_rect_params *list, uint32 count);
+void INVERT_RECTANGLE(engine_token *et, fill_rect_params *list, uint32 count);
+
+void FILL_SPAN(engine_token *et, uint32 color, uint16 *list, uint32 count);
+
+// Prototype for other functions that are called from source files
+// other than where they are defined.
+
+status_t create_mode_list(void);
+
+#endif

Modified: haiku/trunk/src/add-ons/accelerants/s3savage/Acceleration.c
===================================================================
--- haiku/trunk/src/add-ons/accelerants/s3savage/Acceleration.c	2007-06-15 20:28:07 UTC (rev 21420)
+++ haiku/trunk/src/add-ons/accelerants/s3savage/Acceleration.c	2007-06-15 21:02:08 UTC (rev 21421)
@@ -1,121 +1,182 @@
 /*
- * Copyright 1999  Erdi Chen
- */
+	Haiku S3 Savage driver adapted from the X.org Savage driver.
 
+	Copyright (C) 1994-2000 The XFree86 Project, Inc.  All Rights Reserved.
+	Copyright (c) 2003-2006, X.Org Foundation
+
+	Copyright 2007 Haiku, Inc.  All rights reserved.
+	Distributed under the terms of the MIT license.
+
+	Authors:
+	Gerald Zajac 2006-2007
+*/
+
+
 #include "GlobalData.h"
-#include "generic.h"
-#include "s3accel.h"
-#include "s3mmio.h"
+#include "AccelerantPrototypes.h"
+#include "savage.h"
 
-void
-SCREEN_TO_SCREEN_BLIT (
-    engine_token *et, blit_params *list, uint32 count)
+
+
+void 
+FILL_RECTANGLE (engine_token *et, uint32 color, fill_rect_params *pList, uint32 count)
 {
-    s3accel_wait_for_fifo (1);
-    UpdateGEReg16 (FRGD_MIX, 0x0067);
-	    
-    while (count--)
-    {
-        int cmd = 0xc0b1;
-        int src_x = list->src_left;
-        int src_y = list->src_top;
-        int dest_x = list->dest_left;
-        int dest_y = list->dest_top;
-        int width  = list->width;
-        int height = list->height;
-        
-        if (src_x < dest_x)
-        {
-            src_x += width; dest_x += width;
-            cmd ^=32;
-        }
-                        
-        if (src_y < dest_y)
-        {
-            src_y += height; dest_y += height;
-            cmd ^=128;
-        }
-                
-        UpdateGEReg (ALT_CURXY, (src_x<<16)|src_y);  
-        UpdateGEReg (ALT_STEP, (dest_x<<16)|dest_y); 
-        UpdateGEReg (ALT_PCNT, (width<<16)|height);  
-        UpdateGEReg (CMD, cmd);
-        
-        list ++;
-    }
+	int cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP
+			| BCI_CMD_DEST_PBD_NEW | BCI_CMD_SRC_SOLID | BCI_CMD_SEND_COLOR;
 
-    s3accel_wait_for_fifo (3);
-    UpdateGEReg16 (FRGD_MIX, 0x0027);
+	(void)et;		// avoid compiler warning for unused arg
+
+//	TRACE(("FILL_RECTANGLE, color: %X  count: %d\n", color, count));
+
+	BCI_CMD_SET_ROP(cmd, 0xCC);		// use GXcopy for rop
+
+	while (count--) {
+		int x = pList->left;
+		int y = pList->top;
+		int w = pList->right - x + 1;
+		int h = pList->bottom - y + 1;
+
+		BCI_GET_PTR;
+
+		si->WaitQueue(7);
+
+		BCI_SEND(cmd);
+		BCI_SEND(si->GlobalBD.bd2.LoPart);
+		BCI_SEND(si->GlobalBD.bd2.HiPart);
+
+		BCI_SEND(color);
+		BCI_SEND(BCI_X_Y(x, y));
+		BCI_SEND(BCI_W_H(w, h));
+
+		pList++;
+	}
 }
 
-void
-FILL_RECTANGLE (
-    engine_token *et, uint32 color, fill_rect_params *list, uint32 count)
+
+void 
+FILL_SPAN(engine_token *et, uint32 color, uint16 *pList, uint32 count)
 {
-    s3accel_wait_for_fifo (1);
-    UpdateGEReg (FRGD_COLOR, color);
-    UpdateGEReg16 (FRGD_MIX, 0x0027);
-	
-    while (count--)
-    {
-        int x = list->left;
-        int y = list->top;
-        int w = list->right - x;
-        int h = list->bottom - y;
+	int cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP
+			| BCI_CMD_DEST_PBD_NEW | BCI_CMD_SRC_SOLID | BCI_CMD_SEND_COLOR;
 
-        s3accel_wait_for_fifo (2);
-        UpdateGEReg   (ALT_CURXY, (x<<16)|y);
-        UpdateGEReg   (ALT_PCNT, (w<<16)|h); 
-        UpdateGEReg (CMD,  0x000040b1);
+	(void)et;		// avoid compiler warning for unused arg
 
-        list++;
-    }
-    s3accel_wait_for_fifo(3);
+//	TRACE(("FILL_SPAN, count: %d\n", count));
+
+	BCI_CMD_SET_ROP(cmd, 0xCC);		// use GXcopy for rop
+
+	while (count--) {
+		int y = *pList++;
+		int x = *pList++;
+		int w = *pList++ - x + 1;
+
+		BCI_GET_PTR;
+
+		// The MediaPlayer in Zeta 1.21 displays a window which has 2 zero width
+		// spans which the Savage chips display as a line completely across the
+		// screen;  thus, the following if statement discards any span with zero
+		// or negative width.
+			
+		if (w <= 0)
+			continue;
+
+		si->WaitQueue(7);
+
+		BCI_SEND(cmd);
+		BCI_SEND(si->GlobalBD.bd2.LoPart);
+		BCI_SEND(si->GlobalBD.bd2.HiPart);
+
+		BCI_SEND(color);
+		BCI_SEND(BCI_X_Y(x, y));
+		BCI_SEND(BCI_W_H(w, 1));
+	}
 }
 
-void
-INVERT_RECTANGLE (
-    engine_token *et, fill_rect_params *list, uint32 count)
+
+void 
+INVERT_RECTANGLE(engine_token *et, fill_rect_params *pList, uint32 count)
 {
-    s3accel_wait_for_fifo (1);
-    UpdateGEReg16 (FRGD_MIX, 0x0020);
-	
-    while (count--)
-    {
-        int x = list->left;
-        int y = list->top;
-        int w = list->right - x;
-        int h = list->bottom - y;
+	int cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP
+			| BCI_CMD_DEST_PBD_NEW;
 
-        s3accel_wait_for_fifo (2);
-        UpdateGEReg   (ALT_CURXY, (x<<16)|y);
-        UpdateGEReg   (ALT_PCNT, (w<<16)|h); 
-        UpdateGEReg (CMD,  0x000040b1);
+	(void)et;		// avoid compiler warning for unused arg
 
-        list++;
-    }
+//	TRACE(("INVERT_RECTANGLE, count: %d\n", count));
 
-    s3accel_wait_for_fifo (3);
-    UpdateGEReg16 (FRGD_MIX, 0x0027); 
+	BCI_CMD_SET_ROP(cmd, 0x55);		// use GXinvert for rop
+
+	while (count--) {
+		int x = pList->left;
+		int y = pList->top;
+		int w = pList->right - x + 1;
+		int h = pList->bottom - y + 1;
+
+		BCI_GET_PTR;
+
+		si->WaitQueue(7);
+
+		BCI_SEND(cmd);
+		BCI_SEND(si->GlobalBD.bd2.LoPart);
+		BCI_SEND(si->GlobalBD.bd2.HiPart);
+
+		BCI_SEND(BCI_X_Y(x, y));
+		BCI_SEND(BCI_W_H(w, h));
+
+		pList++;
+	}
 }
 
-void
-FILL_SPAN (
-    engine_token *et, uint32 color, uint16 *list, uint32 count)
+
+void 
+SCREEN_TO_SCREEN_BLIT(engine_token *et, blit_params *pList, uint32 count)
 {
-    s3accel_wait_for_fifo (1);
-    UpdateGEReg (FRGD_COLOR, color);
-    UpdateGEReg16 (FRGD_MIX, 0x0027);
+//	TRACE(("SCREEN_TO_SCREEN_BLIT\n"));
 
-    while (count--)
-    {
-        int y = *list ++;
-        int x = *list ++;
-        int w = *list - x; list ++;
+	(void)et;		// avoid compiler warning for unused arg
 
-        s3accel_wait_for_fifo (2);
-        UpdateGEReg   (ALT_CURXY, (x<<16)|y);
-        UpdateGEReg   (ALT_PCNT, (w<<16)|1);
-        UpdateGEReg (CMD,  0x000040b1);
-    } 
+	while (count--) {
+		int cmd;
+		int src_x = pList->src_left;
+		int src_y = pList->src_top;
+		int dest_x = pList->dest_left;
+		int dest_y = pList->dest_top;
+		int width = pList->width;
+		int height = pList->height;
+
+		BCI_GET_PTR;
+
+		cmd = BCI_CMD_RECT | BCI_CMD_DEST_PBD_NEW | BCI_CMD_SRC_SBD_COLOR_NEW;
+		BCI_CMD_SET_ROP(cmd, 0xCC);		// use GXcopy for rop
+
+		if (dest_x <= src_x) {
+			cmd |= BCI_CMD_RECT_XP;
+		} else {
+			src_x += width;
+			dest_x += width;
+		}
+
+		if (dest_y <= src_y) {
+			cmd |= BCI_CMD_RECT_YP;
+		} else {
+			src_y += height;
+			dest_y += height;
+		}
+
+		si->WaitQueue(9);
+
+		BCI_SEND(cmd);
+
+		BCI_SEND(si->GlobalBD.bd2.LoPart);
+		BCI_SEND(si->GlobalBD.bd2.HiPart);
+
+		BCI_SEND(si->GlobalBD.bd2.LoPart);
+		BCI_SEND(si->GlobalBD.bd2.HiPart);
+
+		BCI_SEND(BCI_X_Y(src_x, src_y));
+		BCI_SEND(BCI_X_Y(dest_x, dest_y));
+		BCI_SEND(BCI_W_H(width + 1, height + 1));
+
+		pList ++;
+	}
 }
+

Modified: haiku/trunk/src/add-ons/accelerants/s3savage/Cursor.c
===================================================================
--- haiku/trunk/src/add-ons/accelerants/s3savage/Cursor.c	2007-06-15 20:28:07 UTC (rev 21420)
+++ haiku/trunk/src/add-ons/accelerants/s3savage/Cursor.c	2007-06-15 21:02:08 UTC (rev 21421)
@@ -1,48 +1,38 @@
 /*
-    Copyright 1999, Be Incorporated.   All Rights Reserved.
-    This file may be used under the terms of the Be Sample Code License.
+	Copyright 1999, Be Incorporated.   All Rights Reserved.
+	This file may be used under the terms of the Be Sample Code License.
+
+	Other authors:
+	Gerald Zajac 2006-2007
 */
-/*
- * Copyright 1999  Erdi Chen
- */
 
 #include "GlobalData.h"
-#include "generic.h"
-#include "s3drv.h"
+#include "AccelerantPrototypes.h"
+#include "savage.h"
 
-void set_cursor_colors(void)
-{
-    /* it's only called by the INIT_ACCELERANT() */
-    s3drv_set_cursor_color (0, ~0);
-}
 
-status_t
-SET_CURSOR_SHAPE (
-    uint16 width, uint16 height, uint16 hot_x, uint16 hot_y,
-    uint8 *andMask, uint8 *xorMask)
+status_t 
+SET_CURSOR_SHAPE(uint16 width, uint16 height, uint16 hot_x, uint16 hot_y,
+						  uint8* andMask, uint8* xorMask)
 {
-/* NOTE: Currently, for BeOS, cursor width and height must be equal to 16. */
+	/* NOTE: Currently, for BeOS, cursor width and height must be equal to 16. */
 
-    if ((width != 16) || (height != 16))
-    {
-        return B_ERROR;
-    }
-    else if ((hot_x >= width) || (hot_y >= height))
-    {
-        return B_ERROR;
-    }
-    else
-    {
-        /* Update cursor variables appropriately. */
-        si->cursor.width = width;
-        si->cursor.height = height;
-        si->cursor.hot_x = hot_x;
-        si->cursor.hot_y = hot_y;
-        s3drv_load_cursor ((byte_t*)framebuffer, 0,
-                           width, height, andMask, xorMask);
-    }
+	if ((width != 16) || (height != 16)) {
+		return B_ERROR;
+	} else if ((hot_x >= width) || (hot_y >= height)) {
+		return B_ERROR;
+	} else {
+		/* Update cursor variables appropriately. */
+		si->cursor.width = width;
+		si->cursor.height = height;
+		si->cursor.hot_x = hot_x;
+		si->cursor.hot_y = hot_y;
 
-    return B_OK;
+		if (!SavageLoadCursorImage(width, height, andMask, xorMask))
+			return B_ERROR;
+	}
+
+	return B_OK;
 }
 
 /*
@@ -50,64 +40,51 @@
 using some kind of virtual desktop, adjust the display start position
 accordingly and position the cursor in the proper "virtual" location.
 */
-void MOVE_CURSOR (uint16 x_p, uint16 y_p)
+void 
+MOVE_CURSOR(uint16 xPos, uint16 yPos)
 {
-    int x = x_p, y = y_p;
-    bool move_screen = false;
-    /* the current horizontal starting pixel */
-    uint16 hds = si->dm.h_display_start;
-    /* the current vertical starting line */
-    uint16 vds = si->dm.v_display_start;
+	int x = xPos;		// use signed int's since SavageSetCursorPosition()
+	int y = yPos;		// needs signed int to determine if cursor off screen
 
-    /* Need to set this value for 32 bit */
-    uint16 h_adjust = 3;
+	uint16 hds = si->dm.h_display_start;	/* current horizontal starting pixel */
+	uint16 vds = si->dm.v_display_start;	/* current vertical starting line */
 
-    /* clamp cursor to virtual display */
-    if (x >= si->dm.virtual_width) x = si->dm.virtual_width - 1;
-    if (y >= si->dm.virtual_height) y = si->dm.virtual_height - 1;
+	/* clamp cursor to virtual display */
+	if (x >= si->dm.virtual_width)
+		x = si->dm.virtual_width - 1;
+	if (y >= si->dm.virtual_height)
+		y = si->dm.virtual_height - 1;
 
-    /* adjust h/v_display_start to move cursor onto screen */
-    if (x >= (si->dm.timing.h_display + hds))
-    {
-    	hds = ((x - si->dm.timing.h_display) + 1 + h_adjust) & ~h_adjust;
-    	move_screen = true;
-    }
-    else if (x < hds)
-    {
-    	hds = x & ~h_adjust;
-    	move_screen = true;
-    }
-    if (y >= (si->dm.timing.v_display + vds))
-    {
-    	vds = y - si->dm.timing.v_display + 1;
-    	move_screen = true;
-    }
-    else if (y < vds)
-    {
-    	vds = y;
-    	move_screen = true;
-    }
+	/* adjust h/v display start to move cursor onto screen */
+	if (x >= (si->dm.timing.h_display + hds))
+		hds = x - si->dm.timing.h_display + 1;
+	else if (x < hds)
+		hds = x;
 
-    /* reposition the desktop on the display if required */
-    if (move_screen) MOVE_DISPLAY(hds,vds);
+	if (y >= (si->dm.timing.v_display + vds))
+		vds = y - si->dm.timing.v_display + 1;
+	else if (y < vds)
+		vds = y;
 
-    /* put cursor in correct physical position */
-    x -= hds;
-    y -= vds;
-    x -= si->cursor.hot_x;
-    y -= si->cursor.hot_y;
+	/* reposition the desktop on the display if required */
+	if (hds != si->dm.h_display_start || vds != si->dm.v_display_start)
+		MOVE_DISPLAY(hds, vds);
 
-    /* position the cursor on the display */
-    s3drv_move_cursor (x, y);
+	/* put cursor in correct physical position */
+	x -= (hds + si->cursor.hot_x);
+	y -= (vds + si->cursor.hot_y);
+
+	/* position the cursor on the display */
+	SavageSetCursorPosition(x, y);
 }
 
-void SHOW_CURSOR (bool is_visible)
-{
-    if (is_visible)
-        s3drv_show_cursor ();
-    else
-        s3drv_hide_cursor ();
 
-    /* record for our info */
-    si->cursor.is_visible = is_visible;
+void 
+SHOW_CURSOR(bool bShow)
+{
+	if (bShow)
+		SavageShowCursor();
+	else
+		SavageHideCursor();
 }
+

Modified: haiku/trunk/src/add-ons/accelerants/s3savage/EngineManagement.c
===================================================================
--- haiku/trunk/src/add-ons/accelerants/s3savage/EngineManagement.c	2007-06-15 20:28:07 UTC (rev 21420)
+++ haiku/trunk/src/add-ons/accelerants/s3savage/EngineManagement.c	2007-06-15 21:02:08 UTC (rev 21421)
@@ -1,70 +1,80 @@
 /*
 	Copyright 1999, Be Incorporated.   All Rights Reserved.
 	This file may be used under the terms of the Be Sample Code License.
+
+	Other authors:
+	Gerald Zajac 2006-2007
 */
-/*
- * Copyright 1999  Erdi Chen
- */
 
 #include "GlobalData.h"
-#include "generic.h"
-#include "s3drv.h"
+#include "AccelerantPrototypes.h"
 
 
 static engine_token savage_engine_token = { 1, B_2D_ACCELERATION, NULL };
 
-uint32 ACCELERANT_ENGINE_COUNT(void)
+
+uint32 
+ACCELERANT_ENGINE_COUNT(void)
 {
-    return 1;
+	return 1;
 }
 
-status_t
-ACQUIRE_ENGINE (
-    uint32 capabilities, uint32 max_wait,
-    sync_token *st, engine_token **et)
+
+status_t 
+ACQUIRE_ENGINE(uint32 capabilities, uint32 max_wait,
+						sync_token *st, engine_token **et)
 {
-    /* acquire the shared benaphore */
-    AQUIRE_BEN(si->engine.lock)
-    /* sync if required */
-    if (st) SYNC_TO_TOKEN(st);
+	(void)capabilities;	// avoid compiler warning for unused arg
+	(void)max_wait;		// avoid compiler warning for unused arg
 
-    /* return an engine token */
-    *et = &savage_engine_token;
-    return B_OK;
+	/* acquire the shared benaphore */
+	AQUIRE_BEN(si->engine.lock)
+	/* sync if required */
+	if (st)
+		SYNC_TO_TOKEN(st);
+
+	/* return an engine token */
+	*et = &savage_engine_token;
+	return B_OK;
 }
 
-status_t RELEASE_ENGINE (engine_token *et, sync_token *st)
+
+status_t 
+RELEASE_ENGINE(engine_token *et, sync_token *st)
 {
-    /* update the sync token, if any */
-    if (st)
-    {
-        st->engine_id = et->engine_id;
-        st->counter = si->engine.count;
-    }
+	/* update the sync token, if any */
+	if (st)
+		GET_SYNC_TOKEN(et, st);
 
-    /* release the shared benaphore */
-    RELEASE_BEN(si->engine.lock)
-    return B_OK;

[... truncated: 6532 lines follow ...]


From revol at free.fr  Fri Jun 15 23:38:14 2007
From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol)
Date: Fri, 15 Jun 2007 23:38:14 +0200 CEST
Subject: [Haiku-commits] r21408 - haiku/trunk/src/kits/game
In-Reply-To: <9050840455-BeMail@ibm>
Message-ID: <1022632856-BeMail@laptop>

> Actually, I planned to phase out the clone info stuff completely, as 
> it 
> doesn't make much sense the way it's done. But I first wanted to 
> implement a proper multi-head protocol before deciding anything 
> there, 
> as that might give new insights.

Ahh, yes, multihead please ! :p
I dug that some time ago but wasn't sure exactly how to handle it...
having separate accelerant_infos or adding a head param in hooks...
I suppose not all cards have the same locking model (lock the whole 
GPU, or each head separately, ...) and resource sharing (overlay... I 
recall some MGA cards had probs with hw cursor on the 2nd head).
On the app side it should be transparent, properly coded apps (those 
using BScreen::Frame()) should behave correctly when moved.
Hmm, actually, most use BScreen without referencing their BWindow... 
they'll end up using the default screen even if they mean the one their 
window is on :^)
OTH if we want to see the desktop on each of them we must fix 
Tracker...

Fran?ois.


From korli at mail.berlios.de  Sat Jun 16 13:33:43 2007
From: korli at mail.berlios.de (korli at BerliOS)
Date: Sat, 16 Jun 2007 13:33:43 +0200
Subject: [Haiku-commits] r21422 -
	haiku/trunk/src/add-ons/kernel/file_systems/bfs
Message-ID: <200706161133.l5GBXhC5000102@sheep.berlios.de>

Author: korli
Date: 2007-06-16 13:33:42 +0200 (Sat, 16 Jun 2007)
New Revision: 21422
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21422&view=rev

Modified:
   haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp
   haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp
   haiku/trunk/src/add-ons/kernel/file_systems/bfs/bfs.h
Log:
replaced uint32 by addr_t where it applies to please gcc on x86_64


Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp	2007-06-15 21:02:08 UTC (rev 21421)
+++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp	2007-06-16 11:33:42 UTC (rev 21422)
@@ -1908,7 +1908,7 @@
 			nextOffset = node->OverflowLink();
 		else {
 			if (node->AllKeyLength() > fTree->fNodeSize
-				|| (uint32)node->Values() > (uint32)node + fTree->fNodeSize
+				|| (addr_t)node->Values() > (addr_t)node + fTree->fNodeSize
 					- 8 * node->NumKeys())
 				RETURN_ERROR(B_ERROR);
 

Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp	2007-06-15 21:02:08 UTC (rev 21421)
+++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp	2007-06-16 11:33:42 UTC (rev 21422)
@@ -206,7 +206,7 @@
 		buffer[length] = '\0';
 
 		off_t *value = node->Values() + i;
-		if ((uint32)value < (uint32)node || (uint32)value > (uint32)node + header->node_size)
+		if ((addr_t)value < (addr_t)node || (addr_t)value > (addr_t)node + header->node_size)
 			Print("  %2d. Invalid Offset!!\n", (int)i);
 		else {
 			Print("  %2d. ", (int)i);

Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/bfs.h
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/bfs/bfs.h	2007-06-15 21:02:08 UTC (rev 21421)
+++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/bfs.h	2007-06-16 11:33:42 UTC (rev 21422)
@@ -365,7 +365,7 @@
 	// we need to check the location first, because if name_size is already beyond
 	// the block, we would touch invalid memory (although that can't cause wrong
 	// results)
-	return (uint32)this > (uint32)inode + inode->InodeSize() - sizeof(small_data) || name_size == 0;
+	return (addr_t)this > (addr_t)inode + inode->InodeSize() - sizeof(small_data) || name_size == 0;
 }
 
 #ifdef _BOOT_MODE



From geist at mail.berlios.de  Sat Jun 16 21:43:54 2007
From: geist at mail.berlios.de (geist at BerliOS)
Date: Sat, 16 Jun 2007 21:43:54 +0200
Subject: [Haiku-commits] r21423 - in haiku/trunk: build/jam
	src/build/libbe/app src/build/libbe/interface
	src/build/libbe/storage src/build/libbe/support
Message-ID: <200706161943.l5GJhsGr031400@sheep.berlios.de>

Author: geist
Date: 2007-06-16 21:43:53 +0200 (Sat, 16 Jun 2007)
New Revision: 21423
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21423&view=rev

Modified:
   haiku/trunk/build/jam/BuildSetup
   haiku/trunk/build/jam/MainBuildRules
   haiku/trunk/src/build/libbe/app/Jamfile
   haiku/trunk/src/build/libbe/interface/Jamfile
   haiku/trunk/src/build/libbe/storage/Jamfile
   haiku/trunk/src/build/libbe/support/Jamfile
Log:
some make system work to get x86-64 linux compiles working:
-The biggest problem with linking host libraries (libbe_build and libroot_build) was not having the source files compiled with the -fPIC flag. As far as I can tell, we want to do this on all of the other host platforms as well, so hacked the jam files a bit to add it. 
Forgive me if I've committed more Jamfile sins.


Modified: haiku/trunk/build/jam/BuildSetup
===================================================================
--- haiku/trunk/build/jam/BuildSetup	2007-06-16 11:33:42 UTC (rev 21422)
+++ haiku/trunk/build/jam/BuildSetup	2007-06-16 19:43:53 UTC (rev 21423)
@@ -387,6 +387,9 @@
 HOST_CCFLAGS += -Wno-multichar ;
 HOST_C++FLAGS += -Wno-multichar ;
 
+HOST_PIC_CCFLAGS += -fPIC ;
+HOST_PIC_C++FLAGS += -fPIC ;
+
 HOST_KERNEL_CCFLAGS += -finline -fno-builtin
 	-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
 HOST_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions

Modified: haiku/trunk/build/jam/MainBuildRules
===================================================================
--- haiku/trunk/build/jam/MainBuildRules	2007-06-16 11:33:42 UTC (rev 21422)
+++ haiku/trunk/build/jam/MainBuildRules	2007-06-16 19:43:53 UTC (rev 21423)
@@ -465,6 +465,10 @@
 		LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
 			-shared -Xlinker -soname=\"$(target:G=)\" ;
 	}
+
+    local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
+	CCFLAGS on $(objects) += $(HOST_PIC_CCFLAGS) ; 
+	C++FLAGS on $(objects) += $(HOST_PIC_C++FLAGS) ; 
 }
 
 rule BuildPlatformMergeObject
@@ -489,10 +493,32 @@
 		# propagate the flag to the objects
 		USES_BE_API on $(objects) = $(usesBeAPI) ;
 	}
-	
+
 	MergeObject $(target) : $(sources) : $(otherObjects) ;
 }
 
+rule BuildPlatformMergeObjectPIC
+{
+	# BuildPlatformMergeObjectPIC  :  :  ;
+	# Compiles source files and merges the object files to an object file.
+	# Same as BuildPlatformMergeObject rule but adds position-independent
+	# flags to the compiler (if any).
+	# : Name of the object file to create. No grist will be added.
+	# : Sources to be compiled. Grist will be added.
+	# : Object files or static libraries to be merged. No grist
+	#                  will be added.
+	#
+	local target = $(1) ;
+	local sources = $(2) ;
+	local otherObjects = $(3) ;
+
+	local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
+	CCFLAGS on $(objects) += $(HOST_PIC_CCFLAGS) ; 
+	C++FLAGS on $(objects) += $(HOST_PIC_C++FLAGS) ; 
+
+	BuildPlatformMergeObject $(target) : $(sources) : $(otherObjects) ;
+}
+
 rule BuildPlatformStaticLibrary
 {
 	# BuildPlatformStaticLibrary  :  ;

Modified: haiku/trunk/src/build/libbe/app/Jamfile
===================================================================
--- haiku/trunk/src/build/libbe/app/Jamfile	2007-06-16 11:33:42 UTC (rev 21422)
+++ haiku/trunk/src/build/libbe/app/Jamfile	2007-06-16 19:43:53 UTC (rev 21423)
@@ -5,7 +5,7 @@
 
 USES_BE_API on app_kit.o = true ;
 
-BuildPlatformMergeObject app_kit.o :
+BuildPlatformMergeObjectPIC app_kit.o :
  	Application.cpp
  	AppMisc.cpp
 	Message.cpp

Modified: haiku/trunk/src/build/libbe/interface/Jamfile
===================================================================
--- haiku/trunk/src/build/libbe/interface/Jamfile	2007-06-16 11:33:42 UTC (rev 21422)
+++ haiku/trunk/src/build/libbe/interface/Jamfile	2007-06-16 19:43:53 UTC (rev 21423)
@@ -6,7 +6,7 @@
 
 USES_BE_API on interface_kit.o = true ;
 
-BuildPlatformMergeObject interface_kit.o :
+BuildPlatformMergeObjectPIC interface_kit.o :
 	Bitmap.cpp
  	GraphicsDefs.cpp
  	Point.cpp

Modified: haiku/trunk/src/build/libbe/storage/Jamfile
===================================================================
--- haiku/trunk/src/build/libbe/storage/Jamfile	2007-06-16 11:33:42 UTC (rev 21422)
+++ haiku/trunk/src/build/libbe/storage/Jamfile	2007-06-16 19:43:53 UTC (rev 21423)
@@ -9,7 +9,7 @@
 
 USES_BE_API on storage_kit.o = true ;
 
-BuildPlatformMergeObject storage_kit.o :
+BuildPlatformMergeObjectPIC storage_kit.o :
 	AppFileInfo.cpp
 	Directory.cpp
 	Entry.cpp

Modified: haiku/trunk/src/build/libbe/support/Jamfile
===================================================================
--- haiku/trunk/src/build/libbe/support/Jamfile	2007-06-16 11:33:42 UTC (rev 21422)
+++ haiku/trunk/src/build/libbe/support/Jamfile	2007-06-16 19:43:53 UTC (rev 21423)
@@ -5,7 +5,7 @@
 
 USES_BE_API on support_kit.o = true ;
 
-BuildPlatformMergeObject support_kit.o :
+BuildPlatformMergeObjectPIC support_kit.o :
 	Archivable.cpp
 	BlockCache.cpp
 	ByteOrder.cpp



From bonefish at cs.tu-berlin.de  Sat Jun 16 22:39:23 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sat, 16 Jun 2007 22:39:23 +0200
Subject: [Haiku-commits] r21423 - in haiku/trunk: build/jam
 src/build/libbe/app src/build/libbe/interface src/build/libbe/storage
 src/build/libbe/support
In-Reply-To: <200706161943.l5GJhsGr031400@sheep.berlios.de>
References: <200706161943.l5GJhsGr031400@sheep.berlios.de>
Message-ID: <20070616223923.11729.3@cs.tu-berlin.de>


On 2007-06-16 at 21:43:54 [+0200], geist at BerliOS  
wrote:
> Author: geist
> Date: 2007-06-16 21:43:53 +0200 (Sat, 16 Jun 2007)
> New Revision: 21423
> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21423&view=rev
> 
> Modified:
>    haiku/trunk/build/jam/BuildSetup
>    haiku/trunk/build/jam/MainBuildRules
>    haiku/trunk/src/build/libbe/app/Jamfile
>    haiku/trunk/src/build/libbe/interface/Jamfile
>    haiku/trunk/src/build/libbe/storage/Jamfile
>    haiku/trunk/src/build/libbe/support/Jamfile
> Log:
> some make system work to get x86-64 linux compiles working:
> -The biggest problem with linking host libraries (libbe_build and 
> libroot_build) was not having the source files compiled with the -fPIC 
> flag. As far as I can tell, we want to do this on all of the other host 
> platforms as well, so hacked the jam files a bit to add it.
> Forgive me if I've committed more Jamfile sins.

Only small ones. :-)
I wonder, if there's any particular reason not just to add "-fPIC" to 
HOST_CCFLAGS/HOST_C++FLAGS.

CU, Ingo


From geist at foobox.com  Sun Jun 17 01:05:20 2007
From: geist at foobox.com (Travis Geiselbrecht)
Date: Sat, 16 Jun 2007 16:05:20 -0700
Subject: [Haiku-commits] r21423 - in haiku/trunk: build/jam
	src/build/libbe/app src/build/libbe/interface
	src/build/libbe/storage src/build/libbe/support
In-Reply-To: <20070616223923.11729.3@cs.tu-berlin.de>
References: <200706161943.l5GJhsGr031400@sheep.berlios.de>
	<20070616223923.11729.3@cs.tu-berlin.de>
Message-ID: <3AEFDD2F-5053-4A4E-A4B5-63C01AE1FB88@foobox.com>

On Jun 16, 2007, at 1:39 PM, Ingo Weinhold wrote:
> On 2007-06-16 at 21:43:54 [+0200], geist at BerliOS  
> 
> wrote:
>> Author: geist
>> Date: 2007-06-16 21:43:53 +0200 (Sat, 16 Jun 2007)
>> New Revision: 21423
>> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21423&view=rev
>>
>> Modified:
>>    haiku/trunk/build/jam/BuildSetup
>>    haiku/trunk/build/jam/MainBuildRules
>>    haiku/trunk/src/build/libbe/app/Jamfile
>>    haiku/trunk/src/build/libbe/interface/Jamfile
>>    haiku/trunk/src/build/libbe/storage/Jamfile
>>    haiku/trunk/src/build/libbe/support/Jamfile
>> Log:
>> some make system work to get x86-64 linux compiles working:
>> -The biggest problem with linking host libraries (libbe_build and
>> libroot_build) was not having the source files compiled with the - 
>> fPIC
>> flag. As far as I can tell, we want to do this on all of the other  
>> host
>> platforms as well, so hacked the jam files a bit to add it.
>> Forgive me if I've committed more Jamfile sins.
>
> Only small ones. :-)
> I wonder, if there's any particular reason not just to add "-fPIC" to
> HOST_CCFLAGS/HOST_C++FLAGS.

Well, it'd set it for all binaries built for the host, not just  
shared libs. That may or may not cause a problem depending on the  
host platform. Since I can't test all of them, it's safe to do the  
right thing and only specify for shared libs (where it's supposed to  
be set, generally).

Travis



From bonefish at mail.berlios.de  Sun Jun 17 03:10:14 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 17 Jun 2007 03:10:14 +0200
Subject: [Haiku-commits] r21424 - haiku/trunk/headers/os/interface
Message-ID: <200706170110.l5H1AEfR005616@sheep.berlios.de>

Author: bonefish
Date: 2007-06-17 03:10:12 +0200 (Sun, 17 Jun 2007)
New Revision: 21424
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21424&view=rev

Modified:
   haiku/trunk/headers/os/interface/Size.h
Log:
Defined B_SIZE_UNSET to -2. -1 is actually a valid size, meaning 0 pixels.


Modified: haiku/trunk/headers/os/interface/Size.h
===================================================================
--- haiku/trunk/headers/os/interface/Size.h	2007-06-16 19:43:53 UTC (rev 21423)
+++ haiku/trunk/headers/os/interface/Size.h	2007-06-17 01:10:12 UTC (rev 21424)
@@ -11,7 +11,7 @@
 
 
 enum {
-	B_SIZE_UNSET		= -1,
+	B_SIZE_UNSET		= -2,
 	B_SIZE_UNLIMITED	= 1024 * 1024 * 1024,
 };
 



From bonefish at mail.berlios.de  Sun Jun 17 03:11:08 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 17 Jun 2007 03:11:08 +0200
Subject: [Haiku-commits] r21425 - haiku/trunk/src/kits/interface
Message-ID: <200706170111.l5H1B8uZ005672@sheep.berlios.de>

Author: bonefish
Date: 2007-06-17 03:11:08 +0200 (Sun, 17 Jun 2007)
New Revision: 21425
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21425&view=rev

Modified:
   haiku/trunk/src/kits/interface/CheckBox.cpp
Log:
Rather use B_SIZE_UNSET for fPreferredSize.


Modified: haiku/trunk/src/kits/interface/CheckBox.cpp
===================================================================
--- haiku/trunk/src/kits/interface/CheckBox.cpp	2007-06-17 01:10:12 UTC (rev 21424)
+++ haiku/trunk/src/kits/interface/CheckBox.cpp	2007-06-17 01:11:08 UTC (rev 21425)
@@ -18,7 +18,7 @@
 BCheckBox::BCheckBox(BRect frame, const char *name, const char *label,
 		BMessage *message, uint32 resizingMode, uint32 flags)
 	: BControl(frame, name, label, message, resizingMode, flags),
-	  fPreferredSize(-1, -1),
+	  fPreferredSize(),
 	  fOutlined(false)
 {
 	// Resize to minimum height if needed
@@ -34,7 +34,7 @@
 BCheckBox::BCheckBox(const char *name, const char *label, BMessage *message,
 	uint32 flags)
 	: BControl(name, label, message, flags | B_WILL_DRAW | B_NAVIGABLE),
-	  fPreferredSize(-1, -1),
+	  fPreferredSize(),
 	  fOutlined(false)
 {
 }
@@ -42,7 +42,7 @@
 
 BCheckBox::BCheckBox(const char *label, BMessage *message)
 	: BControl(NULL, label, message, B_WILL_DRAW | B_NAVIGABLE),
-	  fPreferredSize(-1, -1),
+	  fPreferredSize(),
 	  fOutlined(false)
 {
 }
@@ -458,7 +458,7 @@
 BCheckBox::InvalidateLayout(bool descendants)
 {
 	// invalidate cached preferred size
-	fPreferredSize.Set(-1, -1);
+	fPreferredSize.Set(B_SIZE_UNSET, B_SIZE_UNSET);
 
 	BControl::InvalidateLayout(descendants);
 }
@@ -514,7 +514,7 @@
 BSize
 BCheckBox::_ValidatePreferredSize()
 {
-	if (fPreferredSize.width < 0) {
+	if (!fPreferredSize.IsWidthSet()) {
 		font_height fontHeight;
 		GetFontHeight(&fontHeight);
 



From bonefish at mail.berlios.de  Sun Jun 17 03:15:06 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 17 Jun 2007 03:15:06 +0200
Subject: [Haiku-commits] r21426 - in haiku/trunk: headers/os/interface
	src/kits/interface
Message-ID: <200706170115.l5H1F6t5005832@sheep.berlios.de>

Author: bonefish
Date: 2007-06-17 03:15:05 +0200 (Sun, 17 Jun 2007)
New Revision: 21426
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21426&view=rev

Modified:
   haiku/trunk/headers/os/interface/Menu.h
   haiku/trunk/src/kits/interface/Menu.cpp
Log:
* Added layout-related methods (Min/Max/PreferredSize(), InvalidateLayout(),
  DoLayout()).
* Don't resize the view and the window anymore, when fResizeToFit is not
  set.


Modified: haiku/trunk/headers/os/interface/Menu.h
===================================================================
--- haiku/trunk/headers/os/interface/Menu.h	2007-06-17 01:11:08 UTC (rev 21425)
+++ haiku/trunk/headers/os/interface/Menu.h	2007-06-17 01:15:05 UTC (rev 21426)
@@ -113,11 +113,16 @@
 virtual void			MessageReceived(BMessage *msg);
 virtual	void			KeyDown(const char *bytes, int32 numBytes);
 virtual void			Draw(BRect updateRect);
+virtual	BSize			MinSize();
+virtual	BSize			MaxSize();
+virtual	BSize			PreferredSize();
 virtual void			GetPreferredSize(float *width, float *height);
 virtual void			ResizeToPreferred();
+virtual	void			DoLayout();
 virtual	void			FrameMoved(BPoint new_position);
 virtual	void			FrameResized(float new_width, float new_height);
 		void			InvalidateLayout();
+virtual	void			InvalidateLayout(bool descendants);
 	
 virtual BHandler		*ResolveSpecifier(BMessage *msg,
 										int32 index,
@@ -180,6 +185,8 @@
 friend status_t	set_menu_info(menu_info *);
 friend status_t	get_menu_info(menu_info *);
 
+struct LayoutData;
+
 virtual	void			_ReservedMenu3();
 virtual	void			_ReservedMenu4();
 virtual	void			_ReservedMenu5();
@@ -202,6 +209,7 @@
 								bool del = false);
 		bool		RelayoutIfNeeded();
 		void		LayoutItems(int32 index);
+		BSize		_ValidatePreferredSize();
 		void		ComputeLayout(int32 index, bool bestFit, bool moveItems,
 								  float* width, float* height);
 		void		_ComputeColumnLayout(int32 index, bool bestFit, bool moveItems, BRect &outRect);
@@ -292,7 +300,7 @@
 		BPoint		*fInitMatrixSize;
 		_ExtraMenuData_	*fExtraMenuData;
 
-		uint32		_reserved[1];
+		LayoutData*	fLayoutData;
 
 		int32		fSubmenus;
 

Modified: haiku/trunk/src/kits/interface/Menu.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Menu.cpp	2007-06-17 01:11:08 UTC (rev 21425)
+++ haiku/trunk/src/kits/interface/Menu.cpp	2007-06-17 01:15:05 UTC (rev 21426)
@@ -14,6 +14,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -143,6 +145,11 @@
 const char *kEmptyMenuLabel = "";
 
 
+struct BMenu::LayoutData {
+	BSize	preferred;
+};
+
+
 BMenu::BMenu(const char *name, menu_layout layout)
 	:	BView(BRect(0, 0, 0, 0), name, 0, B_WILL_DRAW),
 		fChosenItem(NULL),
@@ -220,6 +227,7 @@
 		
 	delete fInitMatrixSize;
 	delete fExtraMenuData;
+	delete fLayoutData;
 }
 
 
@@ -840,10 +848,48 @@
 }
 
 
+BSize
+BMenu::MinSize()
+{
+	_ValidatePreferredSize();
+
+	BSize size = (GetLayout() ? GetLayout()->MinSize()
+		: fLayoutData->preferred);
+	return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
+}
+
+
+BSize
+BMenu::MaxSize()
+{
+	_ValidatePreferredSize();
+
+	BSize size = (GetLayout() ? GetLayout()->MaxSize()
+		: fLayoutData->preferred);
+	return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size);
+}
+
+
+BSize
+BMenu::PreferredSize()
+{
+	_ValidatePreferredSize();
+
+	BSize size = (GetLayout() ? GetLayout()->PreferredSize()
+		: fLayoutData->preferred);
+	return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), size);
+}
+
+
 void
 BMenu::GetPreferredSize(float *_width, float *_height)
 {
-	ComputeLayout(0, true, false, _width, _height);
+	_ValidatePreferredSize();
+
+	if (_width)
+		*_width = fLayoutData->preferred.width;
+	if (_height)
+		*_height = fLayoutData->preferred.height;
 }
 
 
@@ -855,6 +901,21 @@
 
 
 void
+BMenu::DoLayout()
+{
+	// If the user set a layout, we let the base class version call its
+	// hook.
+	if (GetLayout()) {
+		BView::DoLayout();
+		return;
+	}
+
+	if (RelayoutIfNeeded())
+		Invalidate();
+}
+
+
+void
 BMenu::FrameMoved(BPoint new_position)
 {
 	BView::FrameMoved(new_position);
@@ -871,7 +932,17 @@
 void
 BMenu::InvalidateLayout()
 {
+	InvalidateLayout(false);
+}
+
+
+void
+BMenu::InvalidateLayout(bool descendants)
+{
 	fUseCachedMenuLayout = false;
+	fLayoutData->preferred.Set(B_SIZE_UNSET, B_SIZE_UNSET);
+
+	BView::InvalidateLayout(descendants);
 }
 
 
@@ -1127,10 +1198,12 @@
 	font.SetFamilyAndStyle(sMenuInfo.f_family, sMenuInfo.f_style);
 	font.SetSize(sMenuInfo.font_size);
 	SetFont(&font, B_FONT_FAMILY_AND_STYLE | B_FONT_SIZE);
-	
+
+	fLayoutData = new LayoutData;
+
 	SetLowColor(sMenuInfo.background_color);
 	SetViewColor(sMenuInfo.background_color);
-				
+
 	if (data != NULL) {
 		data->FindInt32("_layout", (int32 *)&fLayout);
 		data->FindBool("_rsize_to_fit", &fResizeToFit);
@@ -1488,10 +1561,13 @@
 		}
 	}
 
-	if (invalidateLayout && locked && window != NULL) {
-		LayoutItems(0);
-		UpdateWindowViewSize(false);
-		Invalidate();
+	if (invalidateLayout) {
+		InvalidateLayout();
+		if (locked && window != NULL) {
+			LayoutItems(0);
+			UpdateWindowViewSize(false);
+			Invalidate();
+		}
 	}
 
 	if (locked)
@@ -1522,10 +1598,21 @@
 	float width, height;
 	ComputeLayout(index, fResizeToFit, true, &width, &height);
 
-	ResizeTo(width, height);
+	if (fResizeToFit)
+		ResizeTo(width, height);
 }
 
 
+BSize
+BMenu::_ValidatePreferredSize()
+{
+	if (!fLayoutData->preferred.IsWidthSet())
+		ComputeLayout(0, true, false, NULL, NULL);
+
+	return fLayoutData->preferred;
+}
+
+
 void
 BMenu::ComputeLayout(int32 index, bool bestFit, bool moveItems,
 	float* _width, float* _height)
@@ -1552,21 +1639,28 @@
 			break;
 	}
 
-	if (_width) {
-		// change width depending on resize mode
-		if ((ResizingMode() & B_FOLLOW_LEFT_RIGHT) == B_FOLLOW_LEFT_RIGHT) {
-			if (Parent())
-				*_width = Parent()->Frame().Width() + 1;
-			else if (Window())
-				*_width = Window()->Frame().Width() + 1;
-			else
-				*_width = Bounds().Width();
-		} else
-			*_width = frame.Width();
-	}
+	// change width depending on resize mode
+	BSize size;
+	if ((ResizingMode() & B_FOLLOW_LEFT_RIGHT) == B_FOLLOW_LEFT_RIGHT) {
+		if (Parent())
+			size.width = Parent()->Frame().Width() + 1;
+		else if (Window())
+			size.width = Window()->Frame().Width() + 1;
+		else
+			size.width = Bounds().Width();
+	} else
+		size.width = frame.Width();
 
+	size.height = frame.Height();
+
+	if (_width)
+		*_width = size.width;
+
 	if (_height)
-		*_height = frame.Height();
+		*_height = size.height;
+
+	if (bestFit)
+		fLayoutData->preferred = size;
 	
 	if (moveItems)
 		fUseCachedMenuLayout = true;
@@ -2152,6 +2246,9 @@
 	if (dynamic_cast(this) != NULL)
 		return;
 
+	if (fResizeToFit)
+		return;
+
 	bool scroll;
 	const BPoint screenLocation = upWind ? ScreenLocation() : window->Frame().LeftTop();
 	BRect frame = CalcFrame(screenLocation, &scroll);



From bonefish at mail.berlios.de  Sun Jun 17 03:17:50 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 17 Jun 2007 03:17:50 +0200
Subject: [Haiku-commits] r21427 - in haiku/trunk: headers/os/interface
	src/kits/interface
Message-ID: <200706170117.l5H1HoYA005940@sheep.berlios.de>

Author: bonefish
Date: 2007-06-17 03:17:49 +0200 (Sun, 17 Jun 2007)
New Revision: 21427
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21427&view=rev

Modified:
   haiku/trunk/headers/os/interface/MenuBar.h
   haiku/trunk/src/kits/interface/MenuBar.cpp
Log:
* Added layout-friendly constructor.
* Fixed invalidation in FrameResized().


Modified: haiku/trunk/headers/os/interface/MenuBar.h
===================================================================
--- haiku/trunk/headers/os/interface/MenuBar.h	2007-06-17 01:15:05 UTC (rev 21426)
+++ haiku/trunk/headers/os/interface/MenuBar.h	2007-06-17 01:17:49 UTC (rev 21427)
@@ -36,12 +36,15 @@
 class BMenuBar : public BMenu
 {
 public:
-							BMenuBar(	BRect frame,
-										const char *title,
-										uint32 resizeMask =
-											B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
-										menu_layout layout = B_ITEMS_IN_ROW,
-										bool resizeToFit = true);
+							BMenuBar(BRect frame,
+								const char *title,
+								uint32 resizeMask =
+									B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
+								menu_layout layout = B_ITEMS_IN_ROW,
+								bool resizeToFit = true);
+							BMenuBar(const char *title,
+								menu_layout layout = B_ITEMS_IN_ROW,
+								uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS);
 							BMenuBar(BMessage *data);
 	virtual					~BMenuBar();
 	static	BArchivable		*Instantiate(BMessage *data);

Modified: haiku/trunk/src/kits/interface/MenuBar.cpp
===================================================================
--- haiku/trunk/src/kits/interface/MenuBar.cpp	2007-06-17 01:15:05 UTC (rev 21426)
+++ haiku/trunk/src/kits/interface/MenuBar.cpp	2007-06-17 01:17:49 UTC (rev 21427)
@@ -51,6 +51,21 @@
 }
 
 
+BMenuBar::BMenuBar(const char *title, menu_layout layout, uint32 flags)
+	: BMenu(BRect(), title, B_FOLLOW_NONE,
+		flags | B_WILL_DRAW | B_FRAME_EVENTS | B_SUPPORTS_LAYOUT,
+		layout, false),
+	fBorder(B_BORDER_FRAME),
+	fTrackingPID(-1),
+	fPrevFocusToken(-1),
+	fMenuSem(-1),
+	fLastBounds(NULL),
+	fTracking(false)
+{
+	InitData(layout);
+}
+
+
 BMenuBar::BMenuBar(BMessage *data)
 	: BMenu(data),
 	fBorder(B_BORDER_FRAME),
@@ -222,11 +237,21 @@
 void 
 BMenuBar::FrameResized(float newWidth, float newHeight)
 {
-	BRect bounds(Bounds());
-	BRect rect(fLastBounds->right - 12, fLastBounds->top, bounds.right, bounds.bottom);
+	// invalidate right border
+	if (newWidth != fLastBounds->Width()) {
+		BRect rect(min_c(fLastBounds->right, newWidth), 0,
+			max_c(fLastBounds->right, newWidth), newHeight);
+		Invalidate(rect);
+	}
+
+	// invalidate bottom border
+	if (newHeight != fLastBounds->Height()) {
+		BRect rect(0, min_c(fLastBounds->bottom, newHeight) - 1,
+			newWidth, max_c(fLastBounds->bottom, newHeight));
+		Invalidate(rect);
+	}
+
 	fLastBounds->Set(0, 0, newWidth, newHeight);
-	
-	Invalidate(rect);
 
 	BMenu::FrameResized(newWidth, newHeight);
 }



From bonefish at mail.berlios.de  Sun Jun 17 03:18:35 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 17 Jun 2007 03:18:35 +0200
Subject: [Haiku-commits] r21428 -
	haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests
Message-ID: <200706170118.l5H1IZkP006073@sheep.berlios.de>

Author: bonefish
Date: 2007-06-17 03:18:34 +0200 (Sun, 17 Jun 2007)
New Revision: 21428
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21428&view=rev

Modified:
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.cpp
Log:
Use layout-friendly constructor.


Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.cpp	2007-06-17 01:17:49 UTC (rev 21427)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/ListViewTest.cpp	2007-06-17 01:18:34 UTC (rev 21428)
@@ -11,11 +11,11 @@
 
 ListViewTest::ListViewTest()
 	: Test("ListView", NULL),
-	  fListView(new BListView(BRect(0, 0, -1, -1), NULL))
+	  fListView(new BListView())
 {
 	SetView(fListView);
 
-	// add a view items
+	// add a few items
 	for (int32 i = 0; i < 15; i++) {
 		BString itemText("list item ");
 		itemText << i;



From bonefish at mail.berlios.de  Sun Jun 17 03:21:20 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 17 Jun 2007 03:21:20 +0200
Subject: [Haiku-commits] r21429 - in
	haiku/trunk/src/tests/kits/interface/layout/widget_layout_test:
	. tests
Message-ID: <200706170121.l5H1LK2Q006225@sheep.berlios.de>

Author: bonefish
Date: 2007-06-17 03:21:19 +0200 (Sun, 17 Jun 2007)
New Revision: 21429
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21429&view=rev

Added:
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuBarTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuBarTest.h
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuTest.cpp
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuTest.h
Modified:
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile
   haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp
Log:
Added tests for BMenu and BMenuBar. The former is pretty useless, though,
since the menu resizes the window to an unusable size.


Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile	2007-06-17 01:18:34 UTC (rev 21428)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile	2007-06-17 01:21:19 UTC (rev 21429)
@@ -24,6 +24,8 @@
 	CheckBoxTest.cpp
 	ControlTest.cpp
 	ListViewTest.cpp
+	MenuBarTest.cpp
+	MenuTest.cpp
 	:
 	be
 ;

Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp	2007-06-17 01:18:34 UTC (rev 21428)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp	2007-06-17 01:21:19 UTC (rev 21429)
@@ -14,6 +14,8 @@
 #include "CheckBoxTest.h"
 #include "GroupView.h"
 #include "ListViewTest.h"
+#include "MenuBarTest.h"
+#include "MenuTest.h"
 #include "StringView.h"
 #include "Test.h"
 #include "TwoDimensionalSliderView.h"
@@ -39,6 +41,8 @@
 	{ "BButton",		ButtonTest::CreateTest },
 	{ "BCheckBox",		CheckBoxTest::CreateTest },
 	{ "BListView",		ListViewTest::CreateTest },
+	{ "BMenu",			MenuTest::CreateTest },
+	{ "BMenuBar",		MenuBarTest::CreateTest },
 	{ NULL, NULL }
 };
 

Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuBarTest.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuBarTest.cpp	2007-06-17 01:18:34 UTC (rev 21428)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuBarTest.cpp	2007-06-17 01:21:19 UTC (rev 21429)
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2007, Ingo Weinhold .
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+
+#include "MenuBarTest.h"
+
+#include 
+#include 
+#include 
+
+#include "CheckBox.h"
+
+
+enum {
+	MSG_THIRD_ITEM			= '3rdi',
+	MSG_CHANGE_ITEM_TEXT	= 'chit'
+};
+
+
+MenuBarTest::MenuBarTest()
+	: Test("MenuBar", NULL),
+	  fMenuBar(new BMenuBar("The Menu"))
+
+{
+	SetView(fMenuBar);
+
+	// add a few items
+	fMenuBar->AddItem(fFirstItem = new BMenuItem("Menu item 1", NULL));
+	fMenuBar->AddItem(new BMenuItem("Menu item 2", NULL));
+	fThirdItem = new BMenuItem("Menu item 3", NULL);
+}
+
+
+Test*
+MenuBarTest::CreateTest()
+{
+	return new MenuBarTest;
+}
+
+
+// ActivateTest
+void
+MenuBarTest::ActivateTest(View* controls)
+{
+	GroupView* group = new GroupView(B_VERTICAL);
+	group->SetFrame(controls->Bounds());
+	group->SetSpacing(0, 8);
+	controls->AddChild(group);
+
+	// third item
+	fThirdItemCheckBox = new LabeledCheckBox("Third item",
+		new BMessage(MSG_THIRD_ITEM), this);
+	group->AddChild(fThirdItemCheckBox);
+
+	// long text
+	fLongTextCheckBox = new LabeledCheckBox("Long label text",
+		new BMessage(MSG_CHANGE_ITEM_TEXT), this);
+	group->AddChild(fLongTextCheckBox);
+
+	group->AddChild(new Glue());
+
+	UpdateThirdItem();
+	UpdateLongText();
+}
+
+
+// DectivateTest
+void
+MenuBarTest::DectivateTest()
+{
+}
+
+
+// MessageReceived
+void
+MenuBarTest::MessageReceived(BMessage* message)
+{
+	switch (message->what) {
+		case MSG_THIRD_ITEM:
+			UpdateThirdItem();
+			break;
+		case MSG_CHANGE_ITEM_TEXT:
+			UpdateLongText();
+			break;
+		default:
+			Test::MessageReceived(message);
+			break;
+	}
+}
+
+
+// UpdateThirdItem
+void
+MenuBarTest::UpdateThirdItem()
+{
+	if (!fThirdItemCheckBox || !fMenuBar)
+		return;
+
+	if (fThirdItemCheckBox->IsSelected() == (fThirdItem->Menu() != NULL))
+		return;
+
+	if (fThirdItemCheckBox->IsSelected())
+		fMenuBar->AddItem(fThirdItem);
+	else
+		fMenuBar->RemoveItem(fThirdItem);
+}
+
+
+// 	UpdateLongText
+void
+MenuBarTest::UpdateLongText()
+{
+	if (!fLongTextCheckBox || !fMenuBar)
+		return;
+
+	fFirstItem->SetLabel(fLongTextCheckBox->IsSelected()
+		? "Very long text for a menu item"
+		: "Menu item 1");
+}

Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuBarTest.h
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuBarTest.h	2007-06-17 01:18:34 UTC (rev 21428)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuBarTest.h	2007-06-17 01:21:19 UTC (rev 21429)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2007, Ingo Weinhold .
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+#ifndef WIDGET_LAYOUT_TEST_MENU_BAR_TEST_H
+#define WIDGET_LAYOUT_TEST_MENU_BAR_TEST_H
+
+
+#include "Test.h"
+
+
+class BMenuBar;
+class BMenuItem;
+class LabeledCheckBox;
+
+
+class MenuBarTest : public Test {
+public:
+								MenuBarTest();
+
+	static	Test*				CreateTest();
+
+	virtual	void				ActivateTest(View* controls);
+	virtual	void				DectivateTest();
+
+	virtual	void				MessageReceived(BMessage* message);
+
+private:
+			void				UpdateThirdItem();
+			void				UpdateLongText();
+
+private:
+			BMenuBar*			fMenuBar;
+			BMenuItem*			fFirstItem;
+			BMenuItem*			fThirdItem;
+			LabeledCheckBox*	fThirdItemCheckBox;
+			LabeledCheckBox*	fLongTextCheckBox;
+};
+
+
+#endif	// WIDGET_LAYOUT_TEST_MENU_BAR_TEST_H

Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuTest.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuTest.cpp	2007-06-17 01:18:34 UTC (rev 21428)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuTest.cpp	2007-06-17 01:21:19 UTC (rev 21429)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2007, Ingo Weinhold .
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+
+#include "MenuTest.h"
+
+#include 
+#include 
+
+class TestMenu : public BMenu {
+public:
+	TestMenu(const char* title)
+		: BMenu(BRect(), title, B_FOLLOW_NONE,
+		B_WILL_DRAW | B_FRAME_EVENTS | B_SUPPORTS_LAYOUT,
+		B_ITEMS_IN_COLUMN, false)
+	{
+	}
+};
+
+
+MenuTest::MenuTest()
+	: Test("Menu", NULL),
+	  fMenu(new TestMenu("The Menu"))
+{
+	SetView(fMenu);
+
+	// add a few items
+	for (int32 i = 0; i < 15; i++) {
+		BString itemText("menu item ");
+		itemText << i;
+		fMenu->AddItem(new BMenuItem(itemText.String(), NULL));
+	}
+}
+
+
+Test*
+MenuTest::CreateTest()
+{
+	return new MenuTest;
+}
+
+

Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuTest.h
===================================================================
--- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuTest.h	2007-06-17 01:18:34 UTC (rev 21428)
+++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuTest.h	2007-06-17 01:21:19 UTC (rev 21429)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2007, Ingo Weinhold .
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+#ifndef WIDGET_LAYOUT_TEST_MENU_TEST_H
+#define WIDGET_LAYOUT_TEST_MENU_TEST_H
+
+
+#include "Test.h"
+
+
+class BMenu;
+
+
+class MenuTest : public Test {
+public:
+								MenuTest();
+
+	static	Test*				CreateTest();
+
+private:
+			BMenu*				fMenu;
+};
+
+
+#endif	// WIDGET_LAYOUT_TEST_LIST_VIEW_TEST_H



From korli at mail.berlios.de  Sun Jun 17 12:50:27 2007
From: korli at mail.berlios.de (korli at BerliOS)
Date: Sun, 17 Jun 2007 12:50:27 +0200
Subject: [Haiku-commits] r21430 - in haiku/trunk:
	headers/build/private/interface headers/private/fs_shell
	src/build/libbe/interface src/build/libroot src/tools/fs_shell
Message-ID: <200706171050.l5HAoRXK017040@sheep.berlios.de>

Author: korli
Date: 2007-06-17 12:50:18 +0200 (Sun, 17 Jun 2007)
New Revision: 21430
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21430&view=rev

Modified:
   haiku/trunk/headers/build/private/interface/RegionSupport.h
   haiku/trunk/headers/private/fs_shell/fssh_atomic.h
   haiku/trunk/headers/private/fs_shell/fssh_types.h
   haiku/trunk/src/build/libbe/interface/RegionSupport.cpp
   haiku/trunk/src/build/libroot/atomic.cpp
   haiku/trunk/src/tools/fs_shell/atomic.cpp
   haiku/trunk/src/tools/fs_shell/vfs.cpp
Log:
x86_64 changes : 
added atomic*64() functions
use int32 instead of long


Modified: haiku/trunk/headers/build/private/interface/RegionSupport.h
===================================================================
--- haiku/trunk/headers/build/private/interface/RegionSupport.h	2007-06-17 01:21:19 UTC (rev 21429)
+++ haiku/trunk/headers/build/private/interface/RegionSupport.h	2007-06-17 10:50:18 UTC (rev 21430)
@@ -20,7 +20,7 @@
 	static void CleanupRegionHorizontal(BRegion ®ion);
 	
 	static void SortRects(clipping_rect *rects, long count);
-	static void SortTrans(long *lptr1, long *lptr2, long count);	
+	static void SortTrans(int32 *lptr1, int32 *lptr2, long count);	
 	
 	static void CopyRegionMore(const BRegion &, BRegion &, long);
 	

Modified: haiku/trunk/headers/private/fs_shell/fssh_atomic.h
===================================================================
--- haiku/trunk/headers/private/fs_shell/fssh_atomic.h	2007-06-17 01:21:19 UTC (rev 21429)
+++ haiku/trunk/headers/private/fs_shell/fssh_atomic.h	2007-06-17 10:50:18 UTC (rev 21430)
@@ -23,6 +23,13 @@
 int32_t	fssh_atomic_or(vint32_t *value, int32_t orValue);	
 int32_t	fssh_atomic_get(vint32_t *value);
 
+int64_t	fssh_atomic_set64(vint64_t *value, int64_t newValue);
+int64_t	fssh_atomic_test_and_set64(vint64_t *value, int64_t newValue,
+			int64_t testAgainst);
+int64_t	fssh_atomic_add64(vint64_t *value, int64_t addValue);
+int64_t	fssh_atomic_and64(vint64_t *value, int64_t andValue);
+int64_t	fssh_atomic_or64(vint64_t *value, int64_t orValue);	
+int64_t	fssh_atomic_get64(vint64_t *value);
 
 #ifdef __cplusplus
 }

Modified: haiku/trunk/headers/private/fs_shell/fssh_types.h
===================================================================
--- haiku/trunk/headers/private/fs_shell/fssh_types.h	2007-06-17 01:21:19 UTC (rev 21429)
+++ haiku/trunk/headers/private/fs_shell/fssh_types.h	2007-06-17 10:50:18 UTC (rev 21430)
@@ -5,8 +5,13 @@
 
 typedef uint32_t			fssh_ulong;
 typedef volatile int32_t	vint32_t;
+typedef volatile int64_t	vint64_t;
 
+#ifdef __x86_64__
+typedef uint64_t	fssh_addr_t;
+#else
 typedef uint32_t	fssh_addr_t;
+#endif
 
 typedef int32_t		fssh_dev_t;
 typedef int64_t		fssh_ino_t;

Modified: haiku/trunk/src/build/libbe/interface/RegionSupport.cpp
===================================================================
--- haiku/trunk/src/build/libbe/interface/RegionSupport.cpp	2007-06-17 01:21:19 UTC (rev 21429)
+++ haiku/trunk/src/build/libbe/interface/RegionSupport.cpp	2007-06-17 10:50:18 UTC (rev 21430)
@@ -351,7 +351,7 @@
 
 // Helper methods to swap transition points in two given arrays
 static inline void
-SwapTrans(long *leftPoints, long *rightPoints, long index1, long index2)
+SwapTrans(int32 *leftPoints, int32 *rightPoints, long index1, long index2)
 {
 	// First, swap the left points
 	long tmp = leftPoints[index1];
@@ -366,7 +366,7 @@
 
 
 void
-BRegion::Support::SortTrans(long *lptr1, long *lptr2, long count)
+BRegion::Support::SortTrans(int32 *lptr1, int32 *lptr2, long count)
 {
 	CALLED();
 	
@@ -779,9 +779,9 @@
 	// TODO: Find a better name for this function
 */
 static void
-InvertRectangles(long *lefts, long *rights, long count)
+InvertRectangles(int32 *lefts, int32 *rights, long count)
 {
-	long tmpLeft, tmpRight = kMaxNegative;
+	int32 tmpLeft, tmpRight = kMaxNegative;
 	
 	for (int i = 0; i <= count; i++) {	
 		tmpLeft = lefts[i] - 1;

Modified: haiku/trunk/src/build/libroot/atomic.cpp
===================================================================
--- haiku/trunk/src/build/libroot/atomic.cpp	2007-06-17 01:21:19 UTC (rev 21429)
+++ haiku/trunk/src/build/libroot/atomic.cpp	2007-06-17 10:50:18 UTC (rev 21430)
@@ -57,3 +57,52 @@
 {
 	return *value;
 }
+
+
+int64
+atomic_set64(vint64 *value, int64 newValue)
+{
+	int64 oldValue = *value;
+	*value = newValue;
+	return oldValue;
+}
+
+int64
+atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst)
+{
+	int64 oldValue = *value;
+	if (oldValue == testAgainst)
+		*value = newValue;
+	return oldValue;
+}
+
+int64
+atomic_add64(vint64 *value, int64 addValue)
+{
+	int64 oldValue = *value;
+	*value += addValue;
+	return oldValue;
+}
+
+int64
+atomic_and64(vint64 *value, int64 andValue)
+{
+	int64 oldValue = *value;
+	*value &= andValue;
+	return oldValue;
+}
+
+int64
+atomic_or64(vint64 *value, int64 orValue)
+{
+	int64 oldValue = *value;
+	*value |= orValue;
+	return oldValue;
+}
+
+int64
+atomic_get64(vint64 *value)
+{
+	return *value;
+}
+

Modified: haiku/trunk/src/tools/fs_shell/atomic.cpp
===================================================================
--- haiku/trunk/src/tools/fs_shell/atomic.cpp	2007-06-17 01:21:19 UTC (rev 21429)
+++ haiku/trunk/src/tools/fs_shell/atomic.cpp	2007-06-17 10:50:18 UTC (rev 21430)
@@ -50,3 +50,46 @@
 {
 	return atomic_get((vint32*)value);
 }
+
+
+int64_t
+fssh_atomic_set64(vint64_t *value, int64_t newValue)
+{
+	return atomic_set64((vint64*)value, newValue);
+}
+
+
+int64_t
+fssh_atomic_test_and_set64(vint64_t *value, int64_t newValue, int64_t testAgainst)
+{
+	return atomic_test_and_set64((vint64 *)value, newValue, testAgainst);
+}
+
+
+int64_t
+fssh_atomic_add64(vint64_t *value, int64_t addValue)
+{
+	return atomic_add64((vint64*)value, addValue);
+}
+
+
+int64_t
+fssh_atomic_and64(vint64_t *value, int64_t andValue)
+{
+	return atomic_and64((vint64*)value, andValue);
+}
+
+
+int64_t
+fssh_atomic_or64(vint64_t *value, int64_t orValue)	
+{
+	return atomic_or64((vint64*)value, orValue);
+}
+
+
+int64_t
+fssh_atomic_get64(vint64_t *value)
+{
+	return atomic_get64((vint64*)value);
+}
+

Modified: haiku/trunk/src/tools/fs_shell/vfs.cpp
===================================================================
--- haiku/trunk/src/tools/fs_shell/vfs.cpp	2007-06-17 01:21:19 UTC (rev 21429)
+++ haiku/trunk/src/tools/fs_shell/vfs.cpp	2007-06-17 10:50:18 UTC (rev 21430)
@@ -3222,8 +3222,13 @@
 
 	// We need to set the locking atomically - someone
 	// else might set one at the same time
+#ifdef __x86_64__
+	if (fssh_atomic_test_and_set64((vint64_t *)&vnode->mandatory_locked_by,
+			0, (fssh_addr_t)descriptor) != (int64_t)descriptor)
+#else
 	if (fssh_atomic_test_and_set((vint32_t *)&vnode->mandatory_locked_by,
 			0, (fssh_addr_t)descriptor) != (int32_t)descriptor)
+#endif
 		status = FSSH_B_BAD_VALUE;
 
 	put_fd(descriptor);



From bonefish at cs.tu-berlin.de  Sun Jun 17 13:12:18 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sun, 17 Jun 2007 13:12:18 +0200
Subject: [Haiku-commits] r21426 - in haiku/trunk: headers/os/interface
 src/kits/interface
In-Reply-To: <200706170115.l5H1F6t5005832@sheep.berlios.de>
References: <200706170115.l5H1F6t5005832@sheep.berlios.de>
Message-ID: <20070617131218.743.1@cs.tu-berlin.de>


On 2007-06-17 at 03:15:06 [+0200], bonefish at BerliOS 
 wrote:
> Author: bonefish
> Date: 2007-06-17 03:15:05 +0200 (Sun, 17 Jun 2007)
> New Revision: 21426
> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21426&view=rev
> 
> Modified:
>    haiku/trunk/headers/os/interface/Menu.h
>    haiku/trunk/src/kits/interface/Menu.cpp
> Log:
> * Added layout-related methods (Min/Max/PreferredSize(), InvalidateLayout(),
>   DoLayout()).
> * Don't resize the view and the window anymore, when fResizeToFit is not
>   set.

As a side note, due to binary compatibility restrictions, the BMenu/BMenuItem 
layouting can't be implemented as it should be. Ideally BMenuItem would 
derive from BLayoutItem and BMenu would use BLayout subclasses to layout the 
items.

CU, Ingo


From bonefish at cs.tu-berlin.de  Sun Jun 17 13:21:14 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sun, 17 Jun 2007 13:21:14 +0200
Subject: [Haiku-commits] r21430 - in haiku/trunk:
 headers/build/private/interface headers/private/fs_shell
 src/build/libbe/interface src/build/libroot src/tools/fs_shell
In-Reply-To: <200706171050.l5HAoRXK017040@sheep.berlios.de>
References: <200706171050.l5HAoRXK017040@sheep.berlios.de>
Message-ID: <20070617132114.850.2@cs.tu-berlin.de>


On 2007-06-17 at 12:50:27 [+0200], korli at BerliOS  
wrote:
> Author: korli
> Date: 2007-06-17 12:50:18 +0200 (Sun, 17 Jun 2007)
> New Revision: 21430
> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21430&view=rev
> 
> Modified:
>    haiku/trunk/headers/build/private/interface/RegionSupport.h
>    haiku/trunk/headers/private/fs_shell/fssh_atomic.h
>    haiku/trunk/headers/private/fs_shell/fssh_types.h
>    haiku/trunk/src/build/libbe/interface/RegionSupport.cpp
>    haiku/trunk/src/build/libroot/atomic.cpp
>    haiku/trunk/src/tools/fs_shell/atomic.cpp
>    haiku/trunk/src/tools/fs_shell/vfs.cpp
> Log:
> x86_64 changes :
> added atomic*64() functions
> use int32 instead of long
[...]
> Modified: haiku/trunk/headers/private/fs_shell/fssh_types.h
> ===================================================================
> --- haiku/trunk/headers/private/fs_shell/fssh_types.h    2007-06-17 
> 01:21:19 UTC (rev 21429)
> +++ haiku/trunk/headers/private/fs_shell/fssh_types.h    2007-06-17 
> 10:50:18 UTC (rev 21430)
> @@ -5,8 +5,13 @@
>  
>  typedef uint32_t            fssh_ulong;
>  typedef volatile int32_t    vint32_t;
> +typedef volatile int64_t    vint64_t;
>  
> +#ifdef __x86_64__
> +typedef uint64_t    fssh_addr_t;
> +#else
>  typedef uint32_t    fssh_addr_t;
> +#endif
>  
>  typedef int32_t        fssh_dev_t;
>  typedef int64_t        fssh_ino_t;

Since those changes seem to be pretty generic for 64 bit architectures, could 
you please introduce a macro like HAIKU_HOST_PLATFORM_64_BIT in 
BeOSBuildCompatibility.h and use that in the code instead.


> Modified: haiku/trunk/src/tools/fs_shell/vfs.cpp
> ===================================================================
> --- haiku/trunk/src/tools/fs_shell/vfs.cpp    2007-06-17 01:21:19 UTC (rev 
> 21429)
> +++ haiku/trunk/src/tools/fs_shell/vfs.cpp    2007-06-17 10:50:18 UTC (rev 
> 21430)
> @@ -3222,8 +3222,13 @@
>  
>      // We need to set the locking atomically - someone
>      // else might set one at the same time
> +#ifdef __x86_64__
> +    if (fssh_atomic_test_and_set64((vint64_t *)&vnode->mandatory_locked_by,
> +            0, (fssh_addr_t)descriptor) != (int64_t)descriptor)
> +#else
>      if (fssh_atomic_test_and_set((vint32_t *)&vnode->mandatory_locked_by,
>              0, (fssh_addr_t)descriptor) != (int32_t)descriptor)
> +#endif
>          status = FSSH_B_BAD_VALUE;
>  
>      put_fd(descriptor);

You missed a similar occurrence in common_lock_node().

CU, Ingo


From korli at mail.berlios.de  Sun Jun 17 13:51:50 2007
From: korli at mail.berlios.de (korli at BerliOS)
Date: Sun, 17 Jun 2007 13:51:50 +0200
Subject: [Haiku-commits] r21431 - in haiku/trunk: headers/build
	src/tools/fs_shell
Message-ID: <200706171151.l5HBpoYj004420@sheep.berlios.de>

Author: korli
Date: 2007-06-17 13:51:49 +0200 (Sun, 17 Jun 2007)
New Revision: 21431
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21431&view=rev

Modified:
   haiku/trunk/headers/build/BeOSBuildCompatibility.h
   haiku/trunk/src/tools/fs_shell/vfs.cpp
Log:
followed Ingo's suggestion and introduced HAIKU_HOST_PLATFORM_64_BIT macro


Modified: haiku/trunk/headers/build/BeOSBuildCompatibility.h
===================================================================
--- haiku/trunk/headers/build/BeOSBuildCompatibility.h	2007-06-17 10:50:18 UTC (rev 21430)
+++ haiku/trunk/headers/build/BeOSBuildCompatibility.h	2007-06-17 11:51:49 UTC (rev 21431)
@@ -8,6 +8,10 @@
 #include 
 #include 
 
+#ifdef __x86_64__
+#define HAIKU_HOST_PLATFORM_64_BIT
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif

Modified: haiku/trunk/src/tools/fs_shell/vfs.cpp
===================================================================
--- haiku/trunk/src/tools/fs_shell/vfs.cpp	2007-06-17 10:50:18 UTC (rev 21430)
+++ haiku/trunk/src/tools/fs_shell/vfs.cpp	2007-06-17 11:51:49 UTC (rev 21431)
@@ -3199,8 +3199,13 @@
 
 	// We need to set the locking atomically - someone
 	// else might set one at the same time
+#ifdef HAIKU_HOST_PLATFORM_64_BIT
+	if (fssh_atomic_test_and_set64((vint64_t *)&vnode->mandatory_locked_by,
+			(fssh_addr_t)descriptor, 0) != 0)
+#else
 	if (fssh_atomic_test_and_set((vint32_t *)&vnode->mandatory_locked_by,
 			(fssh_addr_t)descriptor, 0) != 0)
+#endif
 		status = FSSH_B_BUSY;
 
 	put_fd(descriptor);
@@ -3222,7 +3227,7 @@
 
 	// We need to set the locking atomically - someone
 	// else might set one at the same time
-#ifdef __x86_64__
+#ifdef HAIKU_HOST_PLATFORM_64_BIT
 	if (fssh_atomic_test_and_set64((vint64_t *)&vnode->mandatory_locked_by,
 			0, (fssh_addr_t)descriptor) != (int64_t)descriptor)
 #else



From korli at users.berlios.de  Sun Jun 17 13:53:46 2007
From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=)
Date: Sun, 17 Jun 2007 13:53:46 +0200
Subject: [Haiku-commits] r21430 - in haiku/trunk:
	headers/build/private/interface headers/private/fs_shell
	src/build/libbe/interface src/build/libroot src/tools/fs_shell
In-Reply-To: <20070617132114.850.2@cs.tu-berlin.de>
References: <200706171050.l5HAoRXK017040@sheep.berlios.de>
	<20070617132114.850.2@cs.tu-berlin.de>
Message-ID: 

Hi Ingo,

2007/6/17, Ingo Weinhold :
>
>
> Since those changes seem to be pretty generic for 64 bit architectures,
> could
> you please introduce a macro like HAIKU_HOST_PLATFORM_64_BIT in
> BeOSBuildCompatibility.h and use that in the code instead.


I just committed a change to follow your suggestion.


> Modified: haiku/trunk/src/tools/fs_shell/vfs.cpp
>
> You missed a similar occurrence in common_lock_node().


Thanks, I didn't notice.

Bye,
J?r?me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From korli at mail.berlios.de  Sun Jun 17 13:57:25 2007
From: korli at mail.berlios.de (korli at BerliOS)
Date: Sun, 17 Jun 2007 13:57:25 +0200
Subject: [Haiku-commits] r21432 - haiku/trunk/src/tools/fs_shell
Message-ID: <200706171157.l5HBvPp7004753@sheep.berlios.de>

Author: korli
Date: 2007-06-17 13:57:25 +0200 (Sun, 17 Jun 2007)
New Revision: 21432
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21432&view=rev

Modified:
   haiku/trunk/src/tools/fs_shell/block_cache.cpp
Log:
replaced uint32_t by fssh_addr_t. Obviously, the cookie should be managed differently.


Modified: haiku/trunk/src/tools/fs_shell/block_cache.cpp
===================================================================
--- haiku/trunk/src/tools/fs_shell/block_cache.cpp	2007-06-17 11:51:49 UTC (rev 21431)
+++ haiku/trunk/src/tools/fs_shell/block_cache.cpp	2007-06-17 11:57:25 UTC (rev 21432)
@@ -951,7 +951,7 @@
 	if (_unchangedData)
 		*_unchangedData = block->original_data;
 
-	*_cookie = (uint32_t)block;
+	*_cookie = (fssh_addr_t)block;
 	return FSSH_B_OK;	
 }
 



From korli at mail.berlios.de  Sun Jun 17 14:15:30 2007
From: korli at mail.berlios.de (korli at BerliOS)
Date: Sun, 17 Jun 2007 14:15:30 +0200
Subject: [Haiku-commits] r21433 -
	haiku/trunk/src/add-ons/translators/wonderbrush/support
Message-ID: <200706171215.l5HCFUmP006369@sheep.berlios.de>

Author: korli
Date: 2007-06-17 14:15:30 +0200 (Sun, 17 Jun 2007)
New Revision: 21433
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21433&view=rev

Modified:
   haiku/trunk/src/add-ons/translators/wonderbrush/support/support.h
Log:
we use C for the ppc build


Modified: haiku/trunk/src/add-ons/translators/wonderbrush/support/support.h
===================================================================
--- haiku/trunk/src/add-ons/translators/wonderbrush/support/support.h	2007-06-17 11:57:25 UTC (rev 21432)
+++ haiku/trunk/src/add-ons/translators/wonderbrush/support/support.h	2007-06-17 12:15:30 UTC (rev 21433)
@@ -21,6 +21,8 @@
 		value = max;
 }
 
+#ifdef __INTEL__
+
 // constrain_int32_0_255_asm
 inline int32
 constrain_int32_0_255_asm(int32 value) {
@@ -36,14 +38,20 @@
 	return value;
 }
 
+#define constrain_int32_0_255 constrain_int32_0_255_asm
+
+#else
+
 inline int32
 constrain_int32_0_255_c(int32 value)
 {
 	return max_c(0, min_c(255, value));
 }
 
-#define constrain_int32_0_255 constrain_int32_0_255_asm
+#define constrain_int32_0_255 constrain_int32_0_255_c
 
+#endif
+
 // rect_to_int
 inline void
 rect_to_int(BRect r,



From marcusoverhagen at mail.berlios.de  Sun Jun 17 14:44:34 2007
From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS)
Date: Sun, 17 Jun 2007 14:44:34 +0200
Subject: [Haiku-commits] r21434 -
	haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML
Message-ID: <200706171244.l5HCiYsg008934@sheep.berlios.de>

Author: marcusoverhagen
Date: 2007-06-17 14:44:33 +0200 (Sun, 17 Jun 2007)
New Revision: 21434
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21434&view=rev

Modified:
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp
Log:
Added an additional check before calculating maxsize to avoid overflows.
Ignore empty 'strn' chunks instead of treating them as an error. This
also fixes loading of the "The party at the end of the earth.divx" file.


Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp	2007-06-17 12:15:30 UTC (rev 21433)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp	2007-06-17 12:44:33 UTC (rev 21434)
@@ -383,6 +383,11 @@
 		pos += 4;
 		Chunksize = AVI_UINT32(dword);
 
+		if (pos > end) {
+			ERROR("OpenDMLParser::ParseChunk_AVI: error parsing chunk '"FOURCC_FORMAT"'\n", FOURCC_PARAM(Chunkfcc));
+			return B_ERROR;
+		}
+
 		uint32 maxsize = end - pos;
 
 		TRACE("OpenDMLParser::ParseChunk_AVI: chunk '"FOURCC_FORMAT"', size = %lu, maxsize %lu\n", FOURCC_PARAM(Chunkfcc), Chunksize, maxsize);
@@ -811,21 +816,26 @@
 		}
 		pos += 4;
 		Chunksize = AVI_UINT32(dword);
-		
+
+		if (pos > end) {
+			ERROR("OpenDMLParser::ParseList_generic: error parsing chunk '"FOURCC_FORMAT"'\n", FOURCC_PARAM(Chunkfcc));
+			return B_ERROR;
+		}
+
 		uint32 maxsize = end - pos;
 
 		TRACE("OpenDMLParser::ParseList_generic: chunk '"FOURCC_FORMAT"', size = %lu, maxsize = %lu\n", FOURCC_PARAM(Chunkfcc), Chunksize, maxsize);
 
-		if (Chunksize == 0) {
-			ERROR("OpenDMLParser::ParseList_generic: chunk '"FOURCC_FORMAT"' has size 0\n", FOURCC_PARAM(Chunkfcc));
-			return B_ERROR;
-		}
-
 		if (Chunksize > maxsize) {
 			TRACE("OpenDMLParser::ParseList_generic: chunk '"FOURCC_FORMAT"', size = %lu too big, truncated to %lu\n", FOURCC_PARAM(Chunkfcc), Chunksize, maxsize);
 			Chunksize = maxsize;
 		}
 
+		if (Chunksize == 0) {
+			ERROR("OpenDMLParser::ParseList_generic: ignoring chunk '"FOURCC_FORMAT"' with size 0\n", FOURCC_PARAM(Chunkfcc));
+			return B_OK;
+		}
+
 		if (Chunkfcc == FOURCC('a','v','i','h')) {
 			if (ParseChunk_avih(pos, Chunksize) < B_OK)
 				return B_ERROR;



From marcusoverhagen at mail.berlios.de  Sun Jun 17 14:55:46 2007
From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS)
Date: Sun, 17 Jun 2007 14:55:46 +0200
Subject: [Haiku-commits] r21435 -
	haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML
Message-ID: <200706171255.l5HCtk5F010207@sheep.berlios.de>

Author: marcusoverhagen
Date: 2007-06-17 14:55:46 +0200 (Sun, 17 Jun 2007)
New Revision: 21435
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21435&view=rev

Modified:
   haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp
Log:
truncate chunks first and then check for zero size 


Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp	2007-06-17 12:44:33 UTC (rev 21434)
+++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp	2007-06-17 12:55:46 UTC (rev 21435)
@@ -296,16 +296,16 @@
 
 		TRACE("OpenDMLParser::Parse: chunk '"FOURCC_FORMAT"', size = %lu, maxsize %Ld\n", FOURCC_PARAM(fourcc), size, maxsize);
 
-		if (size == 0) {
-			ERROR("OpenDMLParser::Parse: Error: chunk of size 0 found\n");
-			return B_ERROR;
-		}
-	
 		if (size > maxsize) {
 			ERROR("OpenDMLParser::Parse: Warning chunk '"FOURCC_FORMAT"', size = %lu extends beyond end of file\n", FOURCC_PARAM(fourcc), size);
 			ERROR("OpenDMLParser::Parse: Chunk at filepos %Ld truncated to %Ld, filesize %Ld\n", pos - 8, maxsize, fSize);
 			size = maxsize;
 		}
+
+		if (size == 0) {
+			ERROR("OpenDMLParser::Parse: Error: chunk of size 0 found\n");
+			return B_ERROR;
+		}
 		
 		if (fourcc == FOURCC('J','U','N','K')) {
 			ERROR("OpenDMLParser::Parse: JUNK chunk ignored, size: %lu bytes\n", size);
@@ -392,16 +392,16 @@
 
 		TRACE("OpenDMLParser::ParseChunk_AVI: chunk '"FOURCC_FORMAT"', size = %lu, maxsize %lu\n", FOURCC_PARAM(Chunkfcc), Chunksize, maxsize);
 
+		if (Chunksize > maxsize) {
+			TRACE("OpenDMLParser::ParseChunk_AVI: chunk '"FOURCC_FORMAT"', size = %lu too big, truncated to %lu\n", FOURCC_PARAM(Chunkfcc), Chunksize, maxsize);
+			Chunksize = maxsize;
+		}
+
 		if (Chunksize == 0) {
 			ERROR("OpenDMLParser::ParseChunk_AVI: chunk '"FOURCC_FORMAT"' has size 0\n", FOURCC_PARAM(Chunkfcc));
 			return B_ERROR;
 		}
 
-		if (Chunksize > maxsize) {
-			TRACE("OpenDMLParser::ParseChunk_AVI: chunk '"FOURCC_FORMAT"', size = %lu too big, truncated to %lu\n", FOURCC_PARAM(Chunkfcc), Chunksize, maxsize);
-			Chunksize = maxsize;
-		}
-
 		if (Chunkfcc == FOURCC('L','I','S','T')) {
 			if (ParseChunk_LIST(pos, Chunksize) < B_OK)
 				return B_ERROR;



From bonefish at cs.tu-berlin.de  Sun Jun 17 15:00:21 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sun, 17 Jun 2007 15:00:21 +0200
Subject: [Haiku-commits] r21432 - haiku/trunk/src/tools/fs_shell
In-Reply-To: <200706171157.l5HBvPp7004753@sheep.berlios.de>
References: <200706171157.l5HBvPp7004753@sheep.berlios.de>
Message-ID: <20070617150021.474.1@cs.tu-berlin.de>


On 2007-06-17 at 13:57:25 [+0200], korli at BerliOS  
wrote:
> Author: korli
> Date: 2007-06-17 13:57:25 +0200 (Sun, 17 Jun 2007)
> New Revision: 21432
> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21432&view=rev
> 
> Modified:
>    haiku/trunk/src/tools/fs_shell/block_cache.cpp
> Log:
> replaced uint32_t by fssh_addr_t. Obviously, the cookie should be managed 
> differently.

The two obvious options with only local changes would be:

* Use the block number as cookie value -- or rather block number + 1, so 
that the initial cookie value can be discriminated. This allows for a quick 
lookup (hash_lookup(cache->hash, &blockNumber)) and requires only minimal 
changes. The only drawback is that it limits the number of addressable 
blocks to 2^32 - 2. For a 1 KB block size that's still a partition size of 
almost 4 TB, which shouldn't be too bad for the time being.

* Use the list index as cookie value. I don't know, how many blocks a 
transaction will usually contain. Might be a performance problem.

Either change should be conditional, so that 32 bit hosts won't suffer from 
the drawbacks.

Other options that require more changes:

* Assign unique 32 bit numbers to blocks and add an additional hash table 
to block_cache.

* Add a block list index -> cache_block* hash map to cache_transaction.

I suppose the ideal solution would be to change the 
cache_next_block_in_transaction() interface, e.g. to using a void* cookie.

CU, Ingo


From korli at users.berlios.de  Sun Jun 17 15:05:13 2007
From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=)
Date: Sun, 17 Jun 2007 15:05:13 +0200
Subject: [Haiku-commits] r21430 - in haiku/trunk:
	headers/build/private/interface headers/private/fs_shell
	src/build/libbe/interface src/build/libroot src/tools/fs_shell
In-Reply-To: 
References: <200706171050.l5HAoRXK017040@sheep.berlios.de>
	<20070617132114.850.2@cs.tu-berlin.de>
	
Message-ID: 

2007/6/17, J?r?me Duval :
>
> 2007/6/17, Ingo Weinhold :
> >
> >
> > Since those changes seem to be pretty generic for 64 bit architectures,
> > could
> > you please introduce a macro like HAIKU_HOST_PLATFORM_64_BIT in
> > BeOSBuildCompatibility.h and use that in the code instead.
>
>
> I just committed a change to follow your suggestion.
>

After testing, it seems BeOSBuildCompatibility.h is not included when
building fs_shell and bfs_shell.
Thoughts ?

J?r?me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From korli at mail.berlios.de  Sun Jun 17 15:17:04 2007
From: korli at mail.berlios.de (korli at BerliOS)
Date: Sun, 17 Jun 2007 15:17:04 +0200
Subject: [Haiku-commits] r21436 - haiku/trunk/src/tools/fs_shell
Message-ID: <200706171317.l5HDH4lg011618@sheep.berlios.de>

Author: korli
Date: 2007-06-17 15:17:03 +0200 (Sun, 17 Jun 2007)
New Revision: 21436
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21436&view=rev

Modified:
   haiku/trunk/src/tools/fs_shell/vfs.cpp
Log:
reverted to use __x86_64__ as it seems BeOSHostCompatibility header is not included for fs_shell


Modified: haiku/trunk/src/tools/fs_shell/vfs.cpp
===================================================================
--- haiku/trunk/src/tools/fs_shell/vfs.cpp	2007-06-17 12:55:46 UTC (rev 21435)
+++ haiku/trunk/src/tools/fs_shell/vfs.cpp	2007-06-17 13:17:03 UTC (rev 21436)
@@ -3199,7 +3199,7 @@
 
 	// We need to set the locking atomically - someone
 	// else might set one at the same time
-#ifdef HAIKU_HOST_PLATFORM_64_BIT
+#ifdef __x86_64__
 	if (fssh_atomic_test_and_set64((vint64_t *)&vnode->mandatory_locked_by,
 			(fssh_addr_t)descriptor, 0) != 0)
 #else
@@ -3227,7 +3227,7 @@
 
 	// We need to set the locking atomically - someone
 	// else might set one at the same time
-#ifdef HAIKU_HOST_PLATFORM_64_BIT
+#ifdef __x86_64__
 	if (fssh_atomic_test_and_set64((vint64_t *)&vnode->mandatory_locked_by,
 			0, (fssh_addr_t)descriptor) != (int64_t)descriptor)
 #else



From bonefish at mail.berlios.de  Sun Jun 17 15:24:42 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 17 Jun 2007 15:24:42 +0200
Subject: [Haiku-commits] r21437 - haiku/trunk/src/kits/interface
Message-ID: <200706171324.l5HDOgx4012112@sheep.berlios.de>

Author: bonefish
Date: 2007-06-17 15:24:42 +0200 (Sun, 17 Jun 2007)
New Revision: 21437
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21437&view=rev

Modified:
   haiku/trunk/src/kits/interface/Menu.cpp
Log:
Typo. Fixes menus (bug #1276).


Modified: haiku/trunk/src/kits/interface/Menu.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Menu.cpp	2007-06-17 13:17:03 UTC (rev 21436)
+++ haiku/trunk/src/kits/interface/Menu.cpp	2007-06-17 13:24:42 UTC (rev 21437)
@@ -2246,7 +2246,7 @@
 	if (dynamic_cast(this) != NULL)
 		return;
 
-	if (fResizeToFit)
+	if (!fResizeToFit)
 		return;
 
 	bool scroll;



From bonefish at cs.tu-berlin.de  Sun Jun 17 15:29:11 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Sun, 17 Jun 2007 15:29:11 +0200
Subject: [Haiku-commits] r21430 - in haiku/trunk:
 headers/build/private/interface headers/private/fs_shell
 src/build/libbe/interface src/build/libroot src/tools/fs_shell
In-Reply-To: 
References: <200706171050.l5HAoRXK017040@sheep.berlios.de>
	<20070617132114.850.2@cs.tu-berlin.de>
	
	
Message-ID: <20070617152911.804.2@cs.tu-berlin.de>


On 2007-06-17 at 15:05:13 [+0200], J?r?me Duval  
wrote:
> 2007/6/17, J?r?me Duval :
> >
> > 2007/6/17, Ingo Weinhold :
> > >
> > >
> > > Since those changes seem to be pretty generic for 64 bit architectures,
> > > could
> > > you please introduce a macro like HAIKU_HOST_PLATFORM_64_BIT in
> > > BeOSBuildCompatibility.h and use that in the code instead.
> >
> >
> > I just committed a change to follow your suggestion.
> >
> 
> After testing, it seems BeOSBuildCompatibility.h is not included when
> building fs_shell and bfs_shell.
> Thoughts ?

Ah, right. Then it has to be done in BuildSetup. Somewhere around lines 
468-511 should be a good place to do that.

CU, Ingo


From bonefish at mail.berlios.de  Sun Jun 17 17:14:46 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Sun, 17 Jun 2007 17:14:46 +0200
Subject: [Haiku-commits] r21438 - haiku/trunk/build/jam
Message-ID: <200706171514.l5HFEkPS024994@sheep.berlios.de>

Author: bonefish
Date: 2007-06-17 17:14:46 +0200 (Sun, 17 Jun 2007)
New Revision: 21438
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21438&view=rev

Modified:
   haiku/trunk/build/jam/MainBuildRules
Log:
* Use named parameters.
* Use Object{Cc,C++}Flags instead of setting {CC,C++}FLAGS on the
  objects directly.


Modified: haiku/trunk/build/jam/MainBuildRules
===================================================================
--- haiku/trunk/build/jam/MainBuildRules	2007-06-17 13:24:42 UTC (rev 21437)
+++ haiku/trunk/build/jam/MainBuildRules	2007-06-17 15:14:46 UTC (rev 21438)
@@ -497,7 +497,7 @@
 	MergeObject $(target) : $(sources) : $(otherObjects) ;
 }
 
-rule BuildPlatformMergeObjectPIC
+rule BuildPlatformMergeObjectPIC target : sources : otherObjects
 {
 	# BuildPlatformMergeObjectPIC  :  :  ;
 	# Compiles source files and merges the object files to an object file.
@@ -508,14 +508,9 @@
 	# : Object files or static libraries to be merged. No grist
 	#                  will be added.
 	#
-	local target = $(1) ;
-	local sources = $(2) ;
-	local otherObjects = $(3) ;
+	ObjectCcFlags $(sources) : $(HOST_PIC_CCFLAGS) ;
+	ObjectC++Flags $(sources) : $(HOST_PIC_C++FLAGS) ;
 
-	local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
-	CCFLAGS on $(objects) += $(HOST_PIC_CCFLAGS) ; 
-	C++FLAGS on $(objects) += $(HOST_PIC_C++FLAGS) ; 
-
 	BuildPlatformMergeObject $(target) : $(sources) : $(otherObjects) ;
 }
 



From marcusoverhagen at mail.berlios.de  Sun Jun 17 17:54:08 2007
From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS)
Date: Sun, 17 Jun 2007 17:54:08 +0200
Subject: [Haiku-commits] r21439 -
	haiku/trunk/src/add-ons/media/plugins/mp3_decoder
Message-ID: <200706171554.l5HFs8cX028161@sheep.berlios.de>

Author: marcusoverhagen
Date: 2007-06-17 17:54:08 +0200 (Sun, 17 Jun 2007)
New Revision: 21439
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21439&view=rev

Modified:
   haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp
Log:
always sync to frame begin after a seek


Modified: haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp	2007-06-17 15:14:46 UTC (rev 21438)
+++ haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp	2007-06-17 15:54:08 UTC (rev 21439)
@@ -260,10 +260,14 @@
 
 	// resync after a seek		
 	if (fNeedSync) {
-		if (chunkSize > 4 && GetFrameLength(chunkBuffer) > 0) {
-		} else
-		if (chunkSize > 5200) { // mp3 reader always delivers synced frames smaller than 5200 bytes
-			// wav reader and others don't do that
+		if (chunkSize < 4) {
+			TRACE("mp3Decoder::Decode: Sync failed, frame too small\n");
+			return B_ERROR;
+		}
+		int len = GetFrameLength(chunkBuffer);
+		// len = -1 when not at frame start
+		// len == chunkSize for mp3 reader (delivers single frames)
+		if (len < chunkSize) {
 			while (chunkSize > 100) {
 				if (IsValidStream((uint8 *)chunkBuffer, chunkSize))
 					break;



From korli at mail.berlios.de  Sun Jun 17 19:04:30 2007
From: korli at mail.berlios.de (korli at BerliOS)
Date: Sun, 17 Jun 2007 19:04:30 +0200
Subject: [Haiku-commits] r21440 - haiku/trunk/headers/build
Message-ID: <200706171704.l5HH4Ugq016958@sheep.berlios.de>

Author: korli
Date: 2007-06-17 19:04:29 +0200 (Sun, 17 Jun 2007)
New Revision: 21440
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21440&view=rev

Modified:
   haiku/trunk/headers/build/HaikuBuildCompatibility.h
Log:
added atomic*64() for BeOS build


Modified: haiku/trunk/headers/build/HaikuBuildCompatibility.h
===================================================================
--- haiku/trunk/headers/build/HaikuBuildCompatibility.h	2007-06-17 15:54:08 UTC (rev 21439)
+++ haiku/trunk/headers/build/HaikuBuildCompatibility.h	2007-06-17 17:04:29 UTC (rev 21440)
@@ -46,6 +46,13 @@
 extern int32	atomic_test_and_set(vint32 *value, int32 newValue,
 					int32 testAgainst);
 extern int32	atomic_get(vint32 *value);
+extern int64	atomic_set64(vint64 *value, int64 newValue);
+extern int64	atomic_test_and_set64(vint64 *value, int64 newValue,
+					int64 testAgainst);
+extern int64	atomic_get64(vint64 *value);
+extern int64	atomic_add64(vint64 *value, int64 addValue);
+extern int64	atomic_and64(vint64 *value, int64 andValue);
+extern int64	atomic_or64(vint64 *value, int64 orValue);
 
 extern size_t	strnlen(const char *string, size_t count);
 



From geist at foobox.com  Sun Jun 17 20:09:52 2007
From: geist at foobox.com (Travis Geiselbrecht)
Date: Sun, 17 Jun 2007 11:09:52 -0700
Subject: [Haiku-commits] r21432 - haiku/trunk/src/tools/fs_shell
In-Reply-To: <20070617150021.474.1@cs.tu-berlin.de>
References: <200706171157.l5HBvPp7004753@sheep.berlios.de>
	<20070617150021.474.1@cs.tu-berlin.de>
Message-ID: <1A063B81-AB62-4E9F-AF04-97809EAB135A@foobox.com>

On Jun 17, 2007, at 6:00 AM, Ingo Weinhold wrote:
> On 2007-06-17 at 13:57:25 [+0200], korli at BerliOS  
> 
> wrote:
>> Author: korli
>> Date: 2007-06-17 13:57:25 +0200 (Sun, 17 Jun 2007)
>> New Revision: 21432
>> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21432&view=rev
>>
>> Modified:
>>    haiku/trunk/src/tools/fs_shell/block_cache.cpp
>> Log:
>> replaced uint32_t by fssh_addr_t. Obviously, the cookie should be  
>> managed
>> differently.
>
> The two obvious options with only local changes would be:
>
> * Use the block number as cookie value -- or rather block number +  
> 1, so
> that the initial cookie value can be discriminated. This allows for  
> a quick
> lookup (hash_lookup(cache->hash, &blockNumber)) and requires only  
> minimal
> changes. The only drawback is that it limits the number of addressable
> blocks to 2^32 - 2. For a 1 KB block size that's still a partition  
> size of
> almost 4 TB, which shouldn't be too bad for the time being.
>
> * Use the list index as cookie value. I don't know, how many blocks a
> transaction will usually contain. Might be a performance problem.
>
> Either change should be conditional, so that 32 bit hosts won't  
> suffer from
> the drawbacks.
>
> Other options that require more changes:
>
> * Assign unique 32 bit numbers to blocks and add an additional hash  
> table
> to block_cache.
>
> * Add a block list index -> cache_block* hash map to  
> cache_transaction.
>
> I suppose the ideal solution would be to change the
> cache_next_block_in_transaction() interface, e.g. to using a void*  
> cookie.

Another option would be to simply make the cookie a uint64. I  
actually got most of the build working properly on x86-64 yesterday,  
took a while to debug, but I didn't check them in yet, since they  
were pretty nasty.

Here were the changes I had to make to get it to build:
-moved this cookie to uint64, in every instance of it (the fssh cache  
and the real one)
-all of the error codes needed to be based on INT_MIN not LONG_MIN.  
There's about 4 places in the source that do this, and it seems like  
a pretty major change, though I can't see it really causing any  
problems. It was inheirited from beos.
-in some of the places where we typedef uint32, we are typedefing it  
to unsigned long. This is obviously incorrect on a 64bit platform,  
but it's a pretty major change that causes a lot of problems later  
down the road. such as...
-BMessage has some bad overrides of &operator<< that when int32 is  
int causes a collision.

Also, as far as the atomic change, I think the problem there wasn't  
that it needed a 64bit atomic, it was that fssh_addr_t is currently  
typedefed to uint32. I changed it to typedef to uintptr_t.

Anyway, all of this really looks like a big preview of what's to come  
when trying to port it all to 64bit. Seems that some of the early  
beos decisions were slightly off, and some stuff will have to be  
changed, but *hopefully* none of it will cause any compatibility  
problems.

Travis




From marcusoverhagen at mail.berlios.de  Sun Jun 17 21:38:59 2007
From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS)
Date: Sun, 17 Jun 2007 21:38:59 +0200
Subject: [Haiku-commits] r21441 -
	haiku/trunk/src/add-ons/media/plugins/mp3_decoder
Message-ID: <200706171938.l5HJcx3E027957@sheep.berlios.de>

Author: marcusoverhagen
Date: 2007-06-17 21:38:59 +0200 (Sun, 17 Jun 2007)
New Revision: 21441
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21441&view=rev

Modified:
   haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp
Log:
This fixes most audio seeking problems with AVI files, but
still needs some work. The sync code was never executed, as
if (len < chunkSize) (len = signed, chunkSize = unsigned) 
was compiled into an unsigned compare and thus always false
for len=-1.


Modified: haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp	2007-06-17 17:04:29 UTC (rev 21440)
+++ haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp	2007-06-17 19:38:59 UTC (rev 21441)
@@ -29,7 +29,7 @@
 #include 
 #include "mp3DecoderPlugin.h"
 
-//#define TRACE_MP3_DECODER
+#define TRACE_MP3_DECODER
 #ifdef TRACE_MP3_DECODER
   #define TRACE printf
 #else
@@ -182,11 +182,7 @@
 				 int64 seekFrame, int64 *frame,
 				 bigtime_t seekTime, bigtime_t *time)
 {
-	ExitMP3(&fMpgLibPrivate);
-	InitMP3(&fMpgLibPrivate);
-	fResidualBytes = 0;
 	fNeedSync = true;
-	fDecodingError = false;
 	return B_OK;
 }
 
@@ -199,14 +195,25 @@
 	uint8 * out_buffer = static_cast(buffer);
 	int32	out_bytes_needed = fOutputBufferSize;
 	int32	out_bytes = 0;
-	
-	if (fDecodingError)
-		return B_ERROR;
-	
+
 	mediaHeader->start_time = fStartTime;
 	//TRACE("mp3Decoder: Decoding start time %.6f\n", fStartTime / 1000000.0);
-	
+
 	while (out_bytes_needed > 0) {
+
+		if (fNeedSync) {
+			TRACE("mp3Decoder::Decode: syncing...\n");
+			ExitMP3(&fMpgLibPrivate);
+			InitMP3(&fMpgLibPrivate);
+			fDecodingError = false;
+			fResidualBytes = 0;
+			mediaHeader->start_time = -1;
+			// fNeedSync is reset in DecodeNextChunk
+		}
+
+		if (fDecodingError)
+			return B_ERROR;
+
 		if (fResidualBytes) {
 			int32 bytes = min_c(fResidualBytes, out_bytes_needed);
 			memcpy(out_buffer, fResidualBuffer, bytes);
@@ -227,6 +234,8 @@
 			fDecodingError = true;
 			break;
 		}
+		if (mediaHeader->start_time == -1)
+			mediaHeader->start_time = fStartTime;
 	}
 
 	*frameCount = out_bytes / fFrameSize;
@@ -253,43 +262,57 @@
 	}
 	
 	// get another chunk and push it to the decoder
-
 	err = GetNextChunk(&chunkBuffer, &chunkSize, &mh);
 	if (err != B_OK)
 		return err;
 
+	fStartTime = mh.start_time;
+//	TRACE("mp3Decoder: fStartTime reset to %.6f\n", fStartTime / 1000000.0);
+
 	// resync after a seek		
 	if (fNeedSync) {
+		TRACE("mp3Decoder::DecodeNextChunk: Syncing...\n");
 		if (chunkSize < 4) {
-			TRACE("mp3Decoder::Decode: Sync failed, frame too small\n");
+			TRACE("mp3Decoder::DecodeNextChunk: Sync failed, frame too small\n");
 			return B_ERROR;
 		}
 		int len = GetFrameLength(chunkBuffer);
-		// len = -1 when not at frame start
+		TRACE("mp3Decoder::DecodeNextChunk: chunkSize %d, first frame length %d\n", chunkSize, len);
+		// len == -1 when not at frame start
 		// len == chunkSize for mp3 reader (delivers single frames)
-		if (len < chunkSize) {
-			while (chunkSize > 100) {
-				if (IsValidStream((uint8 *)chunkBuffer, chunkSize))
+		if (len < (int)chunkSize) {
+//			FIXME: join a few chunks to create a larger (2k) buffer, and use:
+//			while (chunkSize > 100) {
+//				if (IsValidStream((uint8 *)chunkBuffer, chunkSize))
+			while (chunkSize >= 4) {
+				if (GetFrameLength(chunkBuffer) > 0)
 					break;
 				chunkBuffer = (uint8 *)chunkBuffer + 1;
 				chunkSize--;
 			}
-			if (chunkSize <= 100) {
-				TRACE("mp3Decoder::Decode: Sync failed\n");
+//			if (chunkSize <= 100) {
+			if (chunkSize == 3) {	
+				TRACE("mp3Decoder::DecodeNextChunk: Sync failed\n");
 				return B_ERROR;
 			}
+			TRACE("mp3Decoder::DecodeNextChunk: new chunkSize %d, first frame length %d\n", chunkSize, GetFrameLength(chunkBuffer));
 		}
 		fNeedSync = false;
 	}
 	
-	fStartTime = mh.start_time;
-
-	//TRACE("mp3Decoder: fStartTime reset to %.6f\n", fStartTime / 1000000.0);
-
 	result = decodeMP3(&fMpgLibPrivate, (char *)chunkBuffer, chunkSize, (char *)fDecodeBuffer, DECODE_BUFFER_SIZE, &outsize);
-	if (result == MP3_ERR) {
-		TRACE("mp3Decoder::Decode: decodeMP3 returned MP3_ERR\n");
+	if (result == MP3_NEED_MORE) {
+		TRACE("mp3Decoder::DecodeNextChunk: decodeMP3 returned MP3_NEED_MORE\n");
+		fResidualBuffer = NULL;
+		fResidualBytes = 0;
+		return B_OK;
+	} else if (result != MP3_OK) {
+		TRACE("mp3Decoder::DecodeNextChunk: decodeMP3 returned error %d\n", result);
 		return B_ERROR;
+//		fNeedSync = true;
+//		fResidualBuffer = NULL;
+//		fResidualBytes = 0;
+//		return B_OK;
 	}
 		
 	//printf("mp3Decoder::Decode: decoded %d bytes into %d bytes\n",chunkSize, outsize);



From marcusoverhagen at mail.berlios.de  Sun Jun 17 22:12:22 2007
From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS)
Date: Sun, 17 Jun 2007 22:12:22 +0200
Subject: [Haiku-commits] r21442 - haiku/trunk/src/apps/mediaplayer
Message-ID: <200706172012.l5HKCMCO030204@sheep.berlios.de>

Author: marcusoverhagen
Date: 2007-06-17 22:12:21 +0200 (Sun, 17 Jun 2007)
New Revision: 21442
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21442&view=rev

Modified:
   haiku/trunk/src/apps/mediaplayer/Controller.cpp
   haiku/trunk/src/apps/mediaplayer/Controller.h
Log:
Use separate waiting semaphores for audio and video, later to be used for seeking


Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/Controller.cpp	2007-06-17 19:38:59 UTC (rev 21441)
+++ haiku/trunk/src/apps/mediaplayer/Controller.cpp	2007-06-17 20:12:21 UTC (rev 21442)
@@ -521,6 +521,9 @@
 	fSeekVideo = true;
 
 	fSeekToStartAfterPause = false;
+
+	release_sem(fAudioWaitSem);
+	release_sem(fVideoWaitSem);
 }
 
 
@@ -792,8 +795,8 @@
 		wait:
 		if (fPaused || fStopped) {
 //printf("waiting..\n");	
-			status = acquire_sem_etc(fThreadWaitSem, 1, B_RELATIVE_TIMEOUT, 50000);
-			if (status != B_TIMED_OUT)
+			status = acquire_sem_etc(fVideoWaitSem, 1, B_RELATIVE_TIMEOUT, 50000);
+			if (status != B_OK && status != B_TIMED_OUT)
 				break;
 			goto wait;
 		}
@@ -976,8 +979,8 @@
 		wait:
 		if (fPaused || fStopped) {
 //printf("waiting..\n");	
-			status = acquire_sem_etc(fThreadWaitSem, 1, B_RELATIVE_TIMEOUT, 50000);
-			if (status != B_TIMED_OUT)
+			status = acquire_sem_etc(fVideoWaitSem, 1, B_RELATIVE_TIMEOUT, 50000);
+			if (status != B_OK && status != B_TIMED_OUT)
 				break;
 			goto wait;
 		}
@@ -1007,7 +1010,11 @@
 		waituntil = fTimeSourceSysTime - fTimeSourcePerfTime + buffer->startTime;
 #endif
 
-		status = acquire_sem_etc(fThreadWaitSem, 1, B_ABSOLUTE_TIMEOUT, waituntil);
+		status = acquire_sem_etc(fVideoWaitSem, 1, B_ABSOLUTE_TIMEOUT, waituntil);
+		if (status == B_OK) { // interrupted by seeking
+			printf("video: video wait interruped\n");
+			continue;
+		}
 		if (status != B_TIMED_OUT)
 			break;
 
@@ -1045,7 +1052,7 @@
 		release_sem(fVideoDecodeSem);
 	}
 		
-//		status_t status = acquire_sem_etc(fThreadWaitSem, 1, B_ABSOLUTE_TIMEOUT, buffer->startTime);
+//		status_t status = acquire_sem_etc(fVideoWaitSem, 1, B_ABSOLUTE_TIMEOUT, buffer->startTime);
 //		if (status != B_TIMED_OUT)
 //			return;
 }
@@ -1068,7 +1075,8 @@
 	fVideoDecodeSem = create_sem(fVideoBufferCount - 2, "video decode sem");
 	fAudioPlaySem = create_sem(0, "audio play sem");
 	fVideoPlaySem = create_sem(0, "video play sem");
-	fThreadWaitSem = create_sem(0, "thread wait sem");
+	fAudioWaitSem = create_sem(0, "audio wait sem");
+	fVideoWaitSem = create_sem(0, "video wait sem");
 	fAudioDecodeThread = spawn_thread(_AudioDecodeThreadEntry, "audio decode", AUDIO_DECODE_PRIORITY, this);
 	fVideoDecodeThread = spawn_thread(_VideoDecodeThreadEntry, "video decode", VIDEO_DECODE_PRIORITY, this);
 	fAudioPlayThread = spawn_thread(_AudioPlayThreadEntry, "audio play", AUDIO_PLAY_PRIORITY, this);
@@ -1090,7 +1098,8 @@
 	delete_sem(fVideoDecodeSem);
 	delete_sem(fAudioPlaySem);
 	delete_sem(fVideoPlaySem);
-	delete_sem(fThreadWaitSem);
+	delete_sem(fAudioWaitSem);
+	delete_sem(fVideoWaitSem);
 
 	status_t dummy;
 	wait_for_thread(fAudioDecodeThread, &dummy);
@@ -1101,7 +1110,8 @@
 	fVideoDecodeThread = -1;
 	fAudioPlayThread = -1;
 	fVideoPlayThread = -1;
-	fThreadWaitSem = -1;
+	fAudioWaitSem = -1;
+	fVideoWaitSem = -1;
 	fAudioDecodeSem = -1;
 	fVideoDecodeSem = -1;
 	fAudioPlaySem = -1;

Modified: haiku/trunk/src/apps/mediaplayer/Controller.h
===================================================================
--- haiku/trunk/src/apps/mediaplayer/Controller.h	2007-06-17 19:38:59 UTC (rev 21441)
+++ haiku/trunk/src/apps/mediaplayer/Controller.h	2007-06-17 20:12:21 UTC (rev 21442)
@@ -189,7 +189,8 @@
 	sem_id					fVideoDecodeSem;
 	sem_id					fAudioPlaySem;
 	sem_id					fVideoPlaySem;
-	sem_id					fThreadWaitSem;
+	sem_id					fAudioWaitSem;
+	sem_id					fVideoWaitSem;
 	thread_id				fAudioDecodeThread;
 	thread_id				fVideoDecodeThread;
 	thread_id				fAudioPlayThread;



From marcusoverhagen at mail.berlios.de  Sun Jun 17 22:14:01 2007
From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS)
Date: Sun, 17 Jun 2007 22:14:01 +0200
Subject: [Haiku-commits] r21443 -
	haiku/trunk/src/add-ons/media/plugins/mp3_decoder
Message-ID: <200706172014.l5HKE1dd030356@sheep.berlios.de>

Author: marcusoverhagen
Date: 2007-06-17 22:14:00 +0200 (Sun, 17 Jun 2007)
New Revision: 21443
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21443&view=rev

Modified:
   haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp
Log:
Synchronize even at begin of the file, some avi files contain garbage at the beginning


Modified: haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp
===================================================================
--- haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp	2007-06-17 20:12:21 UTC (rev 21442)
+++ haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp	2007-06-17 20:14:00 UTC (rev 21443)
@@ -99,7 +99,7 @@
 	fBitRate = 0;
 	fChannelCount = 0;
 	fOutputBufferSize = 0;
-	fNeedSync = false;
+	fNeedSync = true; // some files start with garbage
 	fDecodingError = false;
 }
 



From marcusoverhagen at mail.berlios.de  Sun Jun 17 23:02:50 2007
From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS)
Date: Sun, 17 Jun 2007 23:02:50 +0200
Subject: [Haiku-commits] r21444 - haiku/trunk/src/apps/mediaplayer
Message-ID: <200706172102.l5HL2oH2000967@sheep.berlios.de>

Author: marcusoverhagen
Date: 2007-06-17 23:02:50 +0200 (Sun, 17 Jun 2007)
New Revision: 21444
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21444&view=rev

Modified:
   haiku/trunk/src/apps/mediaplayer/Controller.cpp
Log:
revert the part of the previous checkin that completely broke video seeking (however, the current state is hardly working at all)


Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/Controller.cpp	2007-06-17 20:14:00 UTC (rev 21443)
+++ haiku/trunk/src/apps/mediaplayer/Controller.cpp	2007-06-17 21:02:50 UTC (rev 21444)
@@ -522,8 +522,8 @@
 
 	fSeekToStartAfterPause = false;
 
-	release_sem(fAudioWaitSem);
-	release_sem(fVideoWaitSem);
+//	release_sem(fAudioWaitSem);
+//	release_sem(fVideoWaitSem);
 }
 
 



From axeld at pinc-software.de  Sun Jun 17 23:40:15 2007
From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=)
Date: Sun, 17 Jun 2007 23:40:15 +0200 CEST
Subject: [Haiku-commits] r21419 - in haiku/trunk/src: . kits kits/shared
In-Reply-To: <200706151832.l5FIWp6Y027505@sheep.berlios.de>
Message-ID: <3516279273-BeMail@zon>

bonefish at BerliOS  wrote:
> Log:
> libshared.a doesn't deserve a src/ subdirectory. Moved to
> src/kits/shared.

kits? Wouldn't libs be more appropriate? (as it's not shared between 
the kits, but between the apps?)

Bye,
   Axel.



From bonefish at cs.tu-berlin.de  Mon Jun 18 00:06:42 2007
From: bonefish at cs.tu-berlin.de (Ingo Weinhold)
Date: Mon, 18 Jun 2007 00:06:42 +0200
Subject: [Haiku-commits] r21419 - in haiku/trunk/src: . kits kits/shared
In-Reply-To: <3516279273-BeMail@zon>
References: <3516279273-BeMail@zon>
Message-ID: <20070618000642.8119.5@cs.tu-berlin.de>


On 2007-06-17 at 23:40:15 [+0200], Axel D?rfler  
wrote:
> bonefish at BerliOS  wrote:
> > Log:
> > libshared.a doesn't deserve a src/ subdirectory. Moved to
> > src/kits/shared.
> 
> kits? Wouldn't libs be more appropriate? (as it's not shared between
> the kits, but between the apps?)

After checking src/libs I realized that, besides the icon and USB stuff, it 
only contains third party libraries -- which is how it was originally 
intended. I think, src/kits is a way better fit. I'd also move the 
src/libs/{icon,usb} to src/kits, but maybe the authors beat me to it (hint, 
hint! :-P)

BTW, I also consider moving src/tools to src/build/tools. I'll wait till 
the build system porting endeavors calm down a little, though.

CU, Ingo


From stippi at mail.berlios.de  Mon Jun 18 10:32:12 2007
From: stippi at mail.berlios.de (stippi at BerliOS)
Date: Mon, 18 Jun 2007 10:32:12 +0200
Subject: [Haiku-commits] r21445 - haiku/trunk/src/apps/resedit
Message-ID: <200706180832.l5I8WCCm005358@sheep.berlios.de>

Author: stippi
Date: 2007-06-18 10:32:11 +0200 (Mon, 18 Jun 2007)
New Revision: 21445
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21445&view=rev

Modified:
   haiku/trunk/src/apps/resedit/ResView.h
Log:
* compile fix provided by Michael Berg


Modified: haiku/trunk/src/apps/resedit/ResView.h
===================================================================
--- haiku/trunk/src/apps/resedit/ResView.h	2007-06-17 21:02:50 UTC (rev 21444)
+++ haiku/trunk/src/apps/resedit/ResView.h	2007-06-18 08:32:11 UTC (rev 21445)
@@ -17,8 +17,10 @@
 #include 
 #include "ResourceRoster.h"
 
-class ResView : public BView
-{
+
+class BMenuBar;
+
+class ResView : public BView {
 public:
 					ResView(const BRect &frame, const char *name,
 							const int32 &resize, const int32 &flags,



From stippi at mail.berlios.de  Mon Jun 18 10:34:21 2007
From: stippi at mail.berlios.de (stippi at BerliOS)
Date: Mon, 18 Jun 2007 10:34:21 +0200
Subject: [Haiku-commits] r21446 - haiku/trunk/src/apps/powerstatus
Message-ID: <200706180834.l5I8YLRl005485@sheep.berlios.de>

Author: stippi
Date: 2007-06-18 10:34:20 +0200 (Mon, 18 Jun 2007)
New Revision: 21446
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21446&view=rev

Modified:
   haiku/trunk/src/apps/powerstatus/PowerStatusView.cpp
Log:
* compile fix provided by Michael Berg

Modified: haiku/trunk/src/apps/powerstatus/PowerStatusView.cpp
===================================================================
--- haiku/trunk/src/apps/powerstatus/PowerStatusView.cpp	2007-06-18 08:32:11 UTC (rev 21445)
+++ haiku/trunk/src/apps/powerstatus/PowerStatusView.cpp	2007-06-18 08:34:20 UTC (rev 21446)
@@ -10,10 +10,12 @@
 #include "PowerStatusView.h"
 #include "PowerStatus.h"
 
-#include 
-#include 
-#include 
+#ifdef HAIKU_TARGET_PLATFORM_HAIKU
+#	include 
+#	include 
+#	include 
 	// temporary, as long as there is no real power state API
+#endif
 
 #include 
 #include 



From stippi at mail.berlios.de  Mon Jun 18 10:35:50 2007
From: stippi at mail.berlios.de (stippi at BerliOS)
Date: Mon, 18 Jun 2007 10:35:50 +0200
Subject: [Haiku-commits] r21447 - haiku/trunk/src/apps/mediaplayer
Message-ID: <200706180835.l5I8ZoDR005692@sheep.berlios.de>

Author: stippi
Date: 2007-06-18 10:35:50 +0200 (Mon, 18 Jun 2007)
New Revision: 21447
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21447&view=rev

Modified:
   haiku/trunk/src/apps/mediaplayer/InfoWin.h
Log:
* compile fix provided by Michael Berg

Modified: haiku/trunk/src/apps/mediaplayer/InfoWin.h
===================================================================
--- haiku/trunk/src/apps/mediaplayer/InfoWin.h	2007-06-18 08:34:20 UTC (rev 21446)
+++ haiku/trunk/src/apps/mediaplayer/InfoWin.h	2007-06-18 08:35:50 UTC (rev 21447)
@@ -23,9 +23,12 @@
 #include 
 
 
+class BStringView;
+class BTextView;
 class Controller;
 class ControllerObserver;
 class InfoView;
+ 
 
 #define INFO_STATS		0x00000001
 #define INFO_TRANSPORT	0x00000002



From stippi at mail.berlios.de  Mon Jun 18 10:38:01 2007
From: stippi at mail.berlios.de (stippi at BerliOS)
Date: Mon, 18 Jun 2007 10:38:01 +0200
Subject: [Haiku-commits] r21448 - haiku/trunk/src/preferences/devices
Message-ID: <200706180838.l5I8c1BC005924@sheep.berlios.de>

Author: stippi
Date: 2007-06-18 10:38:01 +0200 (Mon, 18 Jun 2007)
New Revision: 21448
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21448&view=rev

Modified:
   haiku/trunk/src/preferences/devices/DevicesWindows.h
Log:
* compile fix provided by Michael Berg

Modified: haiku/trunk/src/preferences/devices/DevicesWindows.h
===================================================================
--- haiku/trunk/src/preferences/devices/DevicesWindows.h	2007-06-18 08:35:50 UTC (rev 21447)
+++ haiku/trunk/src/preferences/devices/DevicesWindows.h	2007-06-18 08:38:01 UTC (rev 21448)
@@ -26,12 +26,14 @@
 
 #include "cm_wrapper.h"
 
+class BMenuField;
+class BStringView;
+
 #define MODEM_ADDED 'moad'
 
 void CenterWindowOnScreen(BWindow* w);
 
-class ResourceUsageWindow : public BWindow
-{
+class ResourceUsageWindow : public BWindow {
 	public:
     	ResourceUsageWindow(BRect frame, BList &);
 	    ~ResourceUsageWindow();
@@ -42,8 +44,7 @@
 };
 
 
-class ModemWindow : public BWindow
-{
+class ModemWindow : public BWindow {
 	public:
     	ModemWindow(BRect frame, BMessenger);
 	    ~ModemWindow();
@@ -53,8 +54,7 @@
 	    BMessenger fMessenger;
 };
 
-class ConfigurationWindow : public BWindow
-{
+class ConfigurationWindow : public BWindow {
 	public:
 		ConfigurationWindow(BRect frame, DeviceItem *item);
 	    ~ConfigurationWindow();
@@ -72,8 +72,7 @@
 };
 
 
-class DevicesWindow : public BWindow
-{
+class DevicesWindow : public BWindow {
 	public:
     	DevicesWindow(BRect frame);
 	    ~DevicesWindow();



From stippi at mail.berlios.de  Mon Jun 18 10:39:37 2007
From: stippi at mail.berlios.de (stippi at BerliOS)
Date: Mon, 18 Jun 2007 10:39:37 +0200
Subject: [Haiku-commits] r21449 - haiku/trunk/src/apps/deskcalc
Message-ID: <200706180839.l5I8dbdr006191@sheep.berlios.de>

Author: stippi
Date: 2007-06-18 10:39:37 +0200 (Mon, 18 Jun 2007)
New Revision: 21449
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21449&view=rev

Modified:
   haiku/trunk/src/apps/deskcalc/CalcApplication.h
   haiku/trunk/src/apps/deskcalc/CalcView.h
Log:
* compile fix provided by Michael Berg

Modified: haiku/trunk/src/apps/deskcalc/CalcApplication.h
===================================================================
--- haiku/trunk/src/apps/deskcalc/CalcApplication.h	2007-06-18 08:38:01 UTC (rev 21448)
+++ haiku/trunk/src/apps/deskcalc/CalcApplication.h	2007-06-18 08:39:37 UTC (rev 21449)
@@ -7,14 +7,15 @@
  *		Timothy Wayper 
  *		Stephan A?mus 
  */
-
 #ifndef _CALC_APPLICATION_H
 #define _CALC_APPLICATION_H
 
 #include 
 
+
 extern const char* kAppSig;
 
+class BFile;
 class CalcWindow;
 
 class CalcApplication : public BApplication {

Modified: haiku/trunk/src/apps/deskcalc/CalcView.h
===================================================================
--- haiku/trunk/src/apps/deskcalc/CalcView.h	2007-06-18 08:38:01 UTC (rev 21448)
+++ haiku/trunk/src/apps/deskcalc/CalcView.h	2007-06-18 08:39:37 UTC (rev 21449)
@@ -15,6 +15,7 @@
 
 class BString;
 class BMenuItem;
+class BPopUpMenu;
 class CalcOptions;
 class CalcOptionsWindow;
 class ExpressionTextView;



From jackburton at mail.berlios.de  Mon Jun 18 11:53:37 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Mon, 18 Jun 2007 11:53:37 +0200
Subject: [Haiku-commits] r21450 - in haiku/trunk: headers/os/game
	src/kits/game
Message-ID: <200706180953.l5I9rbrM013002@sheep.berlios.de>

Author: jackburton
Date: 2007-06-18 11:53:36 +0200 (Mon, 18 Jun 2007)
New Revision: 21450
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21450&view=rev

Modified:
   haiku/trunk/headers/os/game/WindowScreen.h
   haiku/trunk/src/kits/game/WindowScreen.cpp
Log:
Used exceptions to handle errors on InitData(). I hope I didn't made 
stupid errors, since I don't use exceptions usually. Feel free to beat 
me on this. Moved uninitialization to _DisposeData(). Corrected some 
styling issues pointed out by axel. Used fprintf instead of printf.
Turned off debugging.


Modified: haiku/trunk/headers/os/game/WindowScreen.h
===================================================================
--- haiku/trunk/headers/os/game/WindowScreen.h	2007-06-18 08:39:37 UTC (rev 21449)
+++ haiku/trunk/headers/os/game/WindowScreen.h	2007-06-18 09:53:36 UTC (rev 21450)
@@ -78,6 +78,8 @@
 							BWindowScreen &operator=(BWindowScreen& other);
 
 		status_t			_InitData(uint32 space, uint32 attributes);
+		void				_DisposeData();
+
 		status_t			_SetActiveState(int32 state);
 		status_t			_SetupAccelerantHooks(bool enable);
 		status_t			_GetCardInfo();

Modified: haiku/trunk/src/kits/game/WindowScreen.cpp
===================================================================
--- haiku/trunk/src/kits/game/WindowScreen.cpp	2007-06-18 08:39:37 UTC (rev 21449)
+++ haiku/trunk/src/kits/game/WindowScreen.cpp	2007-06-18 09:53:36 UTC (rev 21450)
@@ -1,8 +1,8 @@
 /*
- * Copyright 2002-2006, Haiku. All Rights Reserved.
+ * Copyright 2002-2007, Haiku. All Rights Reserved.
  * Copyright 2002-2005,
  *		Marcus Overhagen, 
- *		Stefano Ceccherini (burton666 at libero.it),
+ *		Stefano Ceccherini (stefano.ceccherini at gmail.com),
  *		Carwyn Jones (turok2 at currantbun.com)
  *		All rights reserved.
  *
@@ -19,6 +19,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include  // For IS_SET_MOUSE_POSITION
 #include 
@@ -29,7 +31,7 @@
 using BPrivate::AppServerLink;
 
 
-#define TRACE_WINDOWSCREEN 1
+#define TRACE_WINDOWSCREEN 0
 #if TRACE_WINDOWSCREEN
 #define CALLED() printf("%s\n", __PRETTY_FUNCTION__);
 #else
@@ -312,19 +314,7 @@
 BWindowScreen::~BWindowScreen()
 {
 	CALLED();
-	Disconnect();
-	if (fAddonImage >= 0)
-		unload_add_on(fAddonImage);
-	
-	delete_sem(fActivateSem);
-	delete_sem(fDebugSem);
-	
-	if (fDebugState)
-		activate_workspace(fDebugWorkspace);
-	
-	free(fDisplayMode);
-	free(fOriginalDisplayMode);
-	free(fModeList);
+	_DisposeData();
 }
 
 
@@ -679,51 +669,96 @@
 	fAttributes = attributes;
 		// TODO: not really used right now, but should probably be known by the app_server
 
-	fWorkspaceIndex = fDebugWorkspace = current_workspace();
+	fWorkspaceIndex = current_workspace();
+	fDebugWorkspace = fWorkspaceIndex > 0 ? fWorkspaceIndex - 1 : 1;
 	fLockState = 0;
 	fAddonImage = -1;
 	fWindowState = 0;
+	fOriginalDisplayMode = NULL;
+	fDisplayMode = NULL;
+	fModeList = NULL;
+	fModeCount = 0;
+	fActivateSem = -1;
+	fDebugSem = -1;
+	fActivateState = 0;
+	fWorkState = 0;
 
-	// TODO: free resources upon failure!
+	status_t status = B_ERROR;
+	try {
+		fOriginalDisplayMode = new display_mode;
+		fDisplayMode = new display_mode;
 
-	BScreen screen(this);
-	status_t status = screen.GetModeList(&fModeList, &fModeCount);
-	if (status < B_OK)
-		return status;
+		BScreen screen(this);
+		status = screen.GetMode(fOriginalDisplayMode);
+		if (status < B_OK)
+			throw status;
+		
+		status = screen.GetModeList(&fModeList, &fModeCount);
+		if (status < B_OK)
+			throw status;
 
-	fDisplayMode = (display_mode *)malloc(sizeof(display_mode));
-	if (fDisplayMode == NULL)
-		return B_NO_MEMORY;
+		status = _GetModeFromSpace(space, fDisplayMode);
+		if (status < B_OK)
+			throw status;
 
-	status = _GetModeFromSpace(space, fDisplayMode);
-	if (status < B_OK)
-		return status;
+		status = _GetCardInfo();
+		if (status < B_OK)
+			throw status;
 
-	memcpy(fPalette, screen.ColorMap()->color_list, 256);
+		fActivateSem = create_sem(0, "WindowScreen start lock");
+		if (fActivateSem < B_OK)
+			throw fActivateSem;
 
-	status = _GetCardInfo();
-	if (status < B_OK)
-		return status;
+		fDebugSem = create_sem(1, "WindowScreen debug sem");
+		if (fDebugSem < B_OK)
+			throw fDebugSem;
 
-	fActivateSem = create_sem(0, "WindowScreen start lock");
-	if (fActivateSem < B_OK)
-		return fActivateSem;
+		memcpy(fPalette, screen.ColorMap()->color_list, 256);
+		fActivateState = 0;
+		fWorkState = 1;
+		
+	} catch (std::bad_alloc) {
+		status = B_NO_MEMORY;	
+	} catch (int error) {
+		status = error;
+	} catch (...) {
+		status = B_ERROR;	
+	}
 
-	fActivateState = 0;
+	if (status != B_OK)
+		_DisposeData();
 
-	fDebugSem = create_sem(1, "WindowScreen debug sem");
-	if (fDebugSem < B_OK)
-		return fDebugSem;
+	return status;
+}
 
-	fWorkState = 1;
-		
-	fOriginalDisplayMode = (display_mode *)malloc(sizeof(display_mode));
-	if (fOriginalDisplayMode == NULL)
-		return B_NO_MEMORY;
 
-	screen.GetMode(fOriginalDisplayMode);
+void
+BWindowScreen::_DisposeData()
+{
+	CALLED();
+	Disconnect();
+	if (fAddonImage >= 0) {
+		unload_add_on(fAddonImage);
+		fAddonImage = -1;	
+	}
+	
+	delete_sem(fActivateSem);
+	fActivateSem = -1;
+	delete_sem(fDebugSem);
+	fDebugSem = -1;	
 
-	return B_OK;
+	if (fDebugState)
+		activate_workspace(fDebugWorkspace);
+	
+	delete fDisplayMode;
+	fDisplayMode = NULL;
+	delete fOriginalDisplayMode;
+	fOriginalDisplayMode = NULL;
+	delete fModeList;
+	fModeList = NULL;
+	fModeCount = 0;
+	
+	fLockState = 0;
 }
 
 
@@ -733,7 +768,6 @@
 	CALLED();
 	status_t status = B_ERROR;
 	if (state == 1) {
-		//be_app->HideCursor();
 		status = _AssertDisplayMode(fDisplayMode);
 		if (status == B_OK && (status = _SetupAccelerantHooks(true)) == B_OK) {			
 			if (!fActivateState) {
@@ -993,35 +1027,35 @@
 	link.ReadString(accelerantPath);
 	fAddonImage = load_add_on(accelerantPath.String()); 
 	if (fAddonImage < B_OK) {
-		printf("InitClone: cannot load accelerant image\n");
+		fprintf(stderr, "InitClone: cannot load accelerant image\n");
 		return fAddonImage;
 	}
 
 	status = get_image_symbol(fAddonImage, B_ACCELERANT_ENTRY_POINT,
 		B_SYMBOL_TYPE_TEXT, (void **)&fGetAccelerantHook);
 	if (status < B_OK) {
-		printf("InitClone: cannot get accelerant entry point\n");
+		fprintf(stderr, "InitClone: cannot get accelerant entry point\n");
 		unload_add_on(fAddonImage);
 		fAddonImage = -1;
 		return status;
 	}
 	
-	accelerant_clone_info_size clone_info_size;
-	get_accelerant_clone_info clone_info;
-	clone_accelerant clone;
-	clone_info_size = (accelerant_clone_info_size)fGetAccelerantHook(B_ACCELERANT_CLONE_INFO_SIZE, NULL);
-	clone_info = (get_accelerant_clone_info)fGetAccelerantHook(B_GET_ACCELERANT_CLONE_INFO, NULL);
-	clone = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL);
+	accelerant_clone_info_size cloneInfoSizeHook;
+	get_accelerant_clone_info cloneInfoHook;
+	clone_accelerant cloneHook;
+	cloneInfoSizeHook = (accelerant_clone_info_size)fGetAccelerantHook(B_ACCELERANT_CLONE_INFO_SIZE, NULL);
+	cloneInfoHook = (get_accelerant_clone_info)fGetAccelerantHook(B_GET_ACCELERANT_CLONE_INFO, NULL);
+	cloneHook = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL);
 
 	status = B_ERROR;
-	if (!clone_info_size || !clone_info || !clone) {
-		printf("InitClone: cannot get clone hook\n");
+	if (!cloneInfoSizeHook || !cloneInfoHook || !cloneHook) {
+		fprintf(stderr, "InitClone: cannot get clone hook\n");
 		unload_add_on(fAddonImage);
 		fAddonImage = -1;
 		return status;
 	}
 
-	ssize_t cloneInfoSize = clone_info_size();
+	ssize_t cloneInfoSize = cloneInfoSizeHook();
 	void *cloneInfo = malloc(cloneInfoSize);
 	if (!cloneInfo) {
 		unload_add_on(fAddonImage);
@@ -1029,15 +1063,15 @@
 		return B_NO_MEMORY;
 	}
 
-	clone_info(cloneInfo);
+	cloneInfoHook(cloneInfo);
 		// no way to see if this call fails
 
-	status = clone(cloneInfo);
+	status = cloneHook(cloneInfo);
 	
 	free(cloneInfo);
 
 	if (status < B_OK) {
-		printf("InitClone: cannot clone accelerant\n");
+		fprintf(stderr, "InitClone: cannot clone accelerant\n");
 		unload_add_on(fAddonImage);
 		fAddonImage = -1;
 	}



From jackburton at mail.berlios.de  Mon Jun 18 14:36:30 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Mon, 18 Jun 2007 14:36:30 +0200
Subject: [Haiku-commits] r21451 - haiku/trunk/src/tests/kits/game/ParticlesII
Message-ID: <200706181236.l5ICaUbJ007656@sheep.berlios.de>

Author: jackburton
Date: 2007-06-18 14:36:30 +0200 (Mon, 18 Jun 2007)
New Revision: 21451
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21451&view=rev

Modified:
   haiku/trunk/src/tests/kits/game/ParticlesII/particlesII.cpp
Log:
CanControlFrameBuffer() returns false with the vmware driver, but 
ParticlesII doesn't need to do special things with it


Modified: haiku/trunk/src/tests/kits/game/ParticlesII/particlesII.cpp
===================================================================
--- haiku/trunk/src/tests/kits/game/ParticlesII/particlesII.cpp	2007-06-18 09:53:36 UTC (rev 21450)
+++ haiku/trunk/src/tests/kits/game/ParticlesII/particlesII.cpp	2007-06-18 12:36:30 UTC (rev 21451)
@@ -93,7 +93,7 @@
 	NWindowScreen *ws = new NWindowScreen(&ret);
 	PRINT(("WindowScreen ctor returned. ret = %s\n", strerror(ret)));
 	// exit if constructing the WindowScreen failed.
-	if((ws == NULL) || (ret < B_OK) || !ws->CanControlFrameBuffer())
+	if((ws == NULL) || (ret < B_OK))
 	{
 		//printf("the window screen was NULL, or there was an error\n");
 		PostMessage(B_QUIT_REQUESTED);
@@ -171,7 +171,8 @@
 			memset(frame_buffer,0,480*line_length);
 			// spawn the rendering thread. exit if an error occurs.
 			PRINT(("spawning the render thread.\n"));
-			if(resume_thread((tid = spawn_thread(Entry,"rendering thread", B_URGENT_DISPLAY_PRIORITY,this))) < B_OK)
+			tid = spawn_thread(Entry,"rendering thread", B_URGENT_DISPLAY_PRIORITY,this);
+			if(resume_thread(tid) < B_OK)
 			{
 				be_app->PostMessage(B_QUIT_REQUESTED);
 				return;
@@ -214,7 +215,7 @@
 			}
 			if((i>=192) && (i<256))
 			{
-				c1.red = 0; // blues
+				c1.red = 0i; // blues
 				c1.green = 0;
 				c1.blue = j*4;
 				c1.alpha = 255;



From jackburton at mail.berlios.de  Mon Jun 18 14:44:58 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Mon, 18 Jun 2007 14:44:58 +0200
Subject: [Haiku-commits] r21452 - haiku/trunk/src/kits/game
Message-ID: <200706181244.l5ICiw3M008156@sheep.berlios.de>

Author: jackburton
Date: 2007-06-18 14:44:58 +0200 (Mon, 18 Jun 2007)
New Revision: 21452
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21452&view=rev

Modified:
   haiku/trunk/src/kits/game/WindowScreen.cpp
Log:
free() the modelist as it's allocated using malloc. A forgotten printf -> fprintf. minor other stuff.

Modified: haiku/trunk/src/kits/game/WindowScreen.cpp
===================================================================
--- haiku/trunk/src/kits/game/WindowScreen.cpp	2007-06-18 12:36:30 UTC (rev 21451)
+++ haiku/trunk/src/kits/game/WindowScreen.cpp	2007-06-18 12:44:58 UTC (rev 21452)
@@ -31,7 +31,7 @@
 using BPrivate::AppServerLink;
 
 
-#define TRACE_WINDOWSCREEN 0
+//#define TRACE_WINDOWSCREEN 1
 #if TRACE_WINDOWSCREEN
 #define CALLED() printf("%s\n", __PRETTY_FUNCTION__);
 #else
@@ -669,8 +669,7 @@
 	fAttributes = attributes;
 		// TODO: not really used right now, but should probably be known by the app_server
 
-	fWorkspaceIndex = current_workspace();
-	fDebugWorkspace = fWorkspaceIndex > 0 ? fWorkspaceIndex - 1 : 1;
+	fWorkspaceIndex = fDebugWorkspace = current_workspace();
 	fLockState = 0;
 	fAddonImage = -1;
 	fWindowState = 0;
@@ -713,10 +712,12 @@
 		if (fDebugSem < B_OK)
 			throw fDebugSem;
 
-		memcpy(fPalette, screen.ColorMap()->color_list, 256);
+		memcpy(fPalette, screen.ColorMap()->color_list, sizeof(fPalette));
 		fActivateState = 0;
 		fWorkState = 1;
 		
+		status = B_OK;
+
 	} catch (std::bad_alloc) {
 		status = B_NO_MEMORY;	
 	} catch (int error) {
@@ -725,7 +726,7 @@
 		status = B_ERROR;	
 	}
 
-	if (status != B_OK)
+	if (status < B_OK)
 		_DisposeData();
 
 	return status;
@@ -754,7 +755,7 @@
 	fDisplayMode = NULL;
 	delete fOriginalDisplayMode;
 	fOriginalDisplayMode = NULL;
-	delete fModeList;
+	free(fModeList);
 	fModeList = NULL;
 	fModeCount = 0;
 	
@@ -1098,7 +1099,7 @@
 		|| currentMode.flags != displayMode->flags) {
 		status = screen.SetMode(displayMode);
 		if (status < B_OK) {
-			printf("AssertDisplayMode: Setting mode failed: %s\n", strerror(status));
+			fprintf(stderr, "AssertDisplayMode: Setting mode failed: %s\n", strerror(status));
 			return status;
 		}
 



From axeld at mail.berlios.de  Mon Jun 18 14:49:37 2007
From: axeld at mail.berlios.de (axeld at BerliOS)
Date: Mon, 18 Jun 2007 14:49:37 +0200
Subject: [Haiku-commits] r21453 - haiku/trunk/src/tests/kits/net
Message-ID: <200706181249.l5ICnb7O008390@sheep.berlios.de>

Author: axeld
Date: 2007-06-18 14:49:37 +0200 (Mon, 18 Jun 2007)
New Revision: 21453
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21453&view=rev

Modified:
   haiku/trunk/src/tests/kits/net/udp_echo.c
Log:
Print only the tool name instead of the full path.


Modified: haiku/trunk/src/tests/kits/net/udp_echo.c
===================================================================
--- haiku/trunk/src/tests/kits/net/udp_echo.c	2007-06-18 12:44:58 UTC (rev 21452)
+++ haiku/trunk/src/tests/kits/net/udp_echo.c	2007-06-18 12:49:37 UTC (rev 21453)
@@ -24,7 +24,9 @@
 typedef int socklen_t;
 #endif
 
+extern const char* __progname;
 
+
 static void
 udp_echo_client(int sockFD, const struct sockaddr_in* serverAddr)
 {
@@ -134,16 +136,16 @@
 	unsigned short bindPort = 0;
 
 	if (argc < 2) {
-		printf("usage: %s client   [local-port]\n", argv[0]);
-		printf("or     %s broadcast  \n", argv[0]);
-		printf("or     %s server \n", argv[0]);
+		printf("usage: %s client   [local-port]\n", __progname);
+		printf("or     %s broadcast  \n", __progname);
+		printf("or     %s server \n", __progname);
 		exit(5);
 	}
 
 	if (!strcmp(argv[1], "client")) {
 		mode = CLIENT_MODE;
 		if (argc < 4) {
-			printf("usage: %s client   [local-port]\n", argv[0]);
+			printf("usage: %s client   [local-port]\n", __progname);
 			exit(5);
 		}
 		memset(&serverAddr, 0, sizeof(struct sockaddr_in));
@@ -157,7 +159,7 @@
 	} else if (!strcmp(argv[1], "broadcast")) {
 		mode = BROADCAST_MODE;
 		if (argc < 3) {
-			printf("usage: %s broadcast  [local-port]\n", argv[0]);
+			printf("usage: %s broadcast  [local-port]\n", __progname);
 			exit(5);
 		}
 



From jackburton at mail.berlios.de  Mon Jun 18 15:15:58 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Mon, 18 Jun 2007 15:15:58 +0200
Subject: [Haiku-commits] r21454 - in haiku/trunk: headers/os/game
	src/kits/game
Message-ID: <200706181315.l5IDFw7v014851@sheep.berlios.de>

Author: jackburton
Date: 2007-06-18 15:15:58 +0200 (Mon, 18 Jun 2007)
New Revision: 21454
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21454&view=rev

Modified:
   haiku/trunk/headers/os/game/WindowScreen.h
   haiku/trunk/src/kits/game/WindowScreen.cpp
Log:
splitted SetActiveState() into 2 methods, since it was very messy

Modified: haiku/trunk/headers/os/game/WindowScreen.h
===================================================================
--- haiku/trunk/headers/os/game/WindowScreen.h	2007-06-18 12:49:37 UTC (rev 21453)
+++ haiku/trunk/headers/os/game/WindowScreen.h	2007-06-18 13:15:58 UTC (rev 21454)
@@ -80,7 +80,9 @@
 		status_t			_InitData(uint32 space, uint32 attributes);
 		void				_DisposeData();
 
-		status_t			_SetActiveState(int32 state);
+		status_t			_Activate();
+		status_t			_Deactivate();
+
 		status_t			_SetupAccelerantHooks(bool enable);
 		status_t			_GetCardInfo();
 		void				_Suspend();

Modified: haiku/trunk/src/kits/game/WindowScreen.cpp
===================================================================
--- haiku/trunk/src/kits/game/WindowScreen.cpp	2007-06-18 12:49:37 UTC (rev 21453)
+++ haiku/trunk/src/kits/game/WindowScreen.cpp	2007-06-18 13:15:58 UTC (rev 21454)
@@ -341,7 +341,7 @@
 	if (fLockState == 1) {
 		if (fDebugState)
 			fDebugFirst = true;
-		_SetActiveState(0);
+		_Deactivate();
 	}
 
 	be_app->ShowCursor();
@@ -354,7 +354,7 @@
 	CALLED();
 	fWindowState = active;
 	if (active && fLockState == 0 && fWorkState)
-		_SetActiveState(1);
+		_Activate();
 }
 
 
@@ -365,14 +365,14 @@
 	fWorkState = state;
 	if (state) {
 		if (fLockState == 0 && fWindowState) {
-			_SetActiveState(1);
+			_Activate();			
 			if (!IsHidden()) {
 				Activate(true);
 				WindowActivated(true);
 			}
 		}
 	} else if (fLockState)
-		_SetActiveState(0);
+		_Deactivate();
 }
 
 
@@ -763,51 +763,56 @@
 }
 
 
+
 status_t
-BWindowScreen::_SetActiveState(int32 state)
+BWindowScreen::_Activate()
 {
-	CALLED();
-	status_t status = B_ERROR;
-	if (state == 1) {
-		status = _AssertDisplayMode(fDisplayMode);
-		if (status == B_OK && (status = _SetupAccelerantHooks(true)) == B_OK) {			
-			if (!fActivateState) {
-				do {
-					status = acquire_sem(fActivateSem);
-				} while (status == B_INTERRUPTED);
+	status_t status = _AssertDisplayMode(fDisplayMode);
+	if (status < B_OK)
+		return status;
 
-				if (status < B_OK)
-					return status;
-			}
+	status = _SetupAccelerantHooks(true);
+	if (status < B_OK)
+		return status;
+		
+	if (!fActivateState) {
+		do {
+			status = acquire_sem(fActivateSem);
+		} while (status == B_INTERRUPTED);
 
-			SetColorList(fPalette);
-			if (fDebugState && !fDebugFirst) {
-				SuspensionHook(true);
-				_Resume();					
-			} else {
-				fDebugFirst = true;
-				ScreenConnected(true);
-			}
+		if (status < B_OK)
+			return status;
+	}
 
-			if (status == B_OK)
-				return status;
-		} else
-			_SetupAccelerantHooks(false);	
+	SetColorList(fPalette);
+	if (fDebugState && !fDebugFirst) {
+		SuspensionHook(true);
+		_Resume();					
 	} else {
-		_AssertDisplayMode(fOriginalDisplayMode);
+		fDebugFirst = true;
+		ScreenConnected(true);
+	}
 
-		if (fDebugState && !fDebugFirst) {
-			_Suspend();
-			SuspensionHook(false);
-		} else
-			ScreenConnected(false);
+	return B_OK;	
+}
 
-		status = _SetupAccelerantHooks(false);
-		if (status == B_OK) {				
-			be_app->ShowCursor();				
-			if (fActivateState) {
-				// TODO: Set palette
-			}
+
+status_t
+BWindowScreen::_Deactivate()
+{
+	_AssertDisplayMode(fOriginalDisplayMode);
+
+	if (fDebugState && !fDebugFirst) {
+		_Suspend();
+		SuspensionHook(false);
+	} else
+		ScreenConnected(false);
+
+	status_t status = _SetupAccelerantHooks(false);
+	if (status == B_OK) {				
+		be_app->ShowCursor();				
+		if (fActivateState) {
+			// TODO: reset palette
 		}
 	}
 



From jackburton at mail.berlios.de  Mon Jun 18 15:31:47 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Mon, 18 Jun 2007 15:31:47 +0200
Subject: [Haiku-commits] r21455 - in haiku/trunk: headers/private/interface
	src/kits/interface
Message-ID: <200706181331.l5IDVlEs016076@sheep.berlios.de>

Author: jackburton
Date: 2007-06-18 15:31:46 +0200 (Mon, 18 Jun 2007)
New Revision: 21455
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21455&view=rev

Added:
   haiku/trunk/src/kits/interface/TextInput.h
Removed:
   haiku/trunk/headers/private/interface/TextInput.h
Modified:
   haiku/trunk/src/kits/interface/TextInput.cpp
Log:
Moved TextInput.h to src/kits/interface as it's only used there.


Deleted: haiku/trunk/headers/private/interface/TextInput.h

Modified: haiku/trunk/src/kits/interface/TextInput.cpp
===================================================================
--- haiku/trunk/src/kits/interface/TextInput.cpp	2007-06-18 13:15:58 UTC (rev 21454)
+++ haiku/trunk/src/kits/interface/TextInput.cpp	2007-06-18 13:31:46 UTC (rev 21455)
@@ -1,30 +1,12 @@
-//------------------------------------------------------------------------------
-//	Copyright (c) 2001-2004, Haiku, Inc.
-//
-//	Permission is hereby granted, free of charge, to any person obtaining a
-//	copy of this software and associated documentation files (the "Software"),
-//	to deal in the Software without restriction, including without limitation
-//	the rights to use, copy, modify, merge, publish, distribute, sublicense,
-//	and/or sell copies of the Software, and to permit persons to whom the
-//	Software is furnished to do so, subject to the following conditions:
-//
-//	The above copyright notice and this permission notice shall be included in
-//	all copies or substantial portions of the Software.
-//
-//	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-//	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-//	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-//	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-//	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-//	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-//	DEALINGS IN THE SOFTWARE.
-//
-//	File Name:		TextInput.cpp
-//	Authors:		Frans van Nispen (xlr8 at tref.nl)
-//					Marc Flerackers (mflerackers at androme.be)
-//	Description:	The BTextView derivative owned by an instance of
-//					BTextControl.
-//------------------------------------------------------------------------------
+/*
+ * Copyright 2001-2007, Haiku Inc.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *		Frans van Nispen (xlr8 at tref.nl)
+ *		Marc Flerackers (mflerackers at androme.be)
+ */
+
 #include 
 #include 
 #include 

Copied: haiku/trunk/src/kits/interface/TextInput.h (from rev 21449, haiku/trunk/headers/private/interface/TextInput.h)



From jackburton at mail.berlios.de  Mon Jun 18 15:37:43 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Mon, 18 Jun 2007 15:37:43 +0200
Subject: [Haiku-commits] r21456 - haiku/trunk/headers/private/interface
Message-ID: <200706181337.l5IDbhUf016439@sheep.berlios.de>

Author: jackburton
Date: 2007-06-18 15:37:42 +0200 (Mon, 18 Jun 2007)
New Revision: 21456
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21456&view=rev

Modified:
   haiku/trunk/headers/private/interface/ZombieReplicantView.h
Log:
moved kZombieColor to ZombieReplicantView.h


Modified: haiku/trunk/headers/private/interface/ZombieReplicantView.h
===================================================================
--- haiku/trunk/headers/private/interface/ZombieReplicantView.h	2007-06-18 13:31:46 UTC (rev 21455)
+++ haiku/trunk/headers/private/interface/ZombieReplicantView.h	2007-06-18 13:37:42 UTC (rev 21456)
@@ -31,6 +31,9 @@
 #include 
 
 
+const static rgb_color kZombieColor = {220, 220, 220, 255};
+
+
 // _BZombieReplicantView_ class ------------------------------------------------
 class _BZombieReplicantView_ : public BBox {
 



From jackburton at mail.berlios.de  Mon Jun 18 15:38:15 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Mon, 18 Jun 2007 15:38:15 +0200
Subject: [Haiku-commits] r21457 - in haiku/trunk: headers/private/interface
	src/kits/interface
Message-ID: <200706181338.l5IDcFk6016493@sheep.berlios.de>

Author: jackburton
Date: 2007-06-18 15:38:14 +0200 (Mon, 18 Jun 2007)
New Revision: 21457
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21457&view=rev

Added:
   haiku/trunk/src/kits/interface/ZombieReplicantView.h
Removed:
   haiku/trunk/headers/private/interface/ZombieReplicantView.h
Modified:
   haiku/trunk/src/kits/interface/Dragger.cpp
   haiku/trunk/src/kits/interface/Shelf.cpp
   haiku/trunk/src/kits/interface/ZombieReplicantView.cpp
Log:
Moved ZombieReplicantView.h to src/kits/interface


Deleted: haiku/trunk/headers/private/interface/ZombieReplicantView.h

Modified: haiku/trunk/src/kits/interface/Dragger.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Dragger.cpp	2007-06-18 13:37:42 UTC (rev 21456)
+++ haiku/trunk/src/kits/interface/Dragger.cpp	2007-06-18 13:38:14 UTC (rev 21457)
@@ -24,6 +24,8 @@
 #include 
 #include 
 
+#include "ZombieReplicantView.h"
+
 #include 
 #include 
 
@@ -33,7 +35,6 @@
 BLocker BDragger::sLock("BDragger static");
 BList BDragger::sList;
 
-const static rgb_color kZombieColor = {220, 220, 220, 255};
 
 const unsigned char
 kHandBitmap[] = {

Modified: haiku/trunk/src/kits/interface/Shelf.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Shelf.cpp	2007-06-18 13:37:42 UTC (rev 21456)
+++ haiku/trunk/src/kits/interface/Shelf.cpp	2007-06-18 13:38:14 UTC (rev 21457)
@@ -26,8 +26,9 @@
 #include 
 
 #include 
-#include 
 
+#include "ZombieReplicantView.h"
+
 #include 
 #include 
 

Modified: haiku/trunk/src/kits/interface/ZombieReplicantView.cpp
===================================================================
--- haiku/trunk/src/kits/interface/ZombieReplicantView.cpp	2007-06-18 13:37:42 UTC (rev 21456)
+++ haiku/trunk/src/kits/interface/ZombieReplicantView.cpp	2007-06-18 13:38:14 UTC (rev 21457)
@@ -10,7 +10,7 @@
 #include 
 #include 
 
-#include 
+#include "ZombieReplicantView.h"
 
 #include 
 #include 
@@ -18,9 +18,7 @@
 #include 
 
 
-const static rgb_color kZombieColor = {220, 220, 220, 255};
 
-
 _BZombieReplicantView_::_BZombieReplicantView_(BRect frame, status_t error)
 	:
 	BBox(frame, "", B_FOLLOW_NONE, B_WILL_DRAW),

Copied: haiku/trunk/src/kits/interface/ZombieReplicantView.h (from rev 21456, haiku/trunk/headers/private/interface/ZombieReplicantView.h)



From jackburton at mail.berlios.de  Mon Jun 18 15:45:33 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Mon, 18 Jun 2007 15:45:33 +0200
Subject: [Haiku-commits] r21458 - haiku/trunk/headers/private/interface
Message-ID: <200706181345.l5IDjXYF016893@sheep.berlios.de>

Author: jackburton
Date: 2007-06-18 15:45:33 +0200 (Mon, 18 Jun 2007)
New Revision: 21458
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21458&view=rev

Removed:
   haiku/trunk/headers/private/interface/ClientFontList.h
Log:
bye bye ClientFontList.h

Deleted: haiku/trunk/headers/private/interface/ClientFontList.h



From jackburton at mail.berlios.de  Mon Jun 18 16:30:57 2007
From: jackburton at mail.berlios.de (jackburton at BerliOS)
Date: Mon, 18 Jun 2007 16:30:57 +0200
Subject: [Haiku-commits] r21459 - in haiku/trunk: headers/private/interface
	src/kits/game src/kits/interface
Message-ID: <200706181430.l5IEUvGr021087@sheep.berlios.de>

Author: jackburton
Date: 2007-06-18 16:30:56 +0200 (Mon, 18 Jun 2007)
New Revision: 21459
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21459&view=rev

Added:
   haiku/trunk/headers/private/interface/interface_misc.h
Modified:
   haiku/trunk/src/kits/game/WindowScreen.cpp
   haiku/trunk/src/kits/interface/InterfaceDefs.cpp
Log:
moved duplicate code to a common location.


Added: haiku/trunk/headers/private/interface/interface_misc.h
===================================================================
--- haiku/trunk/headers/private/interface/interface_misc.h	2007-06-18 13:45:33 UTC (rev 21458)
+++ haiku/trunk/headers/private/interface/interface_misc.h	2007-06-18 14:30:56 UTC (rev 21459)
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2007, Haiku, Inc.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *		Stefano Ceccherini 
+ */
+
+/**	Various private functions and variables for the Interface Kit */
+
+
+#ifndef __INTERFACE_MISC_H
+#define __INTERFACE_MISC_H
+
+#include 
+
+bool get_mode_parameter(uint32 mode, int32& width, int32& height, uint32& colorSpace);
+
+#endif
+

Modified: haiku/trunk/src/kits/game/WindowScreen.cpp
===================================================================
--- haiku/trunk/src/kits/game/WindowScreen.cpp	2007-06-18 13:45:33 UTC (rev 21458)
+++ haiku/trunk/src/kits/game/WindowScreen.cpp	2007-06-18 14:30:56 UTC (rev 21459)
@@ -23,6 +23,7 @@
 
 #include 
 #include  // For IS_SET_MOUSE_POSITION
+#include 
 #include 
 
 #include 
@@ -167,103 +168,6 @@
 }
 
 
-/*!
-	Fills the \a width, \a height, and \a colorSpace parameters according
-	to the window screen's mode.
-	Returns \c true if the mode is known.
-*/
-static bool
-get_mode_parameter(uint32 mode, int32& width, int32& height, uint32& colorSpace)
-{
-	switch (mode) {
-		case B_8_BIT_640x480:
-		case B_8_BIT_800x600:
-		case B_8_BIT_1024x768:
-   		case B_8_BIT_1152x900:
-		case B_8_BIT_1280x1024:
-		case B_8_BIT_1600x1200:
-			colorSpace = B_CMAP8;
-			break;
-
-		case B_15_BIT_640x480:
-		case B_15_BIT_800x600:
-		case B_15_BIT_1024x768:
-   		case B_15_BIT_1152x900:
-		case B_15_BIT_1280x1024:
-		case B_15_BIT_1600x1200:
-   			colorSpace = B_RGB15;
-   			break;
-
-		case B_16_BIT_640x480:
-		case B_16_BIT_800x600:
-		case B_16_BIT_1024x768:
-   		case B_16_BIT_1152x900:
-		case B_16_BIT_1280x1024:
-		case B_16_BIT_1600x1200:
-			colorSpace = B_RGB16;
-			break;
-
-		case B_32_BIT_640x480:
-		case B_32_BIT_800x600:
-		case B_32_BIT_1024x768:
-   		case B_32_BIT_1152x900:
-		case B_32_BIT_1280x1024:
-		case B_32_BIT_1600x1200:
-			colorSpace = B_RGB32;
-			break;
-
-		default:
-			return false;
-	}
-
-	switch (mode) {
-		case B_8_BIT_640x480:
-		case B_15_BIT_640x480:
-		case B_16_BIT_640x480:
-		case B_32_BIT_640x480:
-			width = 640; height = 480;
-			break;
-
-		case B_8_BIT_800x600:
-		case B_15_BIT_800x600:
-		case B_16_BIT_800x600:
-		case B_32_BIT_800x600:
-			width = 800; height = 600;
-			break;
-
-		case B_8_BIT_1024x768:
-		case B_15_BIT_1024x768:
-		case B_16_BIT_1024x768:
-		case B_32_BIT_1024x768:
-			width = 1024; height = 768;
-			break;
-
-   		case B_8_BIT_1152x900:
-   		case B_15_BIT_1152x900:
-   		case B_16_BIT_1152x900:
-   		case B_32_BIT_1152x900:
-   			width = 1152; height = 900;
-   			break;
-
-		case B_8_BIT_1280x1024:
-		case B_15_BIT_1280x1024:
-		case B_16_BIT_1280x1024:
-		case B_32_BIT_1280x1024:
-			width = 1280; height = 1024;
-			break;
-
-		case B_8_BIT_1600x1200:
-		case B_15_BIT_1600x1200:
-		case B_16_BIT_1600x1200:
-		case B_32_BIT_1600x1200:
-			width = 1600; height = 1200;
-			break;
-	}
-
-	return true;
-}
-
-
 //	#pragma mark - public API calls
 
 

Modified: haiku/trunk/src/kits/interface/InterfaceDefs.cpp
===================================================================
--- haiku/trunk/src/kits/interface/InterfaceDefs.cpp	2007-06-18 13:45:33 UTC (rev 21458)
+++ haiku/trunk/src/kits/interface/InterfaceDefs.cpp	2007-06-18 14:30:56 UTC (rev 21459)
@@ -10,8 +10,9 @@
 
 /**	Global functions and variables for the Interface Kit */
 
-#include "truncate_string.h"
-#include "utf8_functions.h"
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -91,114 +92,100 @@
 const rgb_color* BPrivate::kDefaultColors = &_kDefaultColors[0];
 
 
-static status_t
-mode2parms(uint32 space, uint32 *out_space, int32 *width, int32 *height)
+/*!
+	Fills the \a width, \a height, and \a colorSpace parameters according
+	to the window screen's mode.
+	Returns \c true if the mode is known.
+*/
+bool
+get_mode_parameter(uint32 mode, int32& width, int32& height, uint32& colorSpace)
 {
-	status_t status = B_OK;
-	
-	switch (space) {
+	switch (mode) {
 		case B_8_BIT_640x480:
-			*out_space = B_CMAP8;
-			*width = 640; *height = 480;
-			break;
 		case B_8_BIT_800x600:
-			*out_space = B_CMAP8;
-			*width = 800; *height = 600;
-			break;
 		case B_8_BIT_1024x768:
-			*out_space = B_CMAP8;
-			*width = 1024; *height = 768;
-			break;
+   		case B_8_BIT_1152x900:
 		case B_8_BIT_1280x1024:
-			*out_space = B_CMAP8;
-			*width = 1280; *height = 1024;
-			break;
 		case B_8_BIT_1600x1200:
-			*out_space = B_CMAP8;
-			*width = 1600; *height = 1200;
+			colorSpace = B_CMAP8;
 			break;
+
+		case B_15_BIT_640x480:
+		case B_15_BIT_800x600:
+		case B_15_BIT_1024x768:
+   		case B_15_BIT_1152x900:
+		case B_15_BIT_1280x1024:
+		case B_15_BIT_1600x1200:
+   			colorSpace = B_RGB15;
+   			break;
+
 		case B_16_BIT_640x480:
-			*out_space = B_RGB16;
-			*width = 640; *height = 480;
-			break;
 		case B_16_BIT_800x600:
-			*out_space = B_RGB16;
-			*width = 800; *height = 600;
-			break;
 		case B_16_BIT_1024x768:
-			*out_space = B_RGB16;
-			*width = 1024; *height = 768;
-			break;
+   		case B_16_BIT_1152x900:
 		case B_16_BIT_1280x1024:
-			*out_space = B_RGB16;
-			*width = 1280; *height = 1024;
-			break;
 		case B_16_BIT_1600x1200:
-			*out_space = B_RGB16;
-			*width = 1600; *height = 1200;
+			colorSpace = B_RGB16;
 			break;
+
 		case B_32_BIT_640x480:
-			*out_space = B_RGB32;
-			*width = 640; *height = 480;
-			break;
 		case B_32_BIT_800x600:
-			*out_space = B_RGB32;
-			*width = 800; *height = 600;
-			break;
 		case B_32_BIT_1024x768:
-			*out_space = B_RGB32;
-			*width = 1024; *height = 768;
-			break;
+   		case B_32_BIT_1152x900:
 		case B_32_BIT_1280x1024:
-			*out_space = B_RGB32;
-			*width = 1280; *height = 1024;
-			break;
 		case B_32_BIT_1600x1200:
-			*out_space = B_RGB32;
-			*width = 1600; *height = 1200;
+			colorSpace = B_RGB32;
 			break;
-    		case B_8_BIT_1152x900:
-    			*out_space = B_CMAP8;
-    			*width = 1152; *height = 900;
-    			break;
-    		case B_16_BIT_1152x900:
-    			*out_space = B_RGB16;
-    			*width = 1152; *height = 900;
-    			break;
-    		case B_32_BIT_1152x900:
-    			*out_space = B_RGB32;
-    			*width = 1152; *height = 900;
-    			break;
+
+		default:
+			return false;
+	}
+
+	switch (mode) {
+		case B_8_BIT_640x480:
 		case B_15_BIT_640x480:
-			*out_space = B_RGB15;
-			*width = 640; *height = 480;
+		case B_16_BIT_640x480:
+		case B_32_BIT_640x480:
+			width = 640; height = 480;
 			break;
+
+		case B_8_BIT_800x600:
 		case B_15_BIT_800x600:
-			*out_space = B_RGB15;
-			*width = 800; *height = 600;
+		case B_16_BIT_800x600:
+		case B_32_BIT_800x600:
+			width = 800; height = 600;
 			break;
+
+		case B_8_BIT_1024x768:
 		case B_15_BIT_1024x768:
-			*out_space = B_RGB15;
-			*width = 1024; *height = 768;
+		case B_16_BIT_1024x768:
+		case B_32_BIT_1024x768:
+			width = 1024; height = 768;
 			break;
+
+   		case B_8_BIT_1152x900:
+   		case B_15_BIT_1152x900:
+   		case B_16_BIT_1152x900:
+   		case B_32_BIT_1152x900:
+   			width = 1152; height = 900;
+   			break;
+
+		case B_8_BIT_1280x1024:
 		case B_15_BIT_1280x1024:
-			*out_space = B_RGB15;
-			*width = 1280; *height = 1024;
+		case B_16_BIT_1280x1024:
+		case B_32_BIT_1280x1024:
+			width = 1280; height = 1024;
 			break;
+
+		case B_8_BIT_1600x1200:
 		case B_15_BIT_1600x1200:
-			*out_space = B_RGB15;
-			*width = 1600; *height = 1200;
+		case B_16_BIT_1600x1200:
+		case B_32_BIT_1600x1200:
+			width = 1600; height = 1200;
 			break;
-    		case B_15_BIT_1152x900:
-    			*out_space = B_RGB15;
-    			*width = 1152; *height = 900;
-    			break;
-    		default:
-    			status = B_BAD_VALUE;
-    			break;
 	}
-	
-	return status;
+
+	return true;
 }
 
 
@@ -215,10 +202,8 @@
 	int32 width;
 	int32 height;
 	uint32 depth;
-	
-	status_t status = mode2parms(space, &depth, &width, &height);
-	if (status < B_OK)
-		return status;
+	if (!get_mode_parameter(space, width, height, depth))
+		return B_BAD_VALUE;
 		
 	BScreen screen(B_MAIN_SCREEN_ID);
 	display_mode mode;
@@ -226,7 +211,7 @@
 	// TODO: What about refresh rate ?
 	// currently we get it from the current video mode, but
 	// this might be not so wise.
-	status = screen.GetMode(index, &mode);
+	status_t status = screen.GetMode(index, &mode);
 	if (status < B_OK)
 		return status;
 	



From bonefish at mail.berlios.de  Mon Jun 18 19:35:51 2007
From: bonefish at mail.berlios.de (bonefish at BerliOS)
Date: Mon, 18 Jun 2007 19:35:51 +0200
Subject: [Haiku-commits] r21460 - in haiku/trunk/src/apps/cortex:
	DiagramView DormantNodeView MediaRoutingView TipManager
Message-ID: <200706181735.l5IHZpRM019674@sheep.berlios.de>

Author: bonefish
Date: 2007-06-18 19:35:48 +0200 (Mon, 18 Jun 2007)
New Revision: 21460
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21460&view=rev

Modified:
   haiku/trunk/src/apps/cortex/DiagramView/DiagramBox.cpp
   haiku/trunk/src/apps/cortex/DiagramView/DiagramBox.h
   haiku/trunk/src/apps/cortex/DiagramView/DiagramEndPoint.cpp
   haiku/trunk/src/apps/cortex/DiagramView/DiagramEndPoint.h
   haiku/trunk/src/apps/cortex/DiagramView/DiagramItem.cpp
   haiku/trunk/src/apps/cortex/DiagramView/DiagramItem.h
   haiku/trunk/src/apps/cortex/DiagramView/DiagramItemGroup.cpp
   haiku/trunk/src/apps/cortex/DiagramView/DiagramItemGroup.h
   haiku/trunk/src/apps/cortex/DiagramView/DiagramView.cpp
   haiku/trunk/src/apps/cortex/DiagramView/DiagramView.h
   haiku/trunk/src/apps/cortex/DiagramView/DiagramWire.cpp
   haiku/trunk/src/apps/cortex/DiagramView/DiagramWire.h
   haiku/trunk/src/apps/cortex/DormantNodeView/DormantNodeListItem.cpp
   haiku/trunk/src/apps/cortex/DormantNodeView/DormantNodeListItem.h
   haiku/trunk/src/apps/cortex/DormantNodeView/DormantNodeView.cpp
   haiku/trunk/src/apps/cortex/MediaRoutingView/MediaJack.cpp
   haiku/trunk/src/apps/cortex/MediaRoutingView/MediaJack.h
   haiku/trunk/src/apps/cortex/MediaRoutingView/MediaNodePanel.cpp
   haiku/trunk/src/apps/cortex/MediaRoutingView/MediaNodePanel.h
   haiku/trunk/src/apps/cortex/MediaRoutingView/MediaRoutingView.cpp
   haiku/trunk/src/apps/cortex/MediaRoutingView/MediaRoutingView.h
   haiku/trunk/src/apps/cortex/MediaRoutingView/MediaWire.cpp
   haiku/trunk/src/apps/cortex/MediaRoutingView/MediaWire.h
   haiku/trunk/src/apps/cortex/TipManager/TipManagerImpl.cpp
   haiku/trunk/src/apps/cortex/TipManager/TipManagerImpl.h
Log:
Style changes by Vasilis Kaoutsis.


Modified: haiku/trunk/src/apps/cortex/DiagramView/DiagramBox.cpp
===================================================================
--- haiku/trunk/src/apps/cortex/DiagramView/DiagramBox.cpp	2007-06-18 14:30:56 UTC (rev 21459)
+++ haiku/trunk/src/apps/cortex/DiagramView/DiagramBox.cpp	2007-06-18 17:35:48 UTC (rev 21460)
@@ -1,5 +1,11 @@
 // DiagramBox.cpp
 
+/*! \class DiagramBox
+	DiagramItem subclass providing a basic framework for
+	boxes in diagrams, i.e. objects that can contain various
+	endpoints
+*/
+
 #include "DiagramBox.h"
 #include "DiagramDefs.h"
 #include "DiagramEndPoint.h"
@@ -23,8 +29,8 @@
 DiagramBox::DiagramBox(BRect frame, uint32 flags)
 	: DiagramItem(DiagramItem::M_BOX),
 	DiagramItemGroup(DiagramItem::M_ENDPOINT),
-	m_frame(frame),
-	m_flags(flags)
+	fFrame(frame),
+	fFlags(flags)
 {
 	D_METHOD(("DiagramBox::DiagramBox()\n"));
 	makeDraggable(true);
@@ -37,7 +43,13 @@
 }
 
 
-// derived from DiagramItemGroup (public)
+//	#pragma mark -  derived from DiagramItemGroup (public)
+
+
+/*! Extends the DiagramItemGroup implementation by setting
+	the items owner and calling the attachedToDiagram() hook
+	on it
+*/
 bool
 DiagramBox::AddItem(DiagramItem *item)
 {
@@ -45,7 +57,7 @@
 	if (item) {
 		if (DiagramItemGroup::AddItem(item)) {
 			if (m_view) {
-				item->_setOwner(m_view);
+				item->_SetOwner(m_view);
 				item->attachedToDiagram();
 			}
 			return true;
@@ -55,6 +67,9 @@
 }
 
 
+/*! Extends the DiagramItemGroup implementation by calling 
+	the detachedToDiagram() hook on the \a item
+*/
 bool
 DiagramBox::RemoveItem(DiagramItem *item)
 {
@@ -62,7 +77,7 @@
 	if (item) {
 		item->detachedFromDiagram();
 		if (DiagramItemGroup::RemoveItem(item)) {
-			item->_setOwner(0);
+			item->_SetOwner(0);
 			return true;
 		}
 	}
@@ -70,41 +85,46 @@
 }
 
 
-// derived from DiagramItem (public)
+//	#pragma mark -   derived from DiagramItem (public)
+
+
+/*! Prepares the drawing stack and clipping region, then
+	calls drawBox
+*/
 void
-DiagramBox::draw(BRect updateRect)
+DiagramBox::Draw(BRect updateRect)
 {
-	D_DRAW(("DiagramBox::draw()\n"));
+	D_DRAW(("DiagramBox::Draw()\n"));
 	if (view()) {
 		view()->PushState();
 		{
-			if (m_flags & M_DRAW_UNDER_ENDPOINTS) {
+			if (fFlags & M_DRAW_UNDER_ENDPOINTS) {
 				BRegion region, clipping;
-				region.Include(frame());
+				region.Include(Frame());
 				if (group()->GetClippingAbove(this, &clipping))
 					region.Exclude(&clipping);
 				view()->ConstrainClippingRegion(®ion);
-				drawBox();
+				DrawBox();
 				for (uint32 i = 0; i < CountItems(); i++) {
 					DiagramItem *item = ItemAt(i);
-					if (region.Intersects(item->frame()))
-						item->draw(item->frame());
+					if (region.Intersects(item->Frame()))
+						item->Draw(item->Frame());
 				}
 			} else {
 				BRegion region, clipping;
-				region.Include(frame());
+				region.Include(Frame());
 				if (view()->GetClippingAbove(this, &clipping))
 					region.Exclude(&clipping);
 				for (uint32 i = 0; i < CountItems(); i++) {
 					DiagramItem *item = ItemAt(i);
 					BRect r;
-					if (region.Intersects(r = item->frame())) {
-						item->draw(r);
+					if (region.Intersects(r = item->Frame())) {
+						item->Draw(r);
 						region.Exclude(r);
 					}
 				}
 				view()->ConstrainClippingRegion(®ion);
-				drawBox();
+				DrawBox();
 			}
 		}
 		view()->PopState();
@@ -112,13 +132,16 @@
 }
 
 
+/*! Is called from the parent DiagramViews MouseDown() implementation 
+	if the Box was hit; this version initiates selection and dragging
+*/
 void
-DiagramBox::mouseDown(BPoint point, uint32 buttons, uint32 clicks)
+DiagramBox::MouseDown(BPoint point, uint32 buttons, uint32 clicks)
 {
-	D_MOUSE(("DiagramBox::mouseDown()\n"));
+	D_MOUSE(("DiagramBox::MouseDown()\n"));
 	DiagramItem *item = ItemUnder(point);
 	if (item)
-		item->mouseDown(point, buttons, clicks);
+		item->MouseDown(point, buttons, clicks);
 	else if (clicks == 1) {
 		if (isSelectable()) {
 			BMessage selectMsg(M_SELECTION_CHANGED);
@@ -133,119 +156,138 @@
 		if (isDraggable() && (buttons == B_PRIMARY_MOUSE_BUTTON)) {
 			BMessage dragMsg(M_BOX_DRAGGED);
 			dragMsg.AddPointer("item", static_cast(this));
-			dragMsg.AddPoint("offset", point - frame().LeftTop());
+			dragMsg.AddPoint("offset", point - Frame().LeftTop());
 			view()->DragMessage(&dragMsg, BRect(0.0, 0.0, -1.0, -1.0), view());
 		}
 	}
 }
 
 
+
+/*!	Is called from the DiagramViews MouseMoved() when no message is being 
+	dragged, but the mouse has moved above the box
+*/
 void
-DiagramBox::mouseOver(BPoint point, uint32 transit)
+DiagramBox::MouseOver(BPoint point, uint32 transit)
 {
-	D_MOUSE(("DiagramBox::mouseOver()\n"));
+	D_MOUSE(("DiagramBox::MouseOver()\n"));
 	DiagramItem *last = _LastItemUnder();
 	if (last && (transit == B_EXITED_VIEW)) {
-		last->mouseOver(point, B_EXITED_VIEW);
+		last->MouseOver(point, B_EXITED_VIEW);
 		_ResetItemUnder();
 	} else {
 		DiagramItem *item = ItemUnder(point);
 		if (item) {
 			if (item != last) {
 				if (last)
-					last->mouseOver(point, B_EXITED_VIEW);
-				item->mouseOver(point, B_ENTERED_VIEW);
+					last->MouseOver(point, B_EXITED_VIEW);
+				item->MouseOver(point, B_ENTERED_VIEW);
 			} else
-				item->mouseOver(point, B_INSIDE_VIEW);
+				item->MouseOver(point, B_INSIDE_VIEW);
 		}
 		else if (last)
-			last->mouseOver(point, B_EXITED_VIEW);
+			last->MouseOver(point, B_EXITED_VIEW);
 	}
 }
 
 
+/*!	Is called from the DiagramViews MouseMoved() when a message is being 
+	dragged over the DiagramBox
+*/
 void
-DiagramBox::messageDragged(BPoint point, uint32 transit, const BMessage *message)
+DiagramBox::MessageDragged(BPoint point, uint32 transit, const BMessage *message)
 {
-	D_MOUSE(("DiagramBox::messageDragged()\n"));
+	D_MOUSE(("DiagramBox::MessageDragged()\n"));
 	DiagramItem *last = _LastItemUnder();
 	if (last && (transit == B_EXITED_VIEW)) {
-		last->messageDragged(point, B_EXITED_VIEW, message);
+		last->MessageDragged(point, B_EXITED_VIEW, message);
 		_ResetItemUnder();
 	} else {
 		DiagramItem *item = ItemUnder(point);
 		if (item) {
 			if (item != last) {
 				if (last)
-					last->messageDragged(point, B_EXITED_VIEW, message);
-				item->messageDragged(point, B_ENTERED_VIEW, message);
+					last->MessageDragged(point, B_EXITED_VIEW, message);
+				item->MessageDragged(point, B_ENTERED_VIEW, message);
 			} else
-				item->messageDragged(point, B_INSIDE_VIEW, message);
+				item->MessageDragged(point, B_INSIDE_VIEW, message);
 			return;
 		} else if (last)
-			last->messageDragged(point, B_EXITED_VIEW, message);
+			last->MessageDragged(point, B_EXITED_VIEW, message);
 		if (message->what == M_WIRE_DRAGGED)
 			view()->trackWire(point);
 	}
 }
 
 
+/*!	Is called from the DiagramViews MessageReceived() function when a 
+	message has been dropped on the DiagramBox
+*/
 void
-DiagramBox::messageDropped(BPoint point, BMessage *message)
+DiagramBox::MessageDropped(BPoint point, BMessage *message)
 {
-	D_METHOD(("DiagramBox::messageDropped()\n"));
+	D_METHOD(("DiagramBox::MessageDropped()\n"));
 	DiagramItem *item = ItemUnder(point);
 	if (item) {
-		item->messageDropped(point, message);
+		item->MessageDropped(point, message);
 		return;
 	}
 }
 
 
-// operations (public)
+//	#pragma mark - operations (public)
+
+
+/*!	Moves the box by a given amount, and returns in updateRegion the
+	frames of wires impacted by the move
+*/
 void
-DiagramBox::moveBy(float x, float y, BRegion *wireRegion)
+DiagramBox::MoveBy(float x, float y, BRegion *wireRegion)
 {
-	D_METHOD(("DiagramBox::moveBy()\n"));
+	D_METHOD(("DiagramBox::MoveBy()\n"));
 	if (view()) {
 		view()->PushState();
 		{
 			for (uint32 i = 0; i < CountItems(); i++) {
 				DiagramEndPoint *endPoint = dynamic_cast(ItemAt(i));
 				if (endPoint)
-					endPoint->moveBy(x, y, wireRegion);
+					endPoint->MoveBy(x, y, wireRegion);
 			}
 			if (wireRegion) {
-				wireRegion->Include(m_frame);
-				m_frame.OffsetBy(x, y);
-				wireRegion->Include(m_frame);
+				wireRegion->Include(fFrame);
+				fFrame.OffsetBy(x, y);
+				wireRegion->Include(fFrame);
 			}
 			else
-				m_frame.OffsetBy(x, y);
+				fFrame.OffsetBy(x, y);
 		}
 		view()->PopState();
 	}
 }
 
 
+//! Resizes the boxes frame without doing any updating
 void
-DiagramBox::resizeBy(float horizontal, float vertical)
+DiagramBox::ResizeBy(float horizontal, float vertical)
 {
-	D_METHOD(("DiagramBox::resizeBy()\n"));
-	m_frame.right += horizontal;
-	m_frame.bottom += vertical;
+	D_METHOD(("DiagramBox::ResizeBy()\n"));
+	fFrame.right += horizontal;
+	fFrame.bottom += vertical;
 }
 
 
-// internal operations (private)
+//	#pragma mark - internal operations (private)
+
+
+//!	Is called by the DiagramView when added
 void
-DiagramBox::_setOwner(DiagramView *owner)
+DiagramBox::_SetOwner(DiagramView *owner)
 {
-	D_METHOD(("DiagramBox::_setOwner()\n"));
+	D_METHOD(("DiagramBox::_SetOwner()\n"));
 	m_view = owner;
 	for (uint32 i = 0; i < CountItems(DiagramItem::M_ENDPOINT); i++) {
 		DiagramItem *item = ItemAt(i);
-		item->_setOwner(m_view);
+		item->_SetOwner(m_view);
 		if (m_view)
 			item->attachedToDiagram();
 	}

Modified: haiku/trunk/src/apps/cortex/DiagramView/DiagramBox.h
===================================================================
--- haiku/trunk/src/apps/cortex/DiagramView/DiagramBox.h	2007-06-18 14:30:56 UTC (rev 21459)
+++ haiku/trunk/src/apps/cortex/DiagramView/DiagramBox.h	2007-06-18 17:35:48 UTC (rev 21460)
@@ -1,10 +1,5 @@
 // DiagramBox.h (Cortex/DiagramView.h)
 //
-// * PURPOSE
-//   DiagramItem subclass providing a basic framework for
-//   boxes in diagrams, i.e. objects that can contain various
-//   endpoints
-//
 // * HISTORY
 //   c.lenz		25sep99		Begun
 //
@@ -23,80 +18,55 @@
 
 
 class DiagramBox : public DiagramItem, public DiagramItemGroup {
-	public:	// flags
-
-		enum flag_t {
-			M_DRAW_UNDER_ENDPOINTS = 0x1
-		};
-
 	public:
 		DiagramBox(BRect frame, uint32 flags = 0);
 		virtual ~DiagramBox();
 
-	public:	// hook functions
-		// is called from draw() to do the actual drawing
-		virtual void drawBox() = 0;
+		virtual void DrawBox() = 0;
+			// a hook functions that
+			// is called from Draw() to do the actual drawing
 
-	public:	// derived from DiagramItemGroup
+		// derived from DiagramItemGroup
 
-		// extends the DiagramItemGroup implementation by setting
-		// the items owner and calling the attachedToDiagram() hook
-		// on it
 		virtual bool AddItem(DiagramItem *item);
-
-		// extends the DiagramItemGroup implementation by calling 
-		// the detachedToDiagram() hook on the item
 		virtual bool RemoveItem(DiagramItem *item);
 
-	public:	// derived from DiagramItem
+		// derived from DiagramItem
 
 		// returns the Boxes frame rectangle
-		BRect frame() const { return m_frame; }
+		BRect Frame() const
+		{
+			return fFrame;
+		}
 
-		// prepares the drawing stack and clipping region, then
-		// calls drawBox
-		void draw(BRect updateRect);
+		void Draw(BRect updateRect);
 
-		// is called from the parent DiagramViews MouseDown() implementation 
-		// if the Box was hit; this version initiates selection and dragging
-		virtual void mouseDown(BPoint point, uint32 buttons, uint32 clicks);
+		virtual void MouseDown(BPoint point, uint32 buttons, uint32 clicks);
+		virtual void MouseOver(BPoint point, uint32 transit);
+		
+		virtual void MessageDragged(BPoint point, uint32 transit, const BMessage *message);
+		virtual void MessageDropped(BPoint point, BMessage *message);
 
-		// is called from the DiagramViews MouseMoved() when no message is being 
-		// dragged, but the mouse has moved above the box
-		virtual void mouseOver(BPoint point, uint32 transit);
+		void MoveBy(float x, float y, BRegion *updateRegion);
+		virtual void ResizeBy(float horizontal, float vertical);
 		
-		// is called from the DiagramViews MouseMoved() when a message is being 
-		// dragged over the DiagramBox
-		virtual void messageDragged(BPoint point, uint32 transit, const BMessage *message);
+		enum flag_t {
+			M_DRAW_UNDER_ENDPOINTS = 0x1
+		};
 
-		// is called from the DiagramViews MessageReceived() function when a 
-		// message has been dropped on the DiagramBox
-		virtual void messageDropped(BPoint point, BMessage *message);
+	private:
+		void _SetOwner(DiagramView *owner);
 
-	public:	// operations
-
-		// moves the box by a given amount, and returns in updateRegion the
-		// frames of wires impacted by the move
-		void moveBy(float x, float y, BRegion *updateRegion);
-
-		// resizes the boxes frame without doing any updating		
-		virtual void resizeBy(float horizontal, float vertical);
-
-	private:// internal methods
-
-		// is called by the DiagramView when added
-		void _setOwner(DiagramView *owner);
-
 	private:
-	
-		// the boxes' frame rectangle
-		BRect m_frame;
+		BRect fFrame;
+			// the boxes' frame rectangle
 
 		// flags:
 		// 	M_DRAW_UNDER_ENDPOINTS -  don't remove EndPoint frames from
 		//							the clipping region
-		uint32 m_flags;
+		uint32 fFlags;
 };
 
 __END_CORTEX_NAMESPACE
+
 #endif	// DIAGRAM_BOX_H

Modified: haiku/trunk/src/apps/cortex/DiagramView/DiagramEndPoint.cpp
===================================================================
--- haiku/trunk/src/apps/cortex/DiagramView/DiagramEndPoint.cpp	2007-06-18 14:30:56 UTC (rev 21459)
+++ haiku/trunk/src/apps/cortex/DiagramView/DiagramEndPoint.cpp	2007-06-18 17:35:48 UTC (rev 21460)
@@ -42,7 +42,7 @@
 BPoint DiagramEndPoint::connectionPoint() const
 {
 	D_METHOD(("DiagramEndPoint::connectionPoint()\n"));
-	return BPoint(frame().left + frame().Height() / 2.0, frame().top + frame().Width() / 2.0);
+	return BPoint(Frame().left + Frame().Height() / 2.0, Frame().top + Frame().Width() / 2.0);
 }
 
 bool DiagramEndPoint::connectionRequested(
@@ -60,16 +60,16 @@
 // *** derived from DiagramItem
 // -------------------------------------------------------- //
 
-void DiagramEndPoint::draw(
+void DiagramEndPoint::Draw(
 	BRect updateRect)
 {
-	D_METHOD(("DiagramEndPoint::draw()\n"));
+	D_METHOD(("DiagramEndPoint::Draw()\n"));
 	if (view())
 	{
 		view()->PushState();
 		{
 			BRegion region;
-			region.Include(frame() & updateRect);
+			region.Include(Frame() & updateRect);
 			view()->ConstrainClippingRegion(®ion);
 			drawEndPoint();
 		}
@@ -77,12 +77,12 @@
 	}
 }
 
-void DiagramEndPoint::mouseDown(
+void DiagramEndPoint::MouseDown(
 	BPoint point,
 	uint32 buttons,
 	uint32 clicks)
 {
-	D_MOUSE(("DiagramEndPoint::mouseDown()\n"));
+	D_MOUSE(("DiagramEndPoint::MouseDown()\n"));
 	if (clicks == 1)
 	{
 		if (isSelectable())
@@ -105,22 +105,22 @@
 			BMessage dragMsg(M_WIRE_DRAGGED);
 			dragMsg.AddPointer("from", static_cast(this));
 			view()->DragMessage(&dragMsg, BRect(0.0, 0.0, -1.0, -1.0), view());
-			view()->messageDragged(point, B_INSIDE_VIEW, &dragMsg);
+			view()->MessageDragged(point, B_INSIDE_VIEW, &dragMsg);
 		}
 	}
 }
 
-void DiagramEndPoint::messageDragged(
+void DiagramEndPoint::MessageDragged(
 	BPoint point,
 	uint32 transit,
 	const BMessage *message)
 {
-	D_MOUSE(("DiagramEndPoint::messageDragged()\n"));
+	D_MOUSE(("DiagramEndPoint::MessageDragged()\n"));
 	switch (message->what)
 	{
 		case M_WIRE_DRAGGED:
 		{
-			D_MESSAGE(("DiagramEndPoint::messageDragged(M_WIRE_DRAGGED)\n"));
+			D_MESSAGE(("DiagramEndPoint::MessageDragged(M_WIRE_DRAGGED)\n"));
 			switch (transit)
 			{
 				case B_INSIDE_VIEW:
@@ -186,21 +186,21 @@
 		}
 		default:
 		{
-			DiagramItem::messageDragged(point, transit, message);
+			DiagramItem::MessageDragged(point, transit, message);
 		}
 	}
 }
 
-void DiagramEndPoint::messageDropped(
+void DiagramEndPoint::MessageDropped(
 	BPoint point,
 	BMessage *message)
 {
-	D_MESSAGE(("DiagramEndPoint::messageDropped()\n"));
+	D_MESSAGE(("DiagramEndPoint::MessageDropped()\n"));
 	switch (message->what)
 	{
 		case M_WIRE_DRAGGED:
 		{
-			D_MESSAGE(("DiagramEndPoint::messageDropped(M_WIRE_DRAGGED)\n"));
+			D_MESSAGE(("DiagramEndPoint::MessageDropped(M_WIRE_DRAGGED)\n"));
 			DiagramEndPoint *endPoint;
 			if ((message->FindPointer("from", reinterpret_cast(&endPoint)) == B_OK)
 			 && (endPoint != this))
@@ -222,7 +222,7 @@
 		}
 		default:
 		{
-			DiagramItem::messageDropped(point, message);
+			DiagramItem::MessageDropped(point, message);
 		}
 	}
 }
@@ -231,18 +231,18 @@
 // *** frame related operations
 // -------------------------------------------------------- //
 
-void DiagramEndPoint::moveBy(
+void DiagramEndPoint::MoveBy(
 	float x,
 	float y,
 	BRegion *updateRegion)
 {
-	D_METHOD(("DiagramEndPoint::moveBy()\n"));
+	D_METHOD(("DiagramEndPoint::MoveBy()\n"));
 	if (isConnected() && m_wire && updateRegion)
 	{	
-		updateRegion->Include(m_wire->frame());
+		updateRegion->Include(m_wire->Frame());
 		m_frame.OffsetBy(x, y);
 		m_wire->endPointMoved(this);
-		updateRegion->Include(m_wire->frame());
+		updateRegion->Include(m_wire->Frame());
 	}
 	else
 	{
@@ -254,11 +254,11 @@
 	}
 }
 
-void DiagramEndPoint::resizeBy(
+void DiagramEndPoint::ResizeBy(
 	float horizontal,
 	float vertical)
 {
-	D_METHOD(("DiagramEndPoint::resizeBy()\n"));
+	D_METHOD(("DiagramEndPoint::ResizeBy()\n"));
 	m_frame.right += horizontal;
 	m_frame.bottom += vertical;
 }

Modified: haiku/trunk/src/apps/cortex/DiagramView/DiagramEndPoint.h
===================================================================
--- haiku/trunk/src/apps/cortex/DiagramView/DiagramEndPoint.h	2007-06-18 14:30:56 UTC (rev 21459)
+++ haiku/trunk/src/apps/cortex/DiagramView/DiagramEndPoint.h	2007-06-18 17:35:48 UTC (rev 21460)
@@ -38,7 +38,7 @@
 
 public:					// *** hook functions
 
-	// is called from draw() to do the actual drawing
+	// is called from Draw() to do the actual drawing
 	virtual void		drawEndPoint() = 0;
 
 	// should return the BPoint that a connected wire uses as
@@ -46,7 +46,7 @@
 	// point of the EndPoint
 	virtual BPoint		connectionPoint() const;
 
-	// is called from messageDragged() and messageDropped() to 
+	// is called from MessageDragged() and MessageDropped() to 
 	// let you verify that a connection is okay
 	virtual bool		connectionRequested(
 							DiagramEndPoint *fromWhich);
@@ -64,42 +64,42 @@
 public:					// *** derived from DiagramItem
 
 	// returns the EndPoints frame rectangle
-	BRect				frame() const
+	BRect				Frame() const
 						{ return m_frame; }
 
 	// prepares the drawing stack and clipping region, then
 	// calls drawEndPoint
-	void				draw(
+	void				Draw(
 							BRect updateRect);
 
-	// is called from the parent DiagramBox's mouseDown() 
+	// is called from the parent DiagramBox's MouseDown() 
 	// implementation if the EndPoint was hit; this version
 	// initiates selection and dragging (i.e. connecting)
-	virtual void		mouseDown(
+	virtual void		MouseDown(
 							BPoint point,
 							uint32 buttons,
 							uint32 clicks);
 
-	// is called from the parent DiagramBox's mouseOver()
+	// is called from the parent DiagramBox's MouseOver()
 	// implementation if the mouse is over the EndPoint
-	virtual void		mouseOver(
+	virtual void		MouseOver(
 							BPoint point,
 							uint32 transit)
 						{ /* does nothing */ }
 
-	// is called from the parent DiagramBox's messageDragged()
+	// is called from the parent DiagramBox's MessageDragged()
 	// implementation of a message is being dragged of the
 	// EndPoint; this implementation handles only wire drags
 	// (i.e. M_WIRE_DRAGGED messages)
-	virtual void		messageDragged(
+	virtual void		MessageDragged(
 							BPoint point,
 							uint32 transit,
 							const BMessage *message);
 							
-	// is called from the parent DiagramBox's messageDropped()
+	// is called from the parent DiagramBox's MessageDropped()
 	// implementation if the message was dropped on the EndPoint;
 	// this version handles wire dropping (connecting)
-	virtual void		messageDropped(
+	virtual void		MessageDropped(
 							BPoint point,
 							BMessage *message);
 								
@@ -107,13 +107,13 @@
 	// updateRegion the frames of connected wires if there are any
 	// NOTE: no drawing/refreshing is done in this method, that's
 	// up to the parent
-	void				moveBy(
+	void				MoveBy(
 							float x,
 							float y,
 							BRegion *updateRegion);
 		
 	// resize the EndPoints frame rectangle without redraw
-	virtual void		resizeBy(
+	virtual void		ResizeBy(
 							float horizontal,
 							float vertical);
 

Modified: haiku/trunk/src/apps/cortex/DiagramView/DiagramItem.cpp
===================================================================
--- haiku/trunk/src/apps/cortex/DiagramView/DiagramItem.cpp	2007-06-18 14:30:56 UTC (rev 21459)
+++ haiku/trunk/src/apps/cortex/DiagramView/DiagramItem.cpp	2007-06-18 17:35:48 UTC (rev 21460)
@@ -50,7 +50,7 @@
 		m_lastSelectionTime = m_selectionTime = system_time();
 		m_countSelected = 1;
 		selected();
-		view()->Invalidate(frame());
+		view()->Invalidate(Frame());
 	}
 }
 
@@ -62,7 +62,7 @@
 		m_selected = true;
 		m_selectionTime = m_lastSelectionTime - m_countSelected++;
 		selected();
-		view()->Invalidate(frame());
+		view()->Invalidate(Frame());
 	}
 }
 
@@ -73,7 +73,7 @@
 	{
 		m_selected = false;
 		deselected();
-		view()->Invalidate(frame());
+		view()->Invalidate(Frame());
 	}
 }
 
@@ -85,7 +85,7 @@
 	BPoint point) const
 {
 	D_METHOD(("DiagramItem::howCloseTo()\n"));
-	if (frame().Contains(point))
+	if (Frame().Contains(point))
 	{
 		return 1.0;
 	}

Modified: haiku/trunk/src/apps/cortex/DiagramView/DiagramItem.h
===================================================================
--- haiku/trunk/src/apps/cortex/DiagramView/DiagramItem.h	2007-06-18 14:30:56 UTC (rev 21459)
+++ haiku/trunk/src/apps/cortex/DiagramView/DiagramItem.h	2007-06-18 17:35:48 UTC (rev 21460)
@@ -89,19 +89,19 @@
 	// state has actually changed
 	void				deselect();
 
-	// moves the items frame to a given point by calling moveBy with the 
+	// moves the items frame to a given point by calling MoveBy with the 
 	// absolute coords translated into relative shift amount
 	void				moveTo(
 							BPoint point,
 							BRegion *updateRegion = 0)
-						{ moveBy(point.x - frame().left, point.y - frame().top, updateRegion); }
+						{ MoveBy(point.x - Frame().left, point.y - Frame().top, updateRegion); }
 
-	// resizes the items frame to given dimensions; simply calls the resizeBy
+	// resizes the items frame to given dimensions; simply calls the ResizeBy
 	// implementation
 	void				resizeTo(
 							float width,
 							float height)
-						{ resizeBy(width - frame().Width(), height - frame().Height()); }
+						{ ResizeBy(width - Frame().Width(), height - Frame().Height()); }
 
 public:					// *** hook functions
 
@@ -117,7 +117,7 @@
 	
 	// is called from the DiagramViews MouseDown() function after
 	// finding out the mouse buttons and clicks quantity.
-	virtual void		mouseDown(
+	virtual void		MouseDown(
 							BPoint point,
 							uint32 buttons,
 							uint32 clicks)
@@ -125,14 +125,14 @@
 
 	// is called from the DiagramViews MouseMoved() when *no* message is being 
 	// dragged, i.e. the mouse is simply floating above the item
-	virtual void		mouseOver(
+	virtual void		MouseOver(
 							BPoint point,
 							uint32 transit)
 						{/* does nothing */}
 
 	// is called from the DiagramViews MouseMoved() when a message is being
 	// dragged; always call the base class version when overriding!
-	virtual void		messageDragged(
+	virtual void		MessageDragged(
 							BPoint point,
 							uint32 transit,
 							const BMessage *message)
@@ -141,7 +141,7 @@
 	// is called from the DiagramViews MessageReceived() function when an 
 	// message has been received through Drag&Drop; always call the base
 	// class version when overriding!
-	virtual void		messageDropped(
+	virtual void		MessageDropped(
 							BPoint point,
 							BMessage *message)
 						{/* does nothing */}
@@ -156,7 +156,7 @@
 
 	// this function must be implemented by derived classes to return the
 	// items frame rectangle in the DiagramViews coordinates
-	virtual BRect		frame() const = 0;
+	virtual BRect		Frame() const = 0;
 	
 	// this function should be implemented for non-rectangular subclasses
 	// (like wires) to estimate how close a given point is to the object;
@@ -166,8 +166,8 @@
 							BPoint point) const;
 
 	// this is the hook function called by DiagramView when it's time to
-	// draw the object
-	virtual void		draw(
+	// Draw the object
+	virtual void		Draw(
 							BRect updateRect) = 0;
 
 	// should move the items frame by the specified amount and do the
@@ -175,14 +175,14 @@
 	// caller supplied a BRegion pointer in updateRegion, this method
 	// should add other areas affected by the move to it (e.g. wire
 	// frames)
-	virtual void		moveBy(
+	virtual void		MoveBy(
 							float x,
 							float y,
 							BRegion *updateRegion = 0)
 						{ /* does nothing */ }
 
 	// should resize the items frame by the specified amount
-	virtual void		resizeBy(
+	virtual void		ResizeBy(
 							float horizontal,
 							float vertical)
 						{ /* does nothing */ }
@@ -215,7 +215,7 @@
 
 	// called only by DiagramItemGroup objects in the method
 	// addItem()
-	virtual void		_setOwner(
+	virtual void		_SetOwner(
 							DiagramView *owner) 
 						{ m_view = owner; }
 

Modified: haiku/trunk/src/apps/cortex/DiagramView/DiagramItemGroup.cpp
===================================================================
--- haiku/trunk/src/apps/cortex/DiagramView/DiagramItemGroup.cpp	2007-06-18 14:30:56 UTC (rev 21459)
+++ haiku/trunk/src/apps/cortex/DiagramView/DiagramItemGroup.cpp	2007-06-18 17:35:48 UTC (rev 21460)
@@ -20,7 +20,7 @@
 
 
 DiagramItemGroup::DiagramItemGroup(uint32 acceptedTypes, bool multiSelection)
-	: fBoxes(0),
+	:fBoxes(0),
 	fWires(0),
 	fEndPoints(0),
 	fSelection(0),
@@ -74,8 +74,9 @@
 //	#pragma mark - item accessors
 
 
-//! Returns the number of items in the group (optionally only those
-//	of the given type \param whichType)
+/*! Returns the number of items in the group (optionally only those
+	of the given type \param whichType)
+*/
 uint32
 DiagramItemGroup::CountItems(uint32 whichType) const
 {
@@ -149,7 +150,7 @@
 	if (fTypes & DiagramItem::M_BOX) {
 		for (uint32 i = 0; i < CountItems(DiagramItem::M_BOX); i++) {
 			DiagramItem *item = ItemAt(i, DiagramItem::M_BOX);
-			if (item->frame().Contains(point) && (item->howCloseTo(point) == 1.0)) {
+			if (item->Frame().Contains(point) && (item->howCloseTo(point) == 1.0)) {
 				// DiagramItemGroup *group = dynamic_cast(item);
 				return (fLastItemUnder = item);
 			}
@@ -161,7 +162,7 @@
 		DiagramItem *closestItem = 0;
 		for (uint32 i = 0; i < CountItems(DiagramItem::M_WIRE); i++) {
 			DiagramItem *item = ItemAt(i, DiagramItem::M_WIRE);
-			if (item->frame().Contains(point)) {
+			if (item->Frame().Contains(point)) {
 				float howClose = item->howCloseTo(point);
 				if (howClose > closest) {
 					closestItem = item;
@@ -179,7 +180,7 @@
 	if (fTypes & DiagramItem::M_ENDPOINT) {
 		for (uint32 i = 0; i < CountItems(DiagramItem::M_ENDPOINT); i++) {
 			DiagramItem *item = ItemAt(i, DiagramItem::M_ENDPOINT);
-			if (item->frame().Contains(point) && (item->howCloseTo(point) == 1.0))
+			if (item->Frame().Contains(point) && (item->howCloseTo(point) == 1.0))
 				return (fLastItemUnder = item);
 		}
 	}
@@ -295,7 +296,7 @@
 }
 
 
-/*! Fires a draw() command at all items of a specific type that
+/*! Fires a Draw() command at all items of a specific type that
 	intersect with the \param updateRect;
 	items are drawn in reverse order; they should be sorted by
 	selection time before this function gets called, so that
@@ -308,18 +309,18 @@
 	if (whichType & DiagramItem::M_WIRE) {
 		for (int32 i = CountItems(DiagramItem::M_WIRE) - 1; i >= 0; i--) {
 			DiagramItem *item = ItemAt(i, DiagramItem::M_WIRE);
-			if (item->frame().Intersects(updateRect))
-				item->draw(updateRect);
+			if (item->Frame().Intersects(updateRect))
+				item->Draw(updateRect);
 		}
 	}
 
 	if (whichType & DiagramItem::M_BOX) {
 		for (int32 i = CountItems(DiagramItem::M_BOX) - 1; i >= 0; i--) {
 			DiagramItem *item = ItemAt(i, DiagramItem::M_BOX);
-			if (item && item->frame().Intersects(updateRect)) {	
-				item->draw(updateRect);
+			if (item && item->Frame().Intersects(updateRect)) {	
+				item->Draw(updateRect);
 				if (updateRegion)
-					updateRegion->Exclude(item->frame());
+					updateRegion->Exclude(item->Frame());
 			}
 		}
 	}
@@ -327,8 +328,8 @@
 	if (whichType & DiagramItem::M_ENDPOINT) {
 		for (int32 i = CountItems(DiagramItem::M_ENDPOINT) - 1; i >= 0; i--) {
 			DiagramItem *item = ItemAt(i, DiagramItem::M_ENDPOINT);
-			if (item && item->frame().Intersects(updateRect))
-				item->draw(updateRect);
+			if (item && item->Frame().Intersects(updateRect))
+				item->Draw(updateRect);
 		}
 	}
 }
@@ -349,11 +350,11 @@
 			{
 				int32 index = fBoxes->IndexOf(which);
 				if (index >= 0) { // the item was found
-					BRect r = which->frame();
+					BRect r = which->Frame();
 					for (int32 i = 0; i < index; i++) {
 						DiagramItem *item = ItemAt(i, DiagramItem::M_BOX);
-						if (item && item->frame().Intersects(r)) {
-							region->Include(item->frame() & r);
+						if (item && item->Frame().Intersects(r)) {
+							region->Include(item->Frame() & r);
 							found = true;
 						}
 					}
@@ -363,11 +364,11 @@
 
 			case DiagramItem::M_WIRE:
 			{
-				BRect r = which->frame();
+				BRect r = which->Frame();
 				for (uint32 i = 0; i < CountItems(DiagramItem::M_BOX); i++) {
 					DiagramItem *item = ItemAt(i, DiagramItem::M_BOX);
-					if (item && item->frame().Intersects(r)) {
-						region->Include(item->frame() & r);
+					if (item && item->Frame().Intersects(r)) {
+						region->Include(item->Frame() & r);
 						found = true;
 					}
 				}
@@ -549,7 +550,7 @@
 			for (int32 i = CountSelectedItems() - 1; i >= 0; i--) {
 				DiagramItem *item = dynamic_cast(SelectedItemAt(i));
 				if (item->isDraggable())
-					item->moveBy(x, y, updateRegion);
+					item->MoveBy(x, y, updateRegion);
 			}
 		}
 	}

Modified: haiku/trunk/src/apps/cortex/DiagramView/DiagramItemGroup.h
===================================================================
--- haiku/trunk/src/apps/cortex/DiagramView/DiagramItemGroup.h	2007-06-18 14:30:56 UTC (rev 21459)
+++ haiku/trunk/src/apps/cortex/DiagramView/DiagramItemGroup.h	2007-06-18 17:35:48 UTC (rev 21460)
@@ -24,19 +24,21 @@
 		DiagramItemGroup(uint32 acceptedTypes, bool multiSelection = true);
 		virtual ~DiagramItemGroup();
 
-	public: // hook functions
+		// hook function
 		// is called whenever the current selection has changed
 		virtual void SelectionChanged()
 		{
 		}
 
-	public: // item accessors
+		// item accessors
+
 		uint32 CountItems(uint32 whichType = DiagramItem::M_ANY) const;
 		DiagramItem* ItemAt(uint32 index,
 			uint32 whichType = DiagramItem::M_ANY) const;
 		DiagramItem* ItemUnder(BPoint point);
 
-	public: // item operations
+		// item operations
+
 		virtual bool AddItem(DiagramItem* item);

[... truncated: 1442 lines follow ...]


From axeld at mail.berlios.de  Tue Jun 19 01:58:16 2007
From: axeld at mail.berlios.de (axeld at BerliOS)
Date: Tue, 19 Jun 2007 01:58:16 +0200
Subject: [Haiku-commits] r21461 - haiku/trunk/src/system/kernel/cache
Message-ID: <200706182358.l5INwG7s003230@sheep.berlios.de>

Author: axeld
Date: 2007-06-19 01:58:15 +0200 (Tue, 19 Jun 2007)
New Revision: 21461
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21461&view=rev

Modified:
   haiku/trunk/src/system/kernel/cache/block_cache.cpp
   haiku/trunk/src/system/kernel/cache/block_cache_private.h
Log:
Added some temporary means to ease debugging block caches - at least the list
of all caches should be removed at a later point.


Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp
===================================================================
--- haiku/trunk/src/system/kernel/cache/block_cache.cpp	2007-06-18 17:35:48 UTC (rev 21460)
+++ haiku/trunk/src/system/kernel/cache/block_cache.cpp	2007-06-18 23:58:15 UTC (rev 21461)
@@ -39,6 +39,8 @@
 #	define TRACE(x) ;
 #endif
 
+#define DEBUG_BLOCK_CACHE
+
 // This macro is used for fatal situations that are acceptable in a running
 // system, like out of memory situations - should only panic for debugging.
 #define FATAL(x) panic x
@@ -62,6 +64,12 @@
 	bool deleteTransaction = true);
 
 
+#ifdef DEBUG_BLOCK_CACHE
+static DoublyLinkedList sCaches;
+static mutex sCachesLock;
+#endif
+
+
 //	#pragma mark - private transaction
 
 
@@ -161,6 +169,12 @@
 	ranges_hash(NULL),
 	read_only(readOnly)
 {
+#ifdef DEBUG_BLOCK_CACHE
+	mutex_lock(&sCachesLock);
+	sCaches.Add(this);
+	mutex_unlock(&sCachesLock);
+#endif
+
 	hash = hash_init(32, 0, &cached_block::Compare, &cached_block::Hash);
 	if (hash == NULL)
 		return;
@@ -188,6 +202,12 @@
 
 block_cache::~block_cache()
 {
+#ifdef DEBUG_BLOCK_CACHE
+	mutex_lock(&sCachesLock);
+	sCaches.Remove(this);
+	mutex_unlock(&sCachesLock);
+#endif
+
 	unregister_low_memory_handler(&block_cache::LowMemoryHandler, this);
 
 	benaphore_destroy(&lock);
@@ -431,6 +451,8 @@
 		&& block->previous_transaction == NULL) {
 		// put this block in the list of unused blocks
 		block->unused = true;
+if (block->original_data != NULL || block->parent_data != NULL)
+	panic("put_cached_block(): %p (%Ld): %p, %p\n", block, block->block_number, block->original_data, block->parent_data);
 		cache->unused_blocks.Add(block);
 //		block->current_data = cache->allocator->Release(block->current_data);
 	}
@@ -697,9 +719,94 @@
 }
 
 
+#ifdef DEBUG_BLOCK_CACHE
+static int
+dump_cache(int argc, char **argv)
+{
+	if (argc < 2) {
+		kprintf("usage: %s [-b] 
\n", argv[0]); + return 0; + } + + bool showBlocks = false; + int32 i = 1; + if (!strcmp(argv[1], "-b")) { + showBlocks = true; + i++; + } + + block_cache *cache = (struct block_cache *)strtoul(argv[i], NULL, 0); + if (cache == NULL) { + kprintf("invalid cache address\n"); + return 0; + } + + kprintf("BLOCK CACHE: %p\n", cache); + + kprintf(" fd: %d\n", cache->fd); + kprintf(" max_blocks: %Ld\n", cache->max_blocks); + kprintf(" block_size: %lu\n", cache->block_size); + kprintf(" next_transaction_id: %ld\n", cache->next_transaction_id); + kprintf(" chunks_per_range: %lu\n", cache->chunks_per_range); + kprintf(" chunks_size: %lu\n", cache->chunk_size); + kprintf(" range_mask: %lu\n", cache->range_mask); + kprintf(" chunks_mask: %lu\n", cache->chunk_mask); + + if (showBlocks) { + kprintf(" blocks:\n"); + kprintf("address block no. current original parent refs access flags transact prev. trans\n"); + } + + uint32 count = 0; + hash_iterator iterator; + hash_open(cache->hash, &iterator); + cached_block *block; + while ((block = (cached_block *)hash_next(cache->hash, &iterator)) != NULL) { + if (showBlocks) { + kprintf("%08lx %9Ld %08lx %08lx %08lx %5ld %6ld %c%c%c%c%c %08lx %08lx\n", + (addr_t)block, block->block_number, (addr_t)block->current_data, + (addr_t)block->original_data, (addr_t)block->parent_data, + block->ref_count, block->accessed, block->busy ? 'B' : '-', + block->is_writing ? 'W' : '-', block->is_dirty ? 'B' : '-', + block->unused ? 'U' : '-', block->unmapped ? 'M' : '-', + (addr_t)block->transaction, (addr_t)block->previous_transaction); + } + count++; + } + + kprintf(" %ld blocks.\n", count); + + hash_close(cache->hash, &iterator, false); + return 0; +} + + +static int +dump_caches(int argc, char **argv) +{ + kprintf("Block caches:\n"); + DoublyLinkedList::Iterator i = sCaches.GetIterator(); + while (i.HasNext()) { + kprintf(" %p\n", i.Next()); + } + + return 0; +} +#endif // DEBUG_BLOCK_CACHE + + extern "C" status_t block_cache_init(void) { +#ifdef DEBUG_BLOCK_CACHE + mutex_init(&sCachesLock, "block caches"); + new (&sCaches) DoublyLinkedList; + // manually call constructor + + add_debugger_command("block_caches", &dump_caches, "dumps all block caches"); + add_debugger_command("block_cache", &dump_cache, "dumps a specific block cache"); +#endif + return init_block_allocator(); } Modified: haiku/trunk/src/system/kernel/cache/block_cache_private.h =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache_private.h 2007-06-18 17:35:48 UTC (rev 21460) +++ haiku/trunk/src/system/kernel/cache/block_cache_private.h 2007-06-18 23:58:15 UTC (rev 21461) @@ -97,7 +97,7 @@ DoublyLinkedListMemberGetLink > range_list; -struct block_cache { +struct block_cache : DoublyLinkedListLinkImpl { hash_table *hash; benaphore lock; int fd; From mmlr at mail.berlios.de Tue Jun 19 11:33:30 2007 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Tue, 19 Jun 2007 11:33:30 +0200 Subject: [Haiku-commits] r21462 - haiku/trunk/src/kits/tracker Message-ID: <200706190933.l5J9XU9Q017791@sheep.berlios.de> Author: mmlr Date: 2007-06-19 11:33:29 +0200 (Tue, 19 Jun 2007) New Revision: 21462 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21462&view=rev Modified: haiku/trunk/src/kits/tracker/Pose.cpp haiku/trunk/src/kits/tracker/Pose.h haiku/trunk/src/kits/tracker/PoseList.cpp haiku/trunk/src/kits/tracker/PoseList.h haiku/trunk/src/kits/tracker/PoseView.cpp haiku/trunk/src/kits/tracker/PoseView.h haiku/trunk/src/kits/tracker/SettingsViews.cpp haiku/trunk/src/kits/tracker/Tracker.cpp haiku/trunk/src/kits/tracker/Utilities.cpp haiku/trunk/src/kits/tracker/Utilities.h Log: Reworked the handling of periodically updated poses (currently only ones with a volume space bar): * Addad global list where poses that need periodic updates can be registered with a callback * Use this mechanism for poses with a volume space bar * Create only one BVolume when the BPose is created for a volume, instead of every time the free space is calculated * On Pulse() the global list is used to update all of the registered periodic update poses * As the poses know their volume, it is no longer necessary to use a BVolumeRoster to loop through each volume on each Pulse() * Removed the now superfluous SendNotices() mechanism * Removed corresponding watching / handling of these notices in BPoseView The BPoseView did a linear search for each volume pose on each Pulse() before. What's more it did this once for each mounted volume as it did get one individual notice for each of them. To get these volumes a BVolumeRoster was used to loop through the volumes, but then the BPose did still create a new BVolume to actually calculate the free space! I'm surprised that it did not suck away more performance with this method... Anyway, this should bring down BVolume construction and update overhead down to a minimum and hopefully fix ticket #1247. Modified: haiku/trunk/src/kits/tracker/Pose.cpp =================================================================== --- haiku/trunk/src/kits/tracker/Pose.cpp 2007-06-18 23:58:15 UTC (rev 21461) +++ haiku/trunk/src/kits/tracker/Pose.cpp 2007-06-19 09:33:29 UTC (rev 21462) @@ -49,32 +49,15 @@ int32 -CalcFreeSpace(dev_t device) +CalcFreeSpace(BVolume *volume) { - BVolume volume(device); - fs_info info; - if (volume.InitCheck() == B_OK && fs_stat_dev(device,&info) == B_OK) { - // Philosophy here: - // Bars go on all drives with read/write capabilities - // Exceptions: Not on CDDA, but on NTFS/Ext2 - // Also note that some volumes may return 0 when - // BVolume::Capacity() is called (believe-me... That *DOES* - // happen) so we also check for that. - off_t capacity = volume.Capacity(); - if (((!volume.IsReadOnly() && strcmp(info.fsh_name,"cdda")) - || !strcmp(info.fsh_name,"ntfs") - || !strcmp(info.fsh_name,"ext2")) - && (capacity > 0)) { - int32 percent = static_cast(volume.FreeBytes() / (capacity / 100)); + off_t capacity = volume->Capacity(); + int32 percent = static_cast(volume->FreeBytes() / (capacity / 100)); - // warn below 20 MB of free space (if this is less than 10% of free space) - if (volume.FreeBytes() < 20 * 1024 * 1024 && percent < 10) - return -2 - percent; - - return percent; - } - } - return -1; + // warn below 20 MB of free space (if this is less than 10% of free space) + if (volume->FreeBytes() < 20 * 1024 * 1024 && percent < 10) + return -2 - percent; + return percent; } @@ -98,9 +81,32 @@ { CreateWidgets(view); - if (model->IsVolume() && TrackerSettings().ShowVolumeSpaceBar()) { + if (model->IsVolume()) { + fs_info info; dev_t device = model->NodeRef()->device; - fPercent = CalcFreeSpace(device); + BVolume *volume = new BVolume(device); + if (volume->InitCheck() == B_OK + && fs_stat_dev(device, &info) == B_OK) { + // Philosophy here: + // Bars go on all drives with read/write capabilities + // Exceptions: Not on CDDA, but on NTFS/Ext2 + // Also note that some volumes may return 0 when + // BVolume::Capacity() is called (believe-me... That *DOES* + // happen) so we also check for that. + off_t capacity = volume->Capacity(); + if (((!volume->IsReadOnly() && strcmp(info.fsh_name,"cdda")) + || !strcmp(info.fsh_name,"ntfs") + || !strcmp(info.fsh_name,"ext2")) + && capacity > 0) { + // The volume is ok and we want space bars on it + gPeriodicUpdatePoses.AddPose(this, view, + _PeriodicUpdateCallback, volume); + if (TrackerSettings().ShowVolumeSpaceBar()) + fPercent = CalcFreeSpace(volume); + } else + delete volume; + } else + delete volume; } if ((fClipboardMode = FSClipboardFindNodeMode(model,true)) != 0 @@ -112,6 +118,13 @@ BPose::~BPose() { + if (fModel->IsVolume()) { + // we might be registered for periodic updates + BVolume *volume = NULL; + if (gPeriodicUpdatePoses.RemovePose(this, (void **)&volume)) + delete volume; + } + delete fModel; } @@ -285,8 +298,16 @@ bool -BPose::UpdateVolumeSpaceBar(bool enabled) +BPose::_PeriodicUpdateCallback(BPose *pose, void *cookie) { + return pose->UpdateVolumeSpaceBar((BVolume *)cookie); +} + + +bool +BPose::UpdateVolumeSpaceBar(BVolume *volume) +{ + bool enabled = TrackerSettings().ShowVolumeSpaceBar(); if (!enabled) { if (fPercent == -1) return false; @@ -295,9 +316,7 @@ return true; } - dev_t device = TargetModel()->NodeRef()->device; - int32 percent = CalcFreeSpace(device); - + int32 percent = CalcFreeSpace(volume); if (fPercent != percent) { if (percent > 100) fPercent = 100; Modified: haiku/trunk/src/kits/tracker/Pose.h =================================================================== --- haiku/trunk/src/kits/tracker/Pose.h 2007-06-18 23:58:15 UTC (rev 21461) +++ haiku/trunk/src/kits/tracker/Pose.h 2007-06-19 09:33:29 UTC (rev 21462) @@ -96,7 +96,7 @@ void UpdateAllWidgets(int32 poseIndex, BPoint poseLoc, BPoseView *); void UpdateWidgetAndModel(Model *resolvedModel, const char *attrName, uint32 attrType, int32 poseIndex, BPoint poseLoc, BPoseView *view); - bool UpdateVolumeSpaceBar(bool enabled); + bool UpdateVolumeSpaceBar(BVolume *volume); void UpdateIcon(BPoint poseLoc, BPoseView *); //void UpdateFixedSymlink(BPoint poseLoc, BPoseView *); @@ -126,6 +126,7 @@ #endif private: + static bool _PeriodicUpdateCallback(BPose *pose, void *cookie); void EditPreviousNextWidgetCommon(BPoseView *poseView, bool next); void CreateWidgets(BPoseView *); bool TestLargeIconPixel(BPoint) const; Modified: haiku/trunk/src/kits/tracker/PoseList.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseList.cpp 2007-06-18 23:58:15 UTC (rev 21461) +++ haiku/trunk/src/kits/tracker/PoseList.cpp 2007-06-19 09:33:29 UTC (rev 21462) @@ -105,20 +105,3 @@ return NULL; } - -BPose * -PoseList::FindVolumePose(const dev_t device, int32 *resultingIndex) const -{ - int32 count = CountItems(); - for (int32 index = 0; index < count; index++) { - BPose *pose = ItemAt(index); - Model *model = pose->TargetModel(); - ASSERT(model); - if (model->IsVolume() && model->NodeRef()->device == device) { - if (resultingIndex) - *resultingIndex = index; - return pose; - } - } - return NULL; -} Modified: haiku/trunk/src/kits/tracker/PoseList.h =================================================================== --- haiku/trunk/src/kits/tracker/PoseList.h 2007-06-18 23:58:15 UTC (rev 21461) +++ haiku/trunk/src/kits/tracker/PoseList.h 2007-06-19 09:33:29 UTC (rev 21462) @@ -64,7 +64,6 @@ BPose *DeepFindPose(const node_ref *node, int32 *index = NULL) const; // same as FindPose, node can be a target of the actual // pose if the pose is a symlink - BPose *FindVolumePose(const dev_t device, int32 *index = NULL) const; }; // iteration glue, add permutations as needed Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2007-06-18 23:58:15 UTC (rev 21461) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2007-06-19 09:33:29 UTC (rev 21462) @@ -803,9 +803,6 @@ app->StopWatching(this, kShowSelectionWhenInactiveChanged); app->StopWatching(this, kTransparentSelectionChanged); app->StopWatching(this, kSortFolderNamesFirstChanged); - app->StopWatching(this, kShowVolumeSpaceBar); - app->StopWatching(this, kSpaceBarColorChanged); - app->StopWatching(this, kUpdateVolumeSpaceBar); app->Unlock(); } @@ -890,9 +887,6 @@ app->StartWatching(this, kShowSelectionWhenInactiveChanged); app->StartWatching(this, kTransparentSelectionChanged); app->StartWatching(this, kSortFolderNamesFirstChanged); - app->StartWatching(this, kShowVolumeSpaceBar); - app->StartWatching(this, kSpaceBarColorChanged); - app->StartWatching(this, kUpdateVolumeSpaceBar); app->Unlock(); } @@ -2331,20 +2325,6 @@ Invalidate(); } break; - - case kShowVolumeSpaceBar: - bool enabled; - if (message->FindBool("ShowVolumeSpaceBar", &enabled) == B_OK) - TrackerSettings().SetShowVolumeSpaceBar(enabled); - // supposed to fall through - case kSpaceBarColorChanged: - UpdateVolumeIcons(); - break; - case kUpdateVolumeSpaceBar: - dev_t device; - message->FindInt32("device", (int32 *)&device); - UpdateVolumeIcon(device); - break; } } break; @@ -5214,34 +5194,21 @@ void -BPoseView::UpdateVolumeIcon(dev_t device, bool forceUpdate) +BPoseView::UpdateIcon(BPose *pose) { - int32 index; - BPose *pose = fPoseList->FindVolumePose(device,&index); - if (pose == NULL) - return; - - if (pose->UpdateVolumeSpaceBar(TrackerSettings().ShowVolumeSpaceBar()) || forceUpdate) { - BPoint loc(0, index * fListElemHeight); - pose->UpdateIcon(loc, this); + BPoint location; + if (ViewMode() == kListMode) { + // need to find the index of the pose in the pose list + int32 count = fPoseList->CountItems(); + for (int32 index = 0; index < count; index++) { + if (fPoseList->ItemAt(index) == pose) { + location.Set(0, index * fListElemHeight); + break; + } + } } -} - -void -BPoseView::UpdateVolumeIcons() -{ - BVolumeRoster roster; - - BVolume volume; - while(roster.GetNextVolume(&volume) == B_NO_ERROR) { - BDirectory dir; - volume.GetRootDirectory(&dir); - node_ref nodeRef; - dir.GetNodeRef(&nodeRef); - - UpdateVolumeIcon(nodeRef.device, true); - } + pose->UpdateIcon(location, this); } Modified: haiku/trunk/src/kits/tracker/PoseView.h =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.h 2007-06-18 23:58:15 UTC (rev 21461) +++ haiku/trunk/src/kits/tracker/PoseView.h 2007-06-19 09:33:29 UTC (rev 21462) @@ -159,8 +159,7 @@ void SetAutoScroll(bool); void SetPoseEditing(bool); - void UpdateVolumeIcon(dev_t device, bool forceUpdate = false); - void UpdateVolumeIcons(); + void UpdateIcon(BPose *pose); // file change notification handler virtual bool FSNotification(const BMessage *); Modified: haiku/trunk/src/kits/tracker/SettingsViews.cpp =================================================================== --- haiku/trunk/src/kits/tracker/SettingsViews.cpp 2007-06-18 23:58:15 UTC (rev 21461) +++ haiku/trunk/src/kits/tracker/SettingsViews.cpp 2007-06-19 09:33:29 UTC (rev 21462) @@ -1072,9 +1072,7 @@ { settings.SetShowVolumeSpaceBar(fSpaceBarShowCheckBox->Value() == 1); Window()->PostMessage(kSettingsContentsModified); - BMessage notificationMessage; - notificationMessage.AddBool("ShowVolumeSpaceBar", settings.ShowVolumeSpaceBar()); - tracker->SendNotices(kShowVolumeSpaceBar, ¬ificationMessage); + tracker->PostMessage(kShowVolumeSpaceBar); break; } @@ -1094,6 +1092,7 @@ } break; } + case kSpaceBarColorChanged: { switch (fCurrentColor) { @@ -1109,8 +1108,7 @@ } Window()->PostMessage(kSettingsContentsModified); - BMessage notificationMessage; - tracker->SendNotices(kSpaceBarColorChanged, ¬ificationMessage); + tracker->PostMessage(kSpaceBarColorChanged); break; } Modified: haiku/trunk/src/kits/tracker/Tracker.cpp =================================================================== --- haiku/trunk/src/kits/tracker/Tracker.cpp 2007-06-18 23:58:15 UTC (rev 21461) +++ haiku/trunk/src/kits/tracker/Tracker.cpp 2007-06-19 09:33:29 UTC (rev 21462) @@ -483,6 +483,12 @@ break; } + case kShowVolumeSpaceBar: + case kSpaceBarColorChanged: { + gPeriodicUpdatePoses.DoPeriodicUpdate(true); + break; + } + default: _inherited::MessageReceived(message); break; @@ -497,20 +503,7 @@ return; // update the volume icon's free space bars - BVolumeRoster roster; - - BVolume volume; - while (roster.GetNextVolume(&volume) == B_OK) { - BDirectory dir; - volume.GetRootDirectory(&dir); - node_ref nodeRef; - dir.GetNodeRef(&nodeRef); - - BMessage notificationMessage; - notificationMessage.AddInt32("device", *(int32 *)&nodeRef.device); - - SendNotices(kUpdateVolumeSpaceBar, ¬ificationMessage); - } + gPeriodicUpdatePoses.DoPeriodicUpdate(false); } Modified: haiku/trunk/src/kits/tracker/Utilities.cpp =================================================================== --- haiku/trunk/src/kits/tracker/Utilities.cpp 2007-06-18 23:58:15 UTC (rev 21461) +++ haiku/trunk/src/kits/tracker/Utilities.cpp 2007-06-19 09:33:29 UTC (rev 21462) @@ -35,6 +35,7 @@ #include "Attributes.h" #include "MimeTypes.h" #include "Model.h" +#include "PoseView.h" #include "Utilities.h" #include "ContainerWindow.h" @@ -158,7 +159,81 @@ textView->DisallowChar(B_PAGE_DOWN); textView->DisallowChar(B_FUNCTION_KEY); } - + + +PeriodicUpdatePoses::PeriodicUpdatePoses() + : fPoseList(20, true) +{ + fLock = new Benaphore("PeriodicUpdatePoses"); +} + + +PeriodicUpdatePoses::~PeriodicUpdatePoses() +{ + fLock->Lock(); + fPoseList.MakeEmpty(); + delete fLock; +} + + +void +PeriodicUpdatePoses::AddPose(BPose *pose, BPoseView *poseView, + PeriodicUpdateCallback callback, void *cookie) +{ + periodic_pose *periodic = new periodic_pose; + periodic->pose = pose; + periodic->pose_view = poseView; + periodic->callback = callback; + periodic->cookie = cookie; + fPoseList.AddItem(periodic); +} + + +bool +PeriodicUpdatePoses::RemovePose(BPose *pose, void **cookie) +{ + int32 count = fPoseList.CountItems(); + for (int32 index = 0; index < count; index++) { + if (fPoseList.ItemAt(index)->pose == pose) { + if (!fLock->Lock()) + return false; + + periodic_pose *periodic = fPoseList.RemoveItemAt(index); + if (cookie) + *cookie = periodic->cookie; + delete periodic; + fLock->Unlock(); + return true; + } + } + + return false; +} + + +void +PeriodicUpdatePoses::DoPeriodicUpdate(bool forceRedraw) +{ + if (!fLock->Lock()) + return; + + int32 count = fPoseList.CountItems(); + for (int32 index = 0; index < count; index++) { + periodic_pose *periodic = fPoseList.ItemAt(index); + if (periodic->callback(periodic->pose, periodic->cookie) + || forceRedraw) { + periodic->pose_view->LockLooper(); + periodic->pose_view->UpdateIcon(periodic->pose); + periodic->pose_view->UnlockLooper(); + } + } + + fLock->Unlock(); +} + + +static PeriodicUpdatePoses gPeriodicUpdatePoses; + } // namespace BPrivate Modified: haiku/trunk/src/kits/tracker/Utilities.h =================================================================== --- haiku/trunk/src/kits/tracker/Utilities.h 2007-06-18 23:58:15 UTC (rev 21461) +++ haiku/trunk/src/kits/tracker/Utilities.h 2007-06-19 09:33:29 UTC (rev 21462) @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -62,6 +63,8 @@ namespace BPrivate { class Benaphore; +class BPose; +class BPoseView; // global variables extern const rgb_color kBlack; @@ -83,6 +86,38 @@ // misc typedefs, constants and structs +// Periodically updated poses (ones with a volume space bar) register +// themselfs in this global list. This way they can be iterated over instead +// of sending around update messages. + +class PeriodicUpdatePoses { + public: + PeriodicUpdatePoses(); + ~PeriodicUpdatePoses(); + + typedef bool (*PeriodicUpdateCallback)(BPose *pose, void *cookie); + + void AddPose(BPose *pose, BPoseView *poseView, + PeriodicUpdateCallback callback, void *cookie); + bool RemovePose(BPose *pose, void **cookie); + + void DoPeriodicUpdate(bool forceRedraw); + + private: + struct periodic_pose { + BPose *pose; + BPoseView *pose_view; + PeriodicUpdateCallback callback; + void *cookie; + }; + + Benaphore *fLock; + BObjectList fPoseList; +}; + +extern PeriodicUpdatePoses gPeriodicUpdatePoses; + + // PoseInfo is the structure that gets saved as attributes for every node on // disk, defining the node's position and visibility class PoseInfo { From stippi at mail.berlios.de Tue Jun 19 14:38:29 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 19 Jun 2007 14:38:29 +0200 Subject: [Haiku-commits] r21463 - in haiku/trunk: headers/private/shared src/kits/shared Message-ID: <200706191238.l5JCcTqg014553@sheep.berlios.de> Author: stippi Date: 2007-06-19 14:38:29 +0200 (Tue, 19 Jun 2007) New Revision: 21463 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21463&view=rev Added: haiku/trunk/headers/private/shared/CommandPipe.h haiku/trunk/src/kits/shared/CommandPipe.cpp Log: * added BCommandPipe class (currently private API) kindly provided by Ramshankar * adopted to Haiku coding style Added: haiku/trunk/headers/private/shared/CommandPipe.h =================================================================== --- haiku/trunk/headers/private/shared/CommandPipe.h 2007-06-19 09:33:29 UTC (rev 21462) +++ haiku/trunk/headers/private/shared/CommandPipe.h 2007-06-19 12:38:29 UTC (rev 21463) @@ -0,0 +1,88 @@ +/* + * Copyright 2007 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Ramshankar, v.ramshankar at gmail.com + */ +#ifndef _COMMAND_PIPE_H +#define _COMMAND_PIPE_H + + +#include + +#include +#include + + +class BMessage; +class BMessenger; +class BString; + +namespace BPrivate { + +class BCommandPipe { + public: + BCommandPipe(); + virtual ~BCommandPipe(); + + status_t AddArg(const char* argv); + void PrintToStream() const; + + // FlushArgs() deletes the commands while Close() explicity closes all + // pending pipe-ends + // Note: Internally FlushArgs() calls Close() + void FlushArgs(); + void Close(); + + // If you use these, you must explicitly call "close" for the parameters + // (outdes/errdes) when you are done with them! + thread_id Pipe(int* outdes, int* errdes) const; + thread_id Pipe(int* outdes) const; + thread_id PipeAll(int* outAndErrDes) const; + + // If you use these, you need NOT call "fclose" for the parameters + // (out/err) when you are done with them, also you need not do any + // allocation for these FILE* pointers, just use FILE* out = NULL + // and pass &out and so on... + thread_id PipeInto(FILE** _out, FILE** _err); + thread_id PipeInto(FILE** _outAndErr); + + // Run() is a synchronous call, and waits till the command has finished + // executing RunAsync() is an asynchronous call that returns immediately + // after launching the command Neither of these bother about redirecting + // pipes for you to use + void Run(); + void RunAsync(); + + // This function reads line-by-line from "file", cancels its reading + // when "*cancel" is true. It reports each line it has read to "target" + // using the supplied "_message" and string field name. "cancel" can be + // NULL + BString ReadLines(FILE* file, bool* cancel, + BMessenger& target, const BMessage& message, + const BString& stringFieldName); + + // You need NOT free/delete the return array of strings + const char** Argv(int32& _argc) const; + + // Stardard append operators, if you use pointers to a BCommandPipe, + // you must use *pipe << "command"; and not pipe << "command" (as it + // will not compile that way) + BCommandPipe& operator<<(const char *arg); + BCommandPipe& operator<<(const BString& arg); + BCommandPipe& operator<<(const BCommandPipe& arg); + + protected: + BList fArgList; + int fOutDes[2]; + int fErrDes[2]; + bool fOutDesOpen; + bool fErrDesOpen; +}; + +} // namespace BPrivate + +using BPrivate::BCommandPipe; + +#endif // _COMMAND_PIPE_H Added: haiku/trunk/src/kits/shared/CommandPipe.cpp =================================================================== --- haiku/trunk/src/kits/shared/CommandPipe.cpp 2007-06-19 09:33:29 UTC (rev 21462) +++ haiku/trunk/src/kits/shared/CommandPipe.cpp 2007-06-19 12:38:29 UTC (rev 21463) @@ -0,0 +1,324 @@ +/* + * Copyright 2007 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Ramshankar, v.ramshankar at gmail.com + */ + +//! BCommandPipe class to handle reading shell output +// (stdout/stderr) of other programs into memory. +#include "CommandPipe.h" + +#include +#include + +#include +#include +#include +#include + + +BCommandPipe::BCommandPipe() + : fOutDesOpen(false) + , fErrDesOpen(false) +{ +} + + +BCommandPipe::~BCommandPipe() +{ + FlushArgs(); +} + + +status_t +BCommandPipe::AddArg(const char* arg) +{ + return (fArgList.AddItem(reinterpret_cast(strdup(arg))) == true ? + B_OK : B_ERROR); +} + + +void +BCommandPipe::PrintToStream() const +{ + for (int32 i = 0L; i < fArgList.CountItems(); i++) + printf("%s ", (char*)fArgList.ItemAtFast(i)); + + printf("\n"); +} + + +void +BCommandPipe::FlushArgs() +{ + // Delete all arguments from the list + for(int32 i = 0; i < fArgList.CountItems(); i++) + free(fArgList.RemoveItem(0L)); + + fArgList.MakeEmpty(); + Close(); +} + + +void +BCommandPipe::Close() +{ + if (fErrDesOpen) { + close(fErrDes[0]); + fErrDesOpen = false; + } + + if (fOutDesOpen) { + close(fOutDes[0]); + fOutDesOpen = false; + } +} + + +const char** +BCommandPipe::Argv(int32& _argc) const +{ + // *** Warning *** Freeing is left to caller!! Indicated in Header + int32 argc = fArgList.CountItems(); + const char **argv = (const char**)malloc((argc + 1) * sizeof(char*)); + for (int32 i = 0; i < argc; i++) + argv[i] = (const char*)fArgList.ItemAtFast(i); + + argv[argc] = NULL; + _argc = argc; + return argv; +} + + +// #pragma mark - + + +thread_id +BCommandPipe::PipeAll(int* outAndErrDes) const +{ + // This function pipes both stdout and stderr to the same filedescriptor + // (outdes) + int oldstdout; + int oldstderr; + pipe(outAndErrDes); + oldstdout = dup(STDOUT_FILENO); + oldstderr = dup(STDERR_FILENO); + close(STDOUT_FILENO); + close(STDERR_FILENO); + dup2(outAndErrDes[1], STDOUT_FILENO); + dup2(outAndErrDes[1], STDERR_FILENO); + + // Construct the argv vector + int32 argc = fArgList.CountItems(); + const char **argv = (const char**)malloc((argc + 1) * sizeof(char*)); + for (int32 i = 0; i < argc; i++) + argv[i] = (const char*)fArgList.ItemAtFast(i); + + argv[argc] = NULL; + + // Load the app image... and pass the args + thread_id appThread = load_image((int)argc, argv, const_cast< + const char**>(environ)); + + dup2(oldstdout, STDOUT_FILENO); + dup2(oldstderr, STDERR_FILENO); + close(oldstdout); + close(oldstderr); + + delete[] argv; + + return appThread; +} + + +thread_id +BCommandPipe::Pipe(int* outdes, int* errdes) const +{ + int oldstdout; + int oldstderr; + pipe(outdes); + pipe(errdes); + oldstdout = dup(STDOUT_FILENO); + oldstderr = dup(STDERR_FILENO); + close(STDOUT_FILENO); + close(STDERR_FILENO); + dup2(outdes[1], STDOUT_FILENO); + dup2(errdes[1], STDERR_FILENO); + + // Construct the argv vector + int32 argc = fArgList.CountItems(); + const char **argv = (const char**)malloc((argc + 1) * sizeof(char*)); + for (int32 i = 0; i < argc; i++) + argv[i] = (const char*)fArgList.ItemAtFast(i); + + argv[argc] = NULL; + + // Load the app image... and pass the args + thread_id appThread = load_image((int)argc, argv, const_cast< + const char**>(environ)); + + dup2(oldstdout, STDOUT_FILENO); + dup2(oldstderr, STDERR_FILENO); + close(oldstdout); + close(oldstderr); + + delete[] argv; + + return appThread; +} + + +thread_id +BCommandPipe::Pipe(int* outdes) const +{ + // Redirects only output (stdout) to caller, stderr is closed + int errdes[2]; + thread_id tid = Pipe(outdes, errdes); + close(errdes[0]); + close(errdes[1]); + return tid; +} + + +thread_id +BCommandPipe::PipeInto(FILE** _out, FILE** _err) +{ + Close(); + thread_id tid = Pipe(fOutDes, fErrDes); + + resume_thread(tid); + + close(fErrDes[1]); + close(fOutDes[1]); + + fOutDesOpen = true; + fErrDesOpen = true; + + *_out = fdopen(fOutDes[0], "r"); + *_err = fdopen(fErrDes[0], "r"); + + return tid; +} + + +thread_id +BCommandPipe::PipeInto(FILE** _outAndErr) +{ + Close(); + thread_id tid = PipeAll(fOutDes); + + if (tid == B_ERROR || tid == B_NO_MEMORY) + return tid; + + resume_thread(tid); + + close(fOutDes[1]); + fOutDesOpen = true; + + *_outAndErr = fdopen(fOutDes[0], "r"); + return tid; +} + + +// #pragma mark - + + +void +BCommandPipe::Run() +{ + // Runs the command without bothering to redirect streams, this is similar + // to system() but uses pipes and wait_for_thread.... Synchronous. + int outdes[2], errdes[2]; + status_t exitCode; + wait_for_thread(Pipe(outdes, errdes), &exitCode); + + close(outdes[0]); + close(errdes[0]); + close(outdes[1]); + close(errdes[1]); +} + + +void +BCommandPipe::RunAsync() +{ + // Runs the command without bothering to redirect streams, this is similar + // to system() but uses pipes.... Asynchronous. + Close(); + FILE* f = NULL; + PipeInto(&f); + fclose(f); +} + + +// #pragma mark - + + +BString +BCommandPipe::ReadLines(FILE* file, bool* cancel, BMessenger& target, + const BMessage& message, const BString& stringFieldName) +{ + // Reads output of file, line by line. The entire output is returned + // and as each line is being read "target" (if any) is informed, + // with "message" i.e. AddString (stringFieldName, ) + + // "cancel" cancels the reading process, when it becomes true (unless its + // waiting on fgetc()) and I don't know how to cancel the waiting fgetc() + // call. + + BString result; + BString line; + BMessage updateMsg(message); + + while (!feof(file)) { + if (cancel != NULL && *cancel == true) + break; + + unsigned char c = fgetc(file); + + if (c != 255) { + line << (char)c; + result << (char)c; + } + + if (c == '\n') { + updateMsg.RemoveName(stringFieldName.String()); + updateMsg.AddString(stringFieldName.String(), line); + target.SendMessage(&updateMsg); + line = ""; + } + } + + return result; +} + + +BCommandPipe& +BCommandPipe::operator<<(const char* _arg) +{ + AddArg(_arg); + return *this; +} + + +BCommandPipe& +BCommandPipe::operator<<(const BString& _arg) +{ + AddArg(_arg.String()); + return *this; +} + + +BCommandPipe& +BCommandPipe::operator<<(const BCommandPipe& _arg) +{ + int32 argc; + const char** argv = _arg.Argv(argc); + for (int32 i = 0; i < argc; i++) + AddArg(argv[i]); + + return *this; +} + From bonefish at mail.berlios.de Wed Jun 20 01:02:47 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 20 Jun 2007 01:02:47 +0200 Subject: [Haiku-commits] r21464 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200706192302.l5JN2lRm026741@sheep.berlios.de> Author: bonefish Date: 2007-06-20 01:02:34 +0200 (Wed, 20 Jun 2007) New Revision: 21464 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21464&view=rev Modified: haiku/trunk/headers/os/interface/MenuBar.h haiku/trunk/src/kits/interface/MenuBar.cpp Log: Also override MinSize() and PreferredSize(). Modified: haiku/trunk/headers/os/interface/MenuBar.h =================================================================== --- haiku/trunk/headers/os/interface/MenuBar.h 2007-06-19 12:38:29 UTC (rev 21463) +++ haiku/trunk/headers/os/interface/MenuBar.h 2007-06-19 23:02:34 UTC (rev 21464) @@ -81,7 +81,9 @@ // layout related + virtual BSize MinSize(); virtual BSize MaxSize(); + virtual BSize PreferredSize(); /*----- Private or reserved -----------------------------------------*/ virtual status_t Perform(perform_code d, void *arg); Modified: haiku/trunk/src/kits/interface/MenuBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuBar.cpp 2007-06-19 12:38:29 UTC (rev 21463) +++ haiku/trunk/src/kits/interface/MenuBar.cpp 2007-06-19 23:02:34 UTC (rev 21464) @@ -328,17 +328,28 @@ BSize +BMenuBar::MinSize() +{ + return BMenu::MinSize(); +} + + +BSize BMenuBar::MaxSize() { - // TODO: cache the result - float width, height; - GetPreferredSize(&width, &height); - + BSize size = BMenu::MaxSize(); return BLayoutUtils::ComposeSize(ExplicitMaxSize(), - BSize(B_SIZE_UNLIMITED, height)); + BSize(B_SIZE_UNLIMITED, size.height)); } +BSize +BMenuBar::PreferredSize() +{ + return BMenu::PreferredSize(); +} + + // #pragma mark - From bonefish at mail.berlios.de Wed Jun 20 01:09:02 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 20 Jun 2007 01:09:02 +0200 Subject: [Haiku-commits] r21465 - in haiku/trunk: headers/private/interface src/kits/interface Message-ID: <200706192309.l5JN929X005644@sheep.berlios.de> Author: bonefish Date: 2007-06-20 01:09:01 +0200 (Wed, 20 Jun 2007) New Revision: 21465 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21465&view=rev Modified: haiku/trunk/headers/private/interface/BMCPrivate.h haiku/trunk/src/kits/interface/BMCPrivate.cpp Log: Implement _BMCMenuBar_::MaxSize() to override BMenuBar::MaxSize() and limit the maximum width. The latter supports unlimited maximum width. The _BMCMenuBar_ draws fine when resized wider than its min/preferred width, but not the complete "button" area will cause the menu to open when being pressed. Modified: haiku/trunk/headers/private/interface/BMCPrivate.h =================================================================== --- haiku/trunk/headers/private/interface/BMCPrivate.h 2007-06-19 23:02:34 UTC (rev 21464) +++ haiku/trunk/headers/private/interface/BMCPrivate.h 2007-06-19 23:09:01 UTC (rev 21465) @@ -45,9 +45,11 @@ virtual void MessageReceived(BMessage* msg); virtual void MakeFocus(bool focused = true); - void TogglePopUpMarker(bool show) { fShowPopUpMarker = show; } - bool IsPopUpMarkerShown() const { return fShowPopUpMarker; } - + void TogglePopUpMarker(bool show) { fShowPopUpMarker = show; } + bool IsPopUpMarkerShown() const { return fShowPopUpMarker; } + +virtual BSize MaxSize(); + private: _BMCMenuBar_&operator=(const _BMCMenuBar_ &); Modified: haiku/trunk/src/kits/interface/BMCPrivate.cpp =================================================================== --- haiku/trunk/src/kits/interface/BMCPrivate.cpp 2007-06-19 23:02:34 UTC (rev 21464) +++ haiku/trunk/src/kits/interface/BMCPrivate.cpp 2007-06-19 23:09:01 UTC (rev 21465) @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -321,6 +322,17 @@ } +BSize +_BMCMenuBar_::MaxSize() +{ + // The maximum width of a normal BMenuBar is unlimited, but we want it + // limited. + BSize size; + BMenuBar::GetPreferredSize(&size.width, &size.height); + return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size); +} + + _BMCMenuBar_ &_BMCMenuBar_::operator=(const _BMCMenuBar_ &) { From bonefish at mail.berlios.de Wed Jun 20 01:38:01 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 20 Jun 2007 01:38:01 +0200 Subject: [Haiku-commits] r21466 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200706192338.l5JNc1Bu006017@sheep.berlios.de> Author: bonefish Date: 2007-06-20 01:38:00 +0200 (Wed, 20 Jun 2007) New Revision: 21466 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21466&view=rev Modified: haiku/trunk/headers/os/interface/MenuField.h haiku/trunk/src/kits/interface/MenuField.cpp Log: * Implemented Min/Max/PreferredSize(). * Reworked the internal layout. _ValidateLayoutData() computes and caches the layout related data and all other methods just use those values. Now, in layout-aware mode the class should properly work not only when using the layout items. And when using layout items, the class does actually do internal layout; it was basically good luck that it worked in the tests, before. Vertical resizing is supported, too. * We do a few mean tricks to get the probably mostly preferred layout behavior: By default our own explicit max width and that of the menu bar layout item is set to unlimited and the horizontal menu bar alignment to left aligned. This allows to horizontally resize a BMenuField beyond its preferred size, although both label and menu bar have a limited max width. The user can, of course, override those explicit sizes/alignments to get a different behavior, if desired. * Fixed invalidation in SetDivider(). When having the focus, the left and top border of the blue frame were not invalidated. * The label is no longer drawn at vertical position font ascent + descent + leading + 2 (not sure how this calculation was supposed to work), but vertically centers the label around the ascent. With big fonts the label is shown a bit too far to the bottom. Not sure how to fix this in a generic way. Modified: haiku/trunk/headers/os/interface/MenuField.h =================================================================== --- haiku/trunk/headers/os/interface/MenuField.h 2007-06-19 23:09:01 UTC (rev 21465) +++ haiku/trunk/headers/os/interface/MenuField.h 2007-06-19 23:38:00 UTC (rev 21466) @@ -28,7 +28,7 @@ BMessage* message, uint32 flags = B_WILL_DRAW | B_NAVIGABLE); BMenuField(const char* label, - BMenu* menu, BMessage* message); + BMenu* menu, BMessage* message = NULL); BMenuField(BMessage* data); virtual ~BMenuField(); @@ -77,20 +77,31 @@ virtual void ResizeToPreferred(); virtual void GetPreferredSize(float* width, float* height); - BLayoutItem* CreateLabelLayoutItem(); - BLayoutItem* CreateMenuBarLayoutItem(); + virtual BSize MinSize(); + virtual BSize MaxSize(); + virtual BSize PreferredSize(); + virtual void InvalidateLayout(bool descendants = false); + + BLayoutItem* CreateLabelLayoutItem(); + BLayoutItem* CreateMenuBarLayoutItem(); + /*----- Private or reserved -----------------------------------------*/ virtual status_t Perform(perform_code d, void* arg); +protected: + virtual void DoLayout(); + private: class LabelLayoutItem; class MenuBarLayoutItem; + struct LayoutData; friend class _BMCMenuBar_; friend class LabelLayoutItem; friend class MenuBarLayoutItem; + friend class LayoutData; virtual void _ReservedMenuField1(); virtual void _ReservedMenuField2(); @@ -108,22 +119,22 @@ void _InitMenuBar(BMenu* menu, BRect frame, bool fixedSize); + void _ValidateLayoutData(); + char* fLabel; BMenu* fMenu; BMenuBar* fMenuBar; alignment fAlign; float fDivider; - float fStringWidth; bool fEnabled; bool fSelected; bool fTransition; bool fFixedSizeMB; thread_id fMenuTaskID; - BLayoutItem* fLabelLayoutItem; - BLayoutItem* fMenuBarLayoutItem; + LayoutData* fLayoutData; - uint32 _reserved[1]; + uint32 _reserved[3]; }; #endif // _MENU_FIELD_H Modified: haiku/trunk/src/kits/interface/MenuField.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuField.cpp 2007-06-19 23:09:01 UTC (rev 21465) +++ haiku/trunk/src/kits/interface/MenuField.cpp 2007-06-19 23:38:00 UTC (rev 21466) @@ -66,6 +66,28 @@ }; +struct BMenuField::LayoutData { + LayoutData() + : label_layout_item(NULL), + menu_bar_layout_item(NULL), + previous_height(-1), + valid(false) + { + } + + LabelLayoutItem* label_layout_item; + MenuBarLayoutItem* menu_bar_layout_item; + float previous_height; // used in FrameResized() for + // invalidation + font_height font_info; + float label_width; + float label_height; + BSize min; + BSize menu_bar_min; + bool valid; +}; + + // #pragma mark - @@ -168,6 +190,8 @@ status_t dummy; if (fMenuTaskID >= 0) wait_for_thread(fMenuTaskID, &dummy); + + delete fLayoutData; } @@ -258,9 +282,6 @@ SetViewColor(Parent()->ViewColor()); SetLowColor(Parent()->ViewColor()); } - - if (fLabel) - fStringWidth = StringWidth(fLabel); } @@ -327,7 +348,7 @@ BView::MakeFocus(state); if (Window()) - Invalidate(); // TODO: use fStringWidth + Invalidate(); // TODO: use fLayoutData->label_width } @@ -387,6 +408,15 @@ BMenuField::FrameResized(float newWidth, float newHeight) { BView::FrameResized(newWidth, newHeight); + + if (newHeight != fLayoutData->previous_height && Label()) { + // The height changed, which means the label has to move and we + // probably also invalidate a part of the borders around the menu bar. + // So don't be shy and invalidate the whole thing. + Invalidate(); + } + + fLayoutData->previous_height = newHeight; } @@ -423,11 +453,8 @@ fLabel = strdup(label); - if (Window()) { + if (Window()) Invalidate(); - if (fLabel) - fStringWidth = StringWidth(fLabel); - } InvalidateLayout(); } @@ -489,23 +516,25 @@ fDivider = divider; - BRect dirty(fMenuBar->Frame()); + if (Flags() & B_SUPPORTS_LAYOUT) { + // We should never get here, since layout support means, we also + // layout the divider, and don't use this method at all. + Relayout(); + } else { + BRect dirty(fMenuBar->Frame()); - fMenuBar->MoveTo(fDivider + 1, kVMargin); + fMenuBar->MoveTo(fDivider + 1, kVMargin); - if (fFixedSizeMB) { - fMenuBar->ResizeTo(Bounds().Width() - fDivider + 1 - 2, - dirty.Height()); - } + if (fFixedSizeMB) { + fMenuBar->ResizeTo(Bounds().Width() - fDivider + 1 - 2, + dirty.Height()); + } - dirty = dirty | fMenuBar->Frame(); + dirty = dirty | fMenuBar->Frame(); + dirty.InsetBy(-kVMargin, -kVMargin); - dirty.left -= 1; - dirty.top -= 1; - dirty.right += 2; - dirty.bottom += 2; - - Invalidate(dirty); + Invalidate(dirty); + } } @@ -563,57 +592,64 @@ void BMenuField::GetPreferredSize(float *_width, float *_height) { - fMenuBar->GetPreferredSize(_width, _height); + _ValidateLayoutData(); - if (_width) { - // the width is already the menu bars preferred width - // add the room we need to draw the shadow and stuff - *_width += 2 * kVMargin; + if (_width) + *_width = fLayoutData->min.width; - // add the room needed for the label - float labelWidth = fDivider; - if (Label()) { - labelWidth = ceilf(StringWidth(Label())); - if (labelWidth > 0.0) { - // add some room between label and menu bar - labelWidth += 5.0; - } + if (_height) + *_height = fLayoutData->min.height; +} - // have divider override the calculated label width - labelWidth = max_c(labelWidth, fDivider); - } - *_width += labelWidth; - } +BSize +BMenuField::MinSize() +{ + _ValidateLayoutData(); + return BLayoutUtils::ComposeSize(ExplicitMinSize(), fLayoutData->min); +} - if (_height) { - // the height is already the menu bars preferred height - // add the room we need to draw the shadow and stuff - *_height += 2 * kVMargin; - // see if our label would fit vertically - font_height fh; - GetFontHeight(&fh); - *_height = max_c(*_height, ceilf(fh.ascent + fh.descent)); - } +BSize +BMenuField::MaxSize() +{ + _ValidateLayoutData(); + return BLayoutUtils::ComposeSize(ExplicitMaxSize(), fLayoutData->min); } +BSize +BMenuField::PreferredSize() +{ + _ValidateLayoutData(); + return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), fLayoutData->min); +} + + +void +BMenuField::InvalidateLayout(bool descendants) +{ + fLayoutData->valid = false; + + BView::InvalidateLayout(descendants); +} + + BLayoutItem* BMenuField::CreateLabelLayoutItem() { - if (!fLabelLayoutItem) - fLabelLayoutItem = new LabelLayoutItem(this); - return fLabelLayoutItem; + if (!fLayoutData->label_layout_item) + fLayoutData->label_layout_item = new LabelLayoutItem(this); + return fLayoutData->label_layout_item; } BLayoutItem* BMenuField::CreateMenuBarLayoutItem() { - if (!fMenuBarLayoutItem) - fMenuBarLayoutItem = new MenuBarLayoutItem(this); - return fMenuBarLayoutItem; + if (!fLayoutData->menu_bar_layout_item) + fLayoutData->menu_bar_layout_item = new MenuBarLayoutItem(this); + return fLayoutData->menu_bar_layout_item; } @@ -624,6 +660,58 @@ } +void +BMenuField::DoLayout() +{ + // Bail out, if we shan't do layout. + if (!(Flags() & B_SUPPORTS_LAYOUT)) + return; + + // If the user set a layout, we let the base class version call its + // hook. + if (GetLayout()) { + BView::DoLayout(); + return; + } + + _ValidateLayoutData(); + + // validate current size + BSize size(Bounds().Size()); + if (size.width < fLayoutData->min.width) + size.width = fLayoutData->min.width; + if (size.height < fLayoutData->min.height) + size.height = fLayoutData->min.height; + + // divider + float divider = 0; + if (fLayoutData->label_layout_item && fLayoutData->menu_bar_layout_item) { + // We have layout items. They define the divider location. + divider = fLayoutData->menu_bar_layout_item->Frame().left + - fLayoutData->label_layout_item->Frame().left; + } else { + if (fLayoutData->label_width > 0) + divider = fLayoutData->label_width + 5; + } + + // menu bar + BRect dirty(fMenuBar->Frame()); + BRect menuBarFrame(divider + 1, kVMargin, size.width - 2, + size.height - kVMargin); + + // place the menu bar and set the divider + BLayoutUtils::AlignInFrame(fMenuBar, menuBarFrame); + + fDivider = divider; + + // invalidate dirty region + dirty = dirty | fMenuBar->Frame(); + dirty.InsetBy(-kVMargin, -kVMargin); + + Invalidate(dirty); +} + + void BMenuField::_ReservedMenuField1() {} void BMenuField::_ReservedMenuField2() {} void BMenuField::_ReservedMenuField3() {} @@ -643,14 +731,12 @@ fMenu = NULL; fMenuBar = NULL; fAlign = B_ALIGN_LEFT; - fStringWidth = 0; fEnabled = true; fSelected = false; fTransition = false; fFixedSizeMB = false; fMenuTaskID = -1; - fLabelLayoutItem = NULL; - fMenuBarLayoutItem = NULL; + fLayoutData = new LayoutData; SetLabel(label); @@ -658,6 +744,9 @@ fDivider = (float)floor(Frame().Width() / 2.0f); else fDivider = 0; + + // default to unlimited maximum width + SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); } @@ -679,22 +768,21 @@ void BMenuField::DrawLabel(BRect bounds, BRect update) { - font_height fh; - GetFontHeight(&fh); + _ValidateLayoutData(); + font_height& fh = fLayoutData->font_info; if (Label()) { SetLowColor(ViewColor()); - float y = (float)ceil(fh.ascent + fh.descent + fh.leading) + 2.0f; + // horizontal alignment float x; - switch (fAlign) { case B_ALIGN_RIGHT: - x = fDivider - StringWidth(Label()) - 3.0f; + x = fDivider - fLayoutData->label_width - 3.0f; break; case B_ALIGN_CENTER: - x = fDivider - StringWidth(Label()) / 2.0f; + x = fDivider - fLayoutData->label_width / 2.0f; break; default: @@ -702,6 +790,9 @@ break; } + // vertical alignment -- center the ascent + float y = floor((Bounds().Height() + fh.ascent) / 2); + SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), IsEnabled() ? B_DARKEN_MAX_TINT : B_DISABLED_LABEL_TINT)); DrawString(Label(), BPoint(x, y)); @@ -760,13 +851,24 @@ void BMenuField::_UpdateFrame() { - if (fLabelLayoutItem && fMenuBarLayoutItem) { - BRect labelFrame = fLabelLayoutItem->Frame(); - BRect menuFrame = fMenuBarLayoutItem->Frame(); + if (fLayoutData->label_layout_item && fLayoutData->menu_bar_layout_item) { + BRect labelFrame = fLayoutData->label_layout_item->Frame(); + BRect menuFrame = fLayoutData->menu_bar_layout_item->Frame(); + + // update divider + fDivider = menuFrame.left - labelFrame.left; + + // update our frame MoveTo(labelFrame.left, labelFrame.top); + BSize oldSize = Bounds().Size(); ResizeTo(menuFrame.left + menuFrame.Width() - labelFrame.left, menuFrame.top + menuFrame.Height() - labelFrame.top); - SetDivider(menuFrame.left - labelFrame.left); + BSize newSize = Bounds().Size(); + + // If the size changes, ResizeTo() will trigger a relayout, otherwise + // we need to do that explicitly. + if (newSize != oldSize) + Relayout(); } } @@ -781,6 +883,10 @@ frame.top + kVMargin, frame.right, frame.bottom - kVMargin), fixedSize, this); + // by default align the menu bar left in the available space + fMenuBar->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, + B_ALIGN_VERTICAL_UNSET)); + AddChild(fMenuBar); fMenuBar->AddItem(menu); @@ -788,6 +894,53 @@ } +void +BMenuField::_ValidateLayoutData() +{ + if (fLayoutData->valid) + return; + + // cache font height + font_height& fh = fLayoutData->font_info; + GetFontHeight(&fh); + + fLayoutData->label_width = (Label() ? ceilf(StringWidth(Label())) : 0); + fLayoutData->label_height = ceilf(fh.ascent + fh.descent); + + // compute the minimal divider + float divider = 0; + if (fLayoutData->label_width > 0) + divider = fLayoutData->label_width + 5; + + // If we shan't do real layout, we let the current divider take influence. + if (!(Flags() & B_SUPPORTS_LAYOUT)) + divider = max_c(divider, fDivider); + + // get the minimal (== preferred) menu bar size + fLayoutData->menu_bar_min = fMenuBar->MinSize(); + + // compute our minimal (== preferred) size + // TODO: The layout is a bit broken. A one pixel wide border is draw around + // the menu bar to give it it's look. When the view has the focus, + // additionally a one pixel wide blue frame is drawn around it. In order + // to be able to easily visually align the menu bar with the text view of + // a text control, the divider must ignore the focus frame, though. Hence + // we add one less pixel to our width. + BSize min(fLayoutData->menu_bar_min); + min.width += 2 * kVMargin - 1; + min.height += 2 * kVMargin; + + if (fLayoutData->label_width > 0) + min.width += fLayoutData->label_width + 5; + if (fLayoutData->label_height > min.height) + min.height = fLayoutData->label_height; + + fLayoutData->min = min; + + fLayoutData->valid = true; +} + + // #pragma mark - @@ -837,17 +990,13 @@ BSize BMenuField::LabelLayoutItem::BaseMinSize() { -// TODO: Cache the info. Might be too expensive for this call. - const char* label = fParent->Label(); - if (!label) + fParent->_ValidateLayoutData(); + + if (!fParent->Label()) return BSize(-1, -1); - BSize size; - fParent->GetPreferredSize(NULL, &size.height); - - size.width = fParent->StringWidth(label) + 2 * 3 - 1; - - return size; + return BSize(fParent->fLayoutData->label_width + 5, + fParent->fLayoutData->label_height); } @@ -879,6 +1028,9 @@ : fParent(parent), fFrame() { + // by default the part left of the divider shall have an unlimited maximum + // width + SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); } @@ -921,14 +1073,12 @@ BSize BMenuField::MenuBarLayoutItem::BaseMinSize() { -// TODO: Cache the info. Might be too expensive for this call. - BSize size; - fParent->fMenuBar->GetPreferredSize(&size.width, &size.height); + fParent->_ValidateLayoutData(); - // BMenuField draws additional lines around BMenuBar, - // one line on left and top side, two on right and bottom - size.width += 3; - size.height += 3; + // TODO: Cf. the TODO in _ValidateLayoutData(). + BSize size = fParent->fLayoutData->menu_bar_min; + size.width += 2 * kVMargin - 1; + size.height += 2 * kVMargin; return size; } @@ -937,19 +1087,14 @@ BSize BMenuField::MenuBarLayoutItem::BaseMaxSize() { - BSize size(BaseMinSize()); - size.width = B_SIZE_UNLIMITED; - return size; + return BaseMinSize(); } BSize BMenuField::MenuBarLayoutItem::BasePreferredSize() { - BSize size(BaseMinSize()); - // puh, no idea... - size.width = 100; - return size; + return BaseMinSize(); } From bonefish at mail.berlios.de Wed Jun 20 01:39:12 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 20 Jun 2007 01:39:12 +0200 Subject: [Haiku-commits] r21467 - in haiku/trunk/src/tests/kits/interface/layout/widget_layout_test: . tests Message-ID: <200706192339.l5JNdCVv006115@sheep.berlios.de> Author: bonefish Date: 2007-06-20 01:39:10 +0200 (Wed, 20 Jun 2007) New Revision: 21467 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21467&view=rev Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuFieldTest.cpp haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuFieldTest.h Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp Log: Added test for BMenuField. Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile 2007-06-19 23:38:00 UTC (rev 21466) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/Jamfile 2007-06-19 23:39:10 UTC (rev 21467) @@ -25,6 +25,7 @@ ControlTest.cpp ListViewTest.cpp MenuBarTest.cpp + MenuFieldTest.cpp MenuTest.cpp : be Modified: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp 2007-06-19 23:38:00 UTC (rev 21466) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/WidgetLayoutTest.cpp 2007-06-19 23:39:10 UTC (rev 21467) @@ -15,6 +15,7 @@ #include "GroupView.h" #include "ListViewTest.h" #include "MenuBarTest.h" +#include "MenuFieldTest.h" #include "MenuTest.h" #include "StringView.h" #include "Test.h" @@ -43,6 +44,7 @@ { "BListView", ListViewTest::CreateTest }, { "BMenu", MenuTest::CreateTest }, { "BMenuBar", MenuBarTest::CreateTest }, + { "BMenuField", MenuFieldTest::CreateTest }, { NULL, NULL } }; Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuFieldTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuFieldTest.cpp 2007-06-19 23:38:00 UTC (rev 21466) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuFieldTest.cpp 2007-06-19 23:39:10 UTC (rev 21467) @@ -0,0 +1,154 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ + +#include "MenuFieldTest.h" + +#include + +#include +#include +#include + +#include "CheckBox.h" +#include "GroupView.h" + + +enum { + MSG_CHANGE_LABEL_TEXT = 'chlt', + MSG_CHANGE_LABEL_FONT = 'chlf' +}; + + +// constructor +MenuFieldTest::MenuFieldTest() + : ControlTest("MenuField"), + fLongTextCheckBox(NULL), + fBigFontCheckBox(NULL), + fDefaultFont(NULL), + fBigFont(NULL) +{ + BMenu* menu = new BMenu("The Menu"); + + // add a few items + for (int32 i = 0; i < 10; i++) { + BString itemText("Menu item "); + itemText << i; + menu->AddItem(new BMenuItem(itemText.String(), NULL)); + } + + fMenuField = new BMenuField("", menu); + + SetView(fMenuField); +} + + +// destructor +MenuFieldTest::~MenuFieldTest() +{ + delete fDefaultFont; + delete fBigFont; +} + + +// CreateTest +Test* +MenuFieldTest::CreateTest() +{ + return new MenuFieldTest; +} + + +// ActivateTest +void +MenuFieldTest::ActivateTest(View* controls) +{ + GroupView* group = new GroupView(B_VERTICAL); + group->SetFrame(controls->Bounds()); + group->SetSpacing(0, 8); + controls->AddChild(group); + + // BMenuField sets its background color to that of its parent in + // AttachedToWindow(). Override. + rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR); + fMenuField->SetViewColor(background); + fMenuField->SetLowColor(background); + + // long text + fLongTextCheckBox = new LabeledCheckBox("Long label text", + new BMessage(MSG_CHANGE_LABEL_TEXT), this); + group->AddChild(fLongTextCheckBox); + + // big font + fBigFontCheckBox = new LabeledCheckBox("Big label font", + new BMessage(MSG_CHANGE_LABEL_FONT), this); + group->AddChild(fBigFontCheckBox); + + UpdateLabelText(); + UpdateLabelFont(); + + group->AddChild(new Glue()); +} + + +// DectivateTest +void +MenuFieldTest::DectivateTest() +{ +} + + +// MessageReceived +void +MenuFieldTest::MessageReceived(BMessage* message) +{ + switch (message->what) { + case MSG_CHANGE_LABEL_TEXT: + UpdateLabelText(); + break; + case MSG_CHANGE_LABEL_FONT: + UpdateLabelFont(); + break; + default: + Test::MessageReceived(message); + break; + } +} + + +// UpdateLabelText +void +MenuFieldTest::UpdateLabelText() +{ + if (!fLongTextCheckBox || !fMenuField) + return; + + fMenuField->SetLabel(fLongTextCheckBox->IsSelected() + ? "Pretty long menu field label" + : "Short label"); +} + + +// UpdateLabelFont +void +MenuFieldTest::UpdateLabelFont() +{ + if (!fBigFontCheckBox || !fMenuField || !fMenuField->Window()) + return; + + // get default font lazily + if (!fDefaultFont) { + fDefaultFont = new BFont; + fMenuField->GetFont(fDefaultFont); + + fBigFont = new BFont(fDefaultFont); + fBigFont->SetSize(20); + } + + // set font + fMenuField->SetFont(fBigFontCheckBox->IsSelected() + ? fBigFont : fDefaultFont); + fMenuField->InvalidateLayout(); + fMenuField->Invalidate(); +} Added: haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuFieldTest.h =================================================================== --- haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuFieldTest.h 2007-06-19 23:38:00 UTC (rev 21466) +++ haiku/trunk/src/tests/kits/interface/layout/widget_layout_test/tests/MenuFieldTest.h 2007-06-19 23:39:10 UTC (rev 21467) @@ -0,0 +1,42 @@ +/* + * Copyright 2007, Ingo Weinhold . + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef WIDGET_LAYOUT_TEST_MENU_FIELD_TEST_H +#define WIDGET_LAYOUT_TEST_MENU_FIELD_TEST_H + + +#include "ControlTest.h" + + +class BFont; +class BMenuField; +class LabeledCheckBox; + + +class MenuFieldTest : public ControlTest { +public: + MenuFieldTest(); + virtual ~MenuFieldTest(); + + static Test* CreateTest(); + + virtual void ActivateTest(View* controls); + virtual void DectivateTest(); + + virtual void MessageReceived(BMessage* message); + +private: + void UpdateLabelText(); + void UpdateLabelFont(); + +private: + BMenuField* fMenuField; + LabeledCheckBox* fLongTextCheckBox; + LabeledCheckBox* fBigFontCheckBox; + BFont* fDefaultFont; + BFont* fBigFont; +}; + + +#endif // WIDGET_LAYOUT_TEST_MENU_FIELD_TEST_H From axeld at mail.berlios.de Wed Jun 20 02:51:23 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 20 Jun 2007 02:51:23 +0200 Subject: [Haiku-commits] r21468 - haiku/trunk/src/system/boot/loader Message-ID: <200706200051.l5K0pNVG012533@sheep.berlios.de> Author: axeld Date: 2007-06-20 02:51:20 +0200 (Wed, 20 Jun 2007) New Revision: 21468 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21468&view=rev Modified: haiku/trunk/src/system/boot/loader/menu.cpp Log: * Calms down a superfluous GCC 2 warning. * Minor cleanup. Modified: haiku/trunk/src/system/boot/loader/menu.cpp =================================================================== --- haiku/trunk/src/system/boot/loader/menu.cpp 2007-06-19 23:39:10 UTC (rev 21467) +++ haiku/trunk/src/system/boot/loader/menu.cpp 2007-06-20 00:51:20 UTC (rev 21468) @@ -1,5 +1,5 @@ /* - * Copyright 2003-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2003-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -407,7 +407,8 @@ menu->AddSeparatorItem(); menu->AddItem(item = new(nothrow) MenuItem("Rescan volumes")); - item->SetHelpText("Please insert a Haiku CD-ROM or attach a USB disk - depending on your system, you can then boot from them."); + item->SetHelpText("Please insert a Haiku CD-ROM or attach a USB disk - " + "depending on your system, you can then boot from them."); item->SetType(MENU_ITEM_NO_CHOICE); if (count == 0) item->Select(true); @@ -492,14 +493,16 @@ user_menu(Directory **_bootVolume) { Menu *menu = new(nothrow) Menu(MAIN_MENU); - Menu *safeModeMenu; + Menu *safeModeMenu = NULL; MenuItem *item; // Add boot volume - menu->AddItem(item = new(nothrow) MenuItem("Select boot volume", add_boot_volume_menu(*_bootVolume))); + menu->AddItem(item = new(nothrow) MenuItem("Select boot volume", + add_boot_volume_menu(*_bootVolume))); // Add safe mode - menu->AddItem(item = new(nothrow) MenuItem("Select safe mode options", safeModeMenu = add_safe_mode_menu())); + menu->AddItem(item = new(nothrow) MenuItem("Select safe mode options", + safeModeMenu = add_safe_mode_menu())); // Add platform dependent menus platform_add_menus(menu); From axeld at mail.berlios.de Wed Jun 20 03:06:48 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 20 Jun 2007 03:06:48 +0200 Subject: [Haiku-commits] r21469 - haiku/trunk/src/system/glue Message-ID: <200706200106.l5K16m96013417@sheep.berlios.de> Author: axeld Date: 2007-06-20 03:06:48 +0200 (Wed, 20 Jun 2007) New Revision: 21469 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21469&view=rev Modified: haiku/trunk/src/system/glue/start_dyn.c Log: The SimpleTest rule is now using the Haiku glue code - so it should better be 100% compatible; turns out _init_c_library_() gets the arguments and environment as parameters (in case you wondered why __libc_argv and __libc_argc wouldn't work anymore for these apps all of a sudden). Modified: haiku/trunk/src/system/glue/start_dyn.c =================================================================== --- haiku/trunk/src/system/glue/start_dyn.c 2007-06-20 00:51:20 UTC (rev 21468) +++ haiku/trunk/src/system/glue/start_dyn.c 2007-06-20 01:06:48 UTC (rev 21469) @@ -1,5 +1,5 @@ /* - * Copyright 2003-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2003-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. * * Copyright 2001, Travis Geiselbrecht. All rights reserved. @@ -14,7 +14,7 @@ extern int main(int argc, char **argv, char **env); -extern void _init_c_library_(void); +extern void _init_c_library_(int argc, char **argv, char **env); extern void _call_init_routines_(void); int _start(int argc, char **argv, char **env); @@ -37,7 +37,7 @@ // These two are called to make our glue code usable under BeOS R5 // - in Haiku, they are both empty. - _init_c_library_(); + _init_c_library_(argc, argv, environment); _call_init_routines_(); returnCode = main(argc, argv, environment); From axeld at mail.berlios.de Wed Jun 20 03:09:01 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 20 Jun 2007 03:09:01 +0200 Subject: [Haiku-commits] r21470 - in haiku/trunk/src/tests/system/boot/loader: . file_systems/amiga_ffs file_systems/bfs file_systems/tarfs Message-ID: <200706200109.l5K191UR013496@sheep.berlios.de> Author: axeld Date: 2007-06-20 03:09:00 +0200 (Wed, 20 Jun 2007) New Revision: 21470 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21470&view=rev Modified: haiku/trunk/src/tests/system/boot/loader/Jamfile haiku/trunk/src/tests/system/boot/loader/file_systems/amiga_ffs/Jamfile haiku/trunk/src/tests/system/boot/loader/file_systems/bfs/Jamfile haiku/trunk/src/tests/system/boot/loader/file_systems/tarfs/Jamfile haiku/trunk/src/tests/system/boot/loader/platform_devices.cpp haiku/trunk/src/tests/system/boot/loader/platform_menu.cpp haiku/trunk/src/tests/system/boot/loader/platform_misc.cpp haiku/trunk/src/tests/system/boot/loader/platform_mmu.cpp Log: Fixed the build of the boot loader test application. Modified: haiku/trunk/src/tests/system/boot/loader/Jamfile =================================================================== --- haiku/trunk/src/tests/system/boot/loader/Jamfile 2007-06-20 01:06:48 UTC (rev 21469) +++ haiku/trunk/src/tests/system/boot/loader/Jamfile 2007-06-20 01:09:00 UTC (rev 21470) @@ -4,8 +4,12 @@ UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders [ FDirName storage ] ; UsePrivateHeaders [ FDirName shared ] ; -SubDirHdrs $(HAIKU_TOP) headers private kernel arch $(TARGET_ARCH) ; +SubDirSysHdrs $(HAIKU_TOP) headers private kernel arch $(TARGET_ARCH) ; +SubDirSysHdrs $(HAIKU_TOP) src tests system boot loader ; SubDirHdrs $(HAIKU_TOP) src system boot loader ; +SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems amiga ; +SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems apple ; +SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems intel ; # we need to redefine certain calls in the boot loader so that # they will really be used instead of their POSIX counterparts Modified: haiku/trunk/src/tests/system/boot/loader/file_systems/amiga_ffs/Jamfile =================================================================== --- haiku/trunk/src/tests/system/boot/loader/file_systems/amiga_ffs/Jamfile 2007-06-20 01:06:48 UTC (rev 21469) +++ haiku/trunk/src/tests/system/boot/loader/file_systems/amiga_ffs/Jamfile 2007-06-20 01:09:00 UTC (rev 21470) @@ -3,7 +3,8 @@ UsePrivateHeaders [ FDirName kernel ] ; UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders [ FDirName storage ] ; -SubDirHdrs $(HAIKU_TOP) src tests system boot loader ; +SubDirSysHdrs $(HAIKU_TOP) src tests system boot loader ; +SubDirHdrs $(HAIKU_TOP) src system boot loader file_systems amiga_ffs ; ObjectDefines amiga_ffs.cpp Modified: haiku/trunk/src/tests/system/boot/loader/file_systems/bfs/Jamfile =================================================================== --- haiku/trunk/src/tests/system/boot/loader/file_systems/bfs/Jamfile 2007-06-20 01:06:48 UTC (rev 21469) +++ haiku/trunk/src/tests/system/boot/loader/file_systems/bfs/Jamfile 2007-06-20 01:09:00 UTC (rev 21470) @@ -3,7 +3,8 @@ UsePrivateHeaders [ FDirName kernel ] ; UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders [ FDirName storage ] ; -SubDirHdrs $(HAIKU_TOP) src tests system boot loader ; +SubDirSysHdrs $(HAIKU_TOP) src tests system boot loader ; +SubDirHdrs $(HAIKU_TOP) src system boot loader file_systems bfs ; SubDirHdrs $(HAIKU_TOP) src add-ons kernel file_systems bfs ; ObjectDefines Modified: haiku/trunk/src/tests/system/boot/loader/file_systems/tarfs/Jamfile =================================================================== --- haiku/trunk/src/tests/system/boot/loader/file_systems/tarfs/Jamfile 2007-06-20 01:06:48 UTC (rev 21469) +++ haiku/trunk/src/tests/system/boot/loader/file_systems/tarfs/Jamfile 2007-06-20 01:09:00 UTC (rev 21470) @@ -2,8 +2,9 @@ UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders kernel shared storage ; -SubDirHdrs $(HAIKU_TOP) src tests system boot loader ; +SubDirSysHdrs $(HAIKU_TOP) src tests system boot loader ; SubDirSysHdrs $(HAIKU_TOP) headers libs zlib ; +SubDirHdrs $(HAIKU_TOP) src system boot loader file_systems tarfs ; ObjectDefines tarfs.cpp Modified: haiku/trunk/src/tests/system/boot/loader/platform_devices.cpp =================================================================== --- haiku/trunk/src/tests/system/boot/loader/platform_devices.cpp 2007-06-20 01:06:48 UTC (rev 21469) +++ haiku/trunk/src/tests/system/boot/loader/platform_devices.cpp 2007-06-20 01:09:00 UTC (rev 21470) @@ -1,5 +1,5 @@ /* - * Copyright 2003-2005, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2003-2007, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -132,16 +132,24 @@ // #pragma mark - -status_t -platform_get_boot_device(struct stage2_args *args, Node **_device) +status_t +platform_add_boot_device(struct stage2_args *args, NodeList *devicesList) { // we accept a boot device from the command line + status_t status = B_ERROR; + Node *device; + int32 cookie = 0; char *path = get_next_device(&cookie); if (path != NULL) - return get_device(path, _device); + status = get_device(path, &device); + else + status = get_device("/boot/home/test-file-device", &device); - return get_device("/boot/home/test-file-device", _device); + if (status == B_OK) + devicesList->Add(device); + + return status; } Modified: haiku/trunk/src/tests/system/boot/loader/platform_menu.cpp =================================================================== --- haiku/trunk/src/tests/system/boot/loader/platform_menu.cpp 2007-06-20 01:06:48 UTC (rev 21469) +++ haiku/trunk/src/tests/system/boot/loader/platform_menu.cpp 2007-06-20 01:09:00 UTC (rev 21470) @@ -12,6 +12,7 @@ #include #include +#include const char *kNormalColor = "\33[0m"; Modified: haiku/trunk/src/tests/system/boot/loader/platform_misc.cpp =================================================================== --- haiku/trunk/src/tests/system/boot/loader/platform_misc.cpp 2007-06-20 01:06:48 UTC (rev 21469) +++ haiku/trunk/src/tests/system/boot/loader/platform_misc.cpp 2007-06-20 01:09:00 UTC (rev 21470) @@ -1,5 +1,5 @@ /* - * Copyright 2003-2005, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2003-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -35,3 +35,21 @@ { } + +// #pragma mark - + + +extern "C" status_t +boot_arch_elf_relocate_rel(struct preloaded_image *image, + struct Elf32_Rel *rel, int rel_len) +{ + return B_ERROR; +} + + +extern "C" status_t +boot_arch_elf_relocate_rela(struct preloaded_image *image, + struct Elf32_Rela *rel, int rel_len) +{ + return B_ERROR; +} Modified: haiku/trunk/src/tests/system/boot/loader/platform_mmu.cpp =================================================================== --- haiku/trunk/src/tests/system/boot/loader/platform_mmu.cpp 2007-06-20 01:06:48 UTC (rev 21469) +++ haiku/trunk/src/tests/system/boot/loader/platform_mmu.cpp 2007-06-20 01:09:00 UTC (rev 21470) @@ -1,6 +1,6 @@ /* -** Copyright 2003, Axel D?rfler, axeld at pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. + * Copyright 2003-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. */ @@ -11,10 +11,11 @@ status_t -platform_allocate_region(void **_address, size_t size, uint8 protection) +platform_allocate_region(void **_address, size_t size, uint8 protection, + bool exactAddress) { - printf("platform_allocate_region(address = %p, size = %lu, protection = %u)\n", - *_address, size, protection); + printf("platform_allocate_region(address = %p, size = %lu, protection = %u, exactAdress = %d)\n", + *_address, size, protection, exactAddress); void *address = malloc(size); if (address == NULL) From axeld at pinc-software.de Wed Jun 20 03:33:52 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Wed, 20 Jun 2007 03:33:52 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r21466_-_in_haiku/trunk=3A_header?= =?iso-8859-15?q?s/os/interface_src/kits/interface?= In-Reply-To: <200706192338.l5JNc1Bu006017@sheep.berlios.de> Message-ID: <58991897460-BeMail@zon> bonefish at BerliOS wrote: > * The label is no longer drawn at vertical position font ascent + > descent > + leading + 2 (not sure how this calculation was supposed to work), > but > vertically centers the label around the ascent. With big fonts the > label is > shown a bit too far to the bottom. Not sure how to fix this in a > generic way. Since it's just centered, how does that happen? Or do you just mean that the menu item height is too small (which would be easily fixable, similar to what BButton is doing)? Bye, Axel. From stefano.ceccherini at gmail.com Wed Jun 20 09:35:40 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Wed, 20 Jun 2007 09:35:40 +0200 Subject: [Haiku-commits] r21465 - in haiku/trunk: headers/private/interface src/kits/interface In-Reply-To: <200706192309.l5JN929X005644@sheep.berlios.de> References: <200706192309.l5JN929X005644@sheep.berlios.de> Message-ID: <894b9700706200035s19c47ebek3c422ca85cc853f1@mail.gmail.com> 2007/6/20, bonefish at BerliOS : > _BMCMenuBar_ draws fine when resized wider than its min/preferred width, but > not the complete "button" area will cause the menu to open when being pressed. And that's a bug, I guess :) From bonefish at cs.tu-berlin.de Wed Jun 20 13:33:52 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Wed, 20 Jun 2007 13:33:52 +0200 Subject: [Haiku-commits] r21466 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: <58991897460-BeMail@zon> References: <58991897460-BeMail@zon> Message-ID: <20070620133352.656.2@cs.tu-berlin.de> On 2007-06-20 at 03:33:52 [+0200], Axel D?rfler wrote: > bonefish at BerliOS wrote: > > * The label is no longer drawn at vertical position font ascent + > > descent > > + leading + 2 (not sure how this calculation was supposed to work), > > but > > vertically centers the label around the ascent. With big fonts the > > label is > > shown a bit too far to the bottom. Not sure how to fix this in a > > generic way. > > Since it's just centered, how does that happen? Or do you just mean > that the menu item height is too small (which would be easily fixable, > similar to what BButton is doing)? I centered the ascent of the font, which I assumed, would look as it should: float y = floor((Bounds().Height() + fh.ascent) / 2); [...] DrawString(Label(), BPoint(x, y)); It seems the font ascent is greater than the actual height of capital letters, though. BButton uses the following method, which aligns ascent + descent: float y = Bounds().top + (Bounds().Height() - fh.ascent - fh.descent) / 2 + fh.ascent + 1; That looks better, but is still at least one pixel off for the big font. Removing the "+ 1" would help, but then the small font label is one pixel off. I've attached screen shots: * align-ascent-small-font: Ascent alignment, small font. Using the BButton alignment method produces an identical result. * align-ascent-big-font: Ascent alignment, big font. * align-bbutton-big-font: BButton alignment, big font. CU, Ingo -------------- next part -------------- A non-text attachment was scrubbed... Name: align-ascent-small-font Type: image/png Size: 1218 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: align-ascent-big-font Type: image/png Size: 1752 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: align-bbutton-big-font Type: image/png Size: 1756 bytes Desc: not available URL: From bonefish at cs.tu-berlin.de Wed Jun 20 13:47:55 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Wed, 20 Jun 2007 13:47:55 +0200 Subject: [Haiku-commits] r21465 - in haiku/trunk: headers/private/interface src/kits/interface In-Reply-To: <894b9700706200035s19c47ebek3c422ca85cc853f1@mail.gmail.com> References: <200706192309.l5JN929X005644@sheep.berlios.de> <894b9700706200035s19c47ebek3c422ca85cc853f1@mail.gmail.com> Message-ID: <20070620134755.5973.3@cs.tu-berlin.de> On 2007-06-20 at 09:35:40 [+0200], Stefano Ceccherini wrote: > 2007/6/20, bonefish at BerliOS : > > > _BMCMenuBar_ draws fine when resized wider than its min/preferred width, > > but > > not the complete "button" area will cause the menu to open when being > > pressed. > > And that's a bug, I guess :) It's the standard menu bar behavior. If you click in the area to the right of the rightmost menu, nothing shall happen. I suppose one would have to update the item margins (BMenu::SetItemMargins()) in _BMCMenuBar_::FrameResized() to adjust the behavior. No idea why Be used a BMenuBar in the first place. This all seems pretty hacky. Unfortunately we're stuck with that, until we break compatibility. :-/ CU, Ingo From axeld at pinc-software.de Wed Jun 20 14:07:31 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Wed, 20 Jun 2007 14:07:31 +0200 CEST Subject: [Haiku-commits] r21466 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: <20070620133352.656.2@cs.tu-berlin.de> Message-ID: <7359215388-BeMail@zon> Ingo Weinhold wrote: > > Since it's just centered, how does that happen? Or do you just mean > > that the menu item height is too small (which would be easily > > fixable, > > similar to what BButton is doing)? > I centered the ascent of the font, which I assumed, would look as it > should: > > float y = floor((Bounds().Height() + fh.ascent) / 2); > [...] > DrawString(Label(), BPoint(x, y)); > > It seems the font ascent is greater than the actual height of capital > letters, though. BButton uses the following method, which aligns > ascent + > descent: > > float y = Bounds().top > + (Bounds().Height() - fh.ascent - fh.descent) / 2 > + fh.ascent + 1; > > That looks better, but is still at least one pixel off for the big > font. It's also more correct: the complete height of the visual font is (ascent + descent) - and since the baseline of the font equals the ascent, only the BButton version should produce the desired output. > Removing the "+ 1" would help, but then the small font label is one > pixel > off. I've attached screen shots: > > * align-ascent-small-font: Ascent alignment, small font. Using the > BButton > alignment method produces an identical result. > > * align-ascent-big-font: Ascent alignment, big font. > > * align-bbutton-big-font: BButton alignment, big font. I think the last version looks best with either font size. Is that with or without that +1? Bye, Axel. From bonefish at cs.tu-berlin.de Wed Jun 20 16:34:04 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Wed, 20 Jun 2007 16:34:04 +0200 Subject: [Haiku-commits] r21466 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: <7359215388-BeMail@zon> References: <7359215388-BeMail@zon> Message-ID: <20070620163404.1309.1@cs.tu-berlin.de> On 2007-06-20 at 14:07:31 [+0200], Axel D?rfler wrote: > Ingo Weinhold wrote: > > > Since it's just centered, how does that happen? Or do you just mean > > > that the menu item height is too small (which would be easily > > > fixable, > > > similar to what BButton is doing)? > > I centered the ascent of the font, which I assumed, would look as it > > should: > > > > float y = floor((Bounds().Height() + fh.ascent) / 2); > > [...] > > DrawString(Label(), BPoint(x, y)); > > > > It seems the font ascent is greater than the actual height of capital > > letters, though. BButton uses the following method, which aligns > > ascent + > > descent: > > > > float y = Bounds().top > > + (Bounds().Height() - fh.ascent - fh.descent) / 2 > > + fh.ascent + 1; > > > > That looks better, but is still at least one pixel off for the big > > font. > > It's also more correct: the complete height of the visual font is > (ascent + descent) - and since the baseline of the font equals the > ascent, only the BButton version should produce the desired output. What should happen, if done like this, is, that capital letters should not appear centered, since they are completely above the baseline and should use the full ascent. As you can see in the screen shots, that is not the case, though. E.g. the "S" in align-bbutton-big-font has six pixels spacing to the top, but only five pixels to the bottom. Even if removing the "+ 1", it would just be the other way around. A "g" goes four pixels below the baseline, so I'd expect at least a difference of two. In actual fact, the font_height values are 19.257812 ascent and 4.716797 descent. Given that the capital letters appear to be only 14 pixels tall, there's something seriously incorrect. It's a 20pt font, BTW. > > Removing the "+ 1" would help, but then the small font label is one > > pixel > > off. I've attached screen shots: > > > > * align-ascent-small-font: Ascent alignment, small font. Using the > > BButton > > alignment method produces an identical result. > > > > * align-ascent-big-font: Ascent alignment, big font. > > > > * align-bbutton-big-font: BButton alignment, big font. > > I think the last version looks best with either font size. Is that with > or without that +1? It's with the "+ 1". It would look better without, but when using the small font the label would no longer be aligned with the menu bar's text. And with correct font_height values it would move even further towards the top border. BTW, does anyone actually *know* how text drawing works (or should work)? E.g. is the baseline an infinitesimally thin line or or is it one pixel thick? How exactly do the descent and ascent values relate to the baseline? Are they pixel counts or distances? CU, Ingo From axeld at pinc-software.de Wed Jun 20 16:55:42 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Wed, 20 Jun 2007 16:55:42 +0200 CEST Subject: [Haiku-commits] r21466 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: <20070620163404.1309.1@cs.tu-berlin.de> Message-ID: <17450684333-BeMail@zon> Ingo Weinhold wrote: > > It's also more correct: the complete height of the visual font is > > (ascent + descent) - and since the baseline of the font equals the > > ascent, only the BButton version should produce the desired output. > What should happen, if done like this, is, that capital letters > should not > appear centered, since they are completely above the baseline and > should > use the full ascent. As you can see in the screen shots, that is not > the > case, though. E.g. the "S" in align-bbutton-big-font has six pixels > spacing > to the top, but only five pixels to the bottom. Even if removing the > "+ 1", > it would just be the other way around. A "g" goes four pixels below > the > baseline, so I'd expect at least a difference of two. > > In actual fact, the font_height values are 19.257812 ascent and > 4.716797 > descent. Given that the capital letters appear to be only 14 pixels > tall, > there's something seriously incorrect. It's a 20pt font, BTW. How so? The actual values depend on the font - if the font does not use the full span, the font is to blame. All you know is the full span of the font and its baseline - you don't know how much space the font is actually using for typical characters (it should use the full amount, of course, but that varies a lot), the only certain thing is the baseline. So in theory, both, the BButton version and yours might produce visually appealing results (it only depends on the font), but your version might crop some characters below the baseline. > > I think the last version looks best with either font size. Is that > > with > > or without that +1? > It's with the "+ 1". It would look better without, but when using the > small > font the label would no longer be aligned with the menu bar's text. > And > with correct font_height values it would move even further towards > the top > border. > > BTW, does anyone actually *know* how text drawing works (or should > work)? > E.g. is the baseline an infinitesimally thin line or or is it one > pixel > thick? How exactly do the descent and ascent values relate to the > baseline? > Are they pixel counts or distances? The BeBook says: "This function places the characters on a baseline that begins one pixel above the current pen position" (in BView::DrawString()). IOW the BButton version looks exactly as it should. AFAICT the baseline is between pixels, so ascent as well as descent are distances and pixel count at the same time. Bye, Axel. From superstippi at gmx.de Wed Jun 20 17:01:58 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Wed, 20 Jun 2007 17:01:58 +0200 Subject: [Haiku-commits] r21466 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: <20070620163404.1309.1@cs.tu-berlin.de> References: <7359215388-BeMail@zon> <20070620163404.1309.1@cs.tu-berlin.de> Message-ID: <20070620170158.4841.18@stippis.WG> Hi Ingo, > BTW, does anyone actually *know* how text drawing works (or should work)? > E.g. is the baseline an infinitesimally thin line or or is it one pixel > thick? How exactly do the descent and ascent values relate to the baseline? > Are they pixel counts or distances? Well, I cannot claim to *know*... but I would think that those properties are font-coordinate based, transformed to match the pixel grid, treating pixels as areas like in AGG. The font hinting is probably getting in the way, since those values are returned without having the effects of it taken into account. A baseline of "10" is probably at the top of pixel at row 10. The BeBook mentions something about a "+1" offset for historical reasons, that's probably why BButton is drawing it that way. So the height of the font, retrieved from ascent+descent, should probably be rounded, to account for hinting, and then you should really round the baseline you calculate too, because it will likely be floor()ed on the app_server side when hinting is on. Best regards, -Stephan P.S. Just for the fun of it, you could view->SetFlags(view->Flags() | B_SUB_PIXEL_PRECISE) before drawing the text, to see what the outcome of that is... IIRC, it turns off any hinting or pixel alignment in the app_server (ours, that is). From korli at users.berlios.de Wed Jun 20 22:19:24 2007 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Wed, 20 Jun 2007 22:19:24 +0200 Subject: [Haiku-commits] r21432 - haiku/trunk/src/tools/fs_shell In-Reply-To: <1A063B81-AB62-4E9F-AF04-97809EAB135A@foobox.com> References: <200706171157.l5HBvPp7004753@sheep.berlios.de> <20070617150021.474.1@cs.tu-berlin.de> <1A063B81-AB62-4E9F-AF04-97809EAB135A@foobox.com> Message-ID: 2007/6/17, Travis Geiselbrecht : > > > > > The two obvious options with only local changes would be: > > > > * Use the block number as cookie value -- or rather block number + > > 1, so > > that the initial cookie value can be discriminated. This allows for > > a quick > > lookup (hash_lookup(cache->hash, &blockNumber)) and requires only > > minimal > > changes. The only drawback is that it limits the number of addressable > > blocks to 2^32 - 2. For a 1 KB block size that's still a partition > > size of > > almost 4 TB, which shouldn't be too bad for the time being. > > > > * Use the list index as cookie value. I don't know, how many blocks a > > transaction will usually contain. Might be a performance problem. > > > > Either change should be conditional, so that 32 bit hosts won't > > suffer from > > the drawbacks. > > > > Other options that require more changes: > > > > * Assign unique 32 bit numbers to blocks and add an additional hash > > table > > to block_cache. > > > > * Add a block list index -> cache_block* hash map to > > cache_transaction. > > > > I suppose the ideal solution would be to change the > > cache_next_block_in_transaction() interface, e.g. to using a void* > > cookie. > > Another option would be to simply make the cookie a uint64. I > actually got most of the build working properly on x86-64 yesterday, > took a while to debug, but I didn't check them in yet, since they > were pretty nasty. I wouldn't mind. Axel, do you have an opinion here ? Here were the changes I had to make to get it to build: > -moved this cookie to uint64, in every instance of it (the fssh cache > and the real one) > -all of the error codes needed to be based on INT_MIN not LONG_MIN. > There's about 4 places in the source that do this, and it seems like > a pretty major change, though I can't see it really causing any > problems. It was inheirited from beos. I found only one place where it should be important : headers/build/os/support/Errors.h -in some of the places where we typedef uint32, we are typedefing it > to unsigned long. This is obviously incorrect on a 64bit platform, > but it's a pretty major change that causes a lot of problems later > down the road. such as... I don't think it is really important for build libbe. -BMessage has some bad overrides of &operator<< that when int32 is > int causes a collision. I had this on BString also ... Also, as far as the atomic change, I think the problem there wasn't > that it needed a 64bit atomic, it was that fssh_addr_t is currently > typedefed to uint32. I changed it to typedef to uintptr_t. Sure, but I don't see the point of using a 32 bit atomic to set a 64 bit pointer. Anyway, all of this really looks like a big preview of what's to come > when trying to port it all to 64bit. Seems that some of the early > beos decisions were slightly off, and some stuff will have to be > changed, but *hopefully* none of it will cause any compatibility > problems. The problems we encounter now are typically for build tools. I have a problem at the moment for resource file handling in src/build/libbe/storage/ResourceFile.cpp where only Elf32 is handled. Support for Elf64 is missing for the build tool "makebootable" Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From korli at mail.berlios.de Wed Jun 20 23:20:12 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 20 Jun 2007 23:20:12 +0200 Subject: [Haiku-commits] r21471 - haiku/trunk/headers/private/textencoding Message-ID: <200706202120.l5KLKCxi017161@sheep.berlios.de> Author: korli Date: 2007-06-20 23:20:11 +0200 (Wed, 20 Jun 2007) New Revision: 21471 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21471&view=rev Modified: haiku/trunk/headers/private/textencoding/CharacterSet.h haiku/trunk/headers/private/textencoding/CharacterSetRoster.h Log: missing comment tokens Modified: haiku/trunk/headers/private/textencoding/CharacterSet.h =================================================================== --- haiku/trunk/headers/private/textencoding/CharacterSet.h 2007-06-20 01:09:00 UTC (rev 21470) +++ haiku/trunk/headers/private/textencoding/CharacterSet.h 2007-06-20 21:20:11 UTC (rev 21471) @@ -86,4 +86,4 @@ } -#endif CHARACTER_SET_H +#endif // CHARACTER_SET_H Modified: haiku/trunk/headers/private/textencoding/CharacterSetRoster.h =================================================================== --- haiku/trunk/headers/private/textencoding/CharacterSetRoster.h 2007-06-20 01:09:00 UTC (rev 21470) +++ haiku/trunk/headers/private/textencoding/CharacterSetRoster.h 2007-06-20 21:20:11 UTC (rev 21471) @@ -88,4 +88,4 @@ } -#endif CHARACTER_SET_ROSTER_H +#endif // CHARACTER_SET_ROSTER_H From korli at mail.berlios.de Wed Jun 20 23:30:01 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 20 Jun 2007 23:30:01 +0200 Subject: [Haiku-commits] r21472 - in haiku/trunk/headers: build/private/storage build/private/textencoding private/disk_scanner private/print Message-ID: <200706202130.l5KLU1SS019320@sheep.berlios.de> Author: korli Date: 2007-06-20 23:30:00 +0200 (Wed, 20 Jun 2007) New Revision: 21472 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21472&view=rev Modified: haiku/trunk/headers/build/private/storage/DiskDeviceVisitor.h haiku/trunk/headers/build/private/textencoding/CharacterSet.h haiku/trunk/headers/build/private/textencoding/CharacterSetRoster.h haiku/trunk/headers/private/disk_scanner/partition.h haiku/trunk/headers/private/print/PictureIterator.h haiku/trunk/headers/private/print/PicturePrinter.h Log: missing comment tokens Modified: haiku/trunk/headers/build/private/storage/DiskDeviceVisitor.h =================================================================== --- haiku/trunk/headers/build/private/storage/DiskDeviceVisitor.h 2007-06-20 21:20:11 UTC (rev 21471) +++ haiku/trunk/headers/build/private/storage/DiskDeviceVisitor.h 2007-06-20 21:30:00 UTC (rev 21472) @@ -22,4 +22,4 @@ virtual bool Visit(BPartition *partition, int32 level); }; -#endif _DISK_DEVICE_VISITOR_H +#endif // _DISK_DEVICE_VISITOR_H Modified: haiku/trunk/headers/build/private/textencoding/CharacterSet.h =================================================================== --- haiku/trunk/headers/build/private/textencoding/CharacterSet.h 2007-06-20 21:20:11 UTC (rev 21471) +++ haiku/trunk/headers/build/private/textencoding/CharacterSet.h 2007-06-20 21:30:00 UTC (rev 21472) @@ -86,4 +86,4 @@ } -#endif CHARACTER_SET_H +#endif // CHARACTER_SET_H Modified: haiku/trunk/headers/build/private/textencoding/CharacterSetRoster.h =================================================================== --- haiku/trunk/headers/build/private/textencoding/CharacterSetRoster.h 2007-06-20 21:20:11 UTC (rev 21471) +++ haiku/trunk/headers/build/private/textencoding/CharacterSetRoster.h 2007-06-20 21:30:00 UTC (rev 21472) @@ -88,4 +88,4 @@ } -#endif CHARACTER_SET_ROSTER_H +#endif // CHARACTER_SET_ROSTER_H Modified: haiku/trunk/headers/private/disk_scanner/partition.h =================================================================== --- haiku/trunk/headers/private/disk_scanner/partition.h 2007-06-20 21:20:11 UTC (rev 21471) +++ haiku/trunk/headers/private/disk_scanner/partition.h 2007-06-20 21:30:00 UTC (rev 21472) @@ -122,4 +122,4 @@ Returns B_OK, if everything went fine, an error code otherwise. */ -#endif _PARTSCAN_PARTITION_H +#endif // _PARTSCAN_PARTITION_H Modified: haiku/trunk/headers/private/print/PictureIterator.h =================================================================== --- haiku/trunk/headers/private/print/PictureIterator.h 2007-06-20 21:20:11 UTC (rev 21471) +++ haiku/trunk/headers/private/print/PictureIterator.h 2007-06-20 21:30:00 UTC (rev 21472) @@ -90,4 +90,4 @@ virtual void Iterate(BPicture* picture); }; -#endif _PICTURE_ITERATOR_H +#endif // _PICTURE_ITERATOR_H Modified: haiku/trunk/headers/private/print/PicturePrinter.h =================================================================== --- haiku/trunk/headers/private/print/PicturePrinter.h 2007-06-20 21:20:11 UTC (rev 21471) +++ haiku/trunk/headers/private/print/PicturePrinter.h 2007-06-20 21:30:00 UTC (rev 21472) @@ -121,4 +121,4 @@ PicturePrinter* fPrinter; }; -#endif _PICTURE_PRINTER_H +#endif // _PICTURE_PRINTER_H From korli at mail.berlios.de Wed Jun 20 23:32:52 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 20 Jun 2007 23:32:52 +0200 Subject: [Haiku-commits] r21473 - haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam Message-ID: <200706202132.l5KLWqpI019560@sheep.berlios.de> Author: korli Date: 2007-06-20 23:32:51 +0200 (Wed, 20 Jun 2007) New Revision: 21473 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21473&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.h Log: missing comment token Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.h 2007-06-20 21:30:00 UTC (rev 21472) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.h 2007-06-20 21:32:51 UTC (rev 21473) @@ -152,4 +152,4 @@ #define B_WEBCAM_ADDON_INSTANTIATION_FUNC_NAME "get_webcam_addon" -#endif _CAM_DEVICE_H +#endif // _CAM_DEVICE_H From korli at mail.berlios.de Wed Jun 20 23:40:43 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 20 Jun 2007 23:40:43 +0200 Subject: [Haiku-commits] r21474 - haiku/trunk/src/kits/tracker Message-ID: <200706202140.l5KLehg9020315@sheep.berlios.de> Author: korli Date: 2007-06-20 23:40:43 +0200 (Wed, 20 Jun 2007) New Revision: 21474 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21474&view=rev Modified: haiku/trunk/src/kits/tracker/Utilities.cpp Log: gPeriodicUpdatePoses is already declared extern in the header Modified: haiku/trunk/src/kits/tracker/Utilities.cpp =================================================================== --- haiku/trunk/src/kits/tracker/Utilities.cpp 2007-06-20 21:32:51 UTC (rev 21473) +++ haiku/trunk/src/kits/tracker/Utilities.cpp 2007-06-20 21:40:43 UTC (rev 21474) @@ -232,7 +232,7 @@ } -static PeriodicUpdatePoses gPeriodicUpdatePoses; +PeriodicUpdatePoses gPeriodicUpdatePoses; } // namespace BPrivate From korli at mail.berlios.de Wed Jun 20 23:58:03 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 20 Jun 2007 23:58:03 +0200 Subject: [Haiku-commits] r21475 - in haiku/trunk/headers: build/os/support private/fs_shell Message-ID: <200706202158.l5KLw38d022002@sheep.berlios.de> Author: korli Date: 2007-06-20 23:58:02 +0200 (Wed, 20 Jun 2007) New Revision: 21475 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21475&view=rev Modified: haiku/trunk/headers/build/os/support/Errors.h haiku/trunk/headers/private/fs_shell/fssh_errors.h Log: Passed GENERAL_ERROR_BASE from LONG_MIN to INT_MIN (errors are uint32). Modified: haiku/trunk/headers/build/os/support/Errors.h =================================================================== --- haiku/trunk/headers/build/os/support/Errors.h 2007-06-20 21:40:43 UTC (rev 21474) +++ haiku/trunk/headers/build/os/support/Errors.h 2007-06-20 21:58:02 UTC (rev 21475) @@ -18,7 +18,7 @@ /*-------------------------------------------------------------*/ /*----- Error baselines ---------------------------------------*/ -#define B_GENERAL_ERROR_BASE LONG_MIN +#define B_GENERAL_ERROR_BASE INT_MIN #define B_OS_ERROR_BASE B_GENERAL_ERROR_BASE + 0x1000 #define B_APP_ERROR_BASE B_GENERAL_ERROR_BASE + 0x2000 #define B_INTERFACE_ERROR_BASE B_GENERAL_ERROR_BASE + 0x3000 Modified: haiku/trunk/headers/private/fs_shell/fssh_errors.h =================================================================== --- haiku/trunk/headers/private/fs_shell/fssh_errors.h 2007-06-20 21:40:43 UTC (rev 21474) +++ haiku/trunk/headers/private/fs_shell/fssh_errors.h 2007-06-20 21:58:02 UTC (rev 21475) @@ -10,7 +10,7 @@ /* Error baselines */ -#define FSSH_B_GENERAL_ERROR_BASE LONG_MIN +#define FSSH_B_GENERAL_ERROR_BASE INT_MIN #define FSSH_B_OS_ERROR_BASE FSSH_B_GENERAL_ERROR_BASE + 0x1000 #define FSSH_B_APP_ERROR_BASE FSSH_B_GENERAL_ERROR_BASE + 0x2000 #define FSSH_B_INTERFACE_ERROR_BASE FSSH_B_GENERAL_ERROR_BASE + 0x3000 From bonefish at cs.tu-berlin.de Thu Jun 21 00:30:05 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Thu, 21 Jun 2007 00:30:05 +0200 Subject: [Haiku-commits] r21466 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: <17450684333-BeMail@zon> References: <17450684333-BeMail@zon> Message-ID: <20070621003005.1821.2@cs.tu-berlin.de> On 2007-06-20 at 16:55:42 [+0200], Axel D?rfler wrote: > Ingo Weinhold wrote: > > > It's also more correct: the complete height of the visual font is > > > (ascent + descent) - and since the baseline of the font equals the > > > ascent, only the BButton version should produce the desired output. > > What should happen, if done like this, is, that capital letters > > should not > > appear centered, since they are completely above the baseline and > > should > > use the full ascent. As you can see in the screen shots, that is not > > the > > case, though. E.g. the "S" in align-bbutton-big-font has six pixels > > spacing > > to the top, but only five pixels to the bottom. Even if removing the > > "+ 1", > > it would just be the other way around. A "g" goes four pixels below > > the > > baseline, so I'd expect at least a difference of two. > > > > In actual fact, the font_height values are 19.257812 ascent and > > 4.716797 > > descent. Given that the capital letters appear to be only 14 pixels > > tall, > > there's something seriously incorrect. It's a 20pt font, BTW. > > How so? The actual values depend on the font - if the font does not use > the full span, the font is to blame. All you know is the full span of > the font and its baseline - you don't know how much space the font is > actually using for typical characters (it should use the full amount, > of course, but that varies a lot), the only certain thing is the > baseline. Which nevertheless brings me back to my proposition that something is seriously incorrect. Apparently either one of those: * The font reporting an incorrect ascent. * The code converting the values the font reports to the font_height values. * The text drawing code drawing the characters too small. > So in theory, both, the BButton version and yours might produce > visually appealing results (it only depends on the font), but your > version might crop some characters below the baseline. It would indeed, if the code computing the space requirements for the label does not consider how it is drawn. > > > I think the last version looks best with either font size. Is that > > > with > > > or without that +1? > > It's with the "+ 1". It would look better without, but when using the > > small > > font the label would no longer be aligned with the menu bar's text. > > And > > with correct font_height values it would move even further towards > > the top > > border. > > > > BTW, does anyone actually *know* how text drawing works (or should > > work)? > > E.g. is the baseline an infinitesimally thin line or or is it one > > pixel > > thick? How exactly do the descent and ascent values relate to the > > baseline? > > Are they pixel counts or distances? > > The BeBook says: "This function places the characters on a baseline > that begins one pixel above the current pen position" (in > BView::DrawString()). IOW the BButton version looks exactly as it > should. > AFAICT the baseline is between pixels, so ascent as well as descent are > distances and pixel count at the same time. OK, if that is so -- and some more pixel-counting seems to support that theory -- it means two things: * The vertical space requirement for a string (in pixels) is actually ceil(ascent) + ceil(descent). * The BButton version is incorrect. (a) It mixes pixel center distances (Bounds().Height()) with actual distances/pixel counts (ascent + descent). (b) The "+1" is nonsense. The correct version would be: float y = Bounds().top + (Bounds().Height() + 1 - fh.ascent - fh.descent) / 2 + fh.ascent; E.g for Bounds() = (?, 0, ?, 19), fh.ascent = 20, fh.descent = 0, the previous version would incorrectly return 20.5. Unfortunately that misaligns the label with the menu bar text for the small font. But I guess I'll simply leave that to others to fix. :-P CU, Ingo From bonefish at cs.tu-berlin.de Thu Jun 21 00:43:09 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Thu, 21 Jun 2007 00:43:09 +0200 Subject: [Haiku-commits] r21466 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: <20070620170158.4841.18@stippis.WG> References: <7359215388-BeMail@zon> <20070620163404.1309.1@cs.tu-berlin.de> <20070620170158.4841.18@stippis.WG> Message-ID: <20070621004309.3815.3@cs.tu-berlin.de> On 2007-06-20 at 17:01:58 [+0200], Stephan Assmus wrote: > > > BTW, does anyone actually *know* how text drawing works (or should work)? > > E.g. is the baseline an infinitesimally thin line or or is it one pixel > > thick? How exactly do the descent and ascent values relate to the > > baseline? > > Are they pixel counts or distances? > > Well, I cannot claim to *know*... but I would think that those properties > are font-coordinate based, transformed to match the pixel grid, treating > pixels as areas like in AGG. The font hinting is probably getting in the > way, since those values are returned without having the effects of it taken > into account. A baseline of "10" is probably at the top of pixel at row 10. Yep, that's how it seems to be (under Haiku at least) and which is why ... > The BeBook mentions something about a "+1" offset for historical reasons, > that's probably why BButton is drawing it that way. that's not correct. The BView::DrawString() is misleading. If one wants to have a baseline at location (x, 10) (meaning at the top of the row with index 10), one actually has to pass a y component of 10 to DrawString(). At least under Haiku; haven't check BeOS. > So the height of the font, retrieved from ascent+descent, should probably be > rounded, to account for hinting, and then you should really round the > baseline you calculate too, because it will likely be floor()ed on the > app_server side when hinting is on. OK, good to know. > P.S. Just for the fun of it, you could view->SetFlags(view->Flags() | > B_SUB_PIXEL_PRECISE) before drawing the text, to see what the outcome of > that is... IIRC, it turns off any hinting or pixel alignment in the > app_server (ours, that is). I didn't see any difference with the flag set. CU, Ingo From bonefish at cs.tu-berlin.de Thu Jun 21 00:48:56 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Thu, 21 Jun 2007 00:48:56 +0200 Subject: [Haiku-commits] r21432 - haiku/trunk/src/tools/fs_shell In-Reply-To: References: <200706171157.l5HBvPp7004753@sheep.berlios.de> <20070617150021.474.1@cs.tu-berlin.de> <1A063B81-AB62-4E9F-AF04-97809EAB135A@foobox.com> Message-ID: <20070621004856.3864.4@cs.tu-berlin.de> On 2007-06-20 at 22:19:24 [+0200], J?r?me Duval wrote: [...] > The problems we encounter now are typically for build tools. > I have a problem at the moment for resource file handling in > src/build/libbe/storage/ResourceFile.cpp where only Elf32 is handled. > Support for Elf64 is missing for the build tool "makebootable" Just use the "darwin" special handling for all platforms. It puts the boot code into an attribute instead of into a resource. This should work on all platforms. CU, Ingo From geist at mail.berlios.de Thu Jun 21 07:07:18 2007 From: geist at mail.berlios.de (geist at BerliOS) Date: Thu, 21 Jun 2007 07:07:18 +0200 Subject: [Haiku-commits] r21476 - haiku/trunk/src/system/kernel Message-ID: <200706210507.l5L57IGJ012623@sheep.berlios.de> Author: geist Date: 2007-06-21 07:07:14 +0200 (Thu, 21 Jun 2007) New Revision: 21476 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21476&view=rev Modified: haiku/trunk/src/system/kernel/module.cpp Log: Fix a bug that was tripping an assert in the kernel module code. When iterating through modules, the iterator was loading the module file, inserting it into the module image hash. Then, the first time get_module() was called on a module contained in the image, it was trying to load the image again. It probably actually was. Changed the logic to call get_module_image() which checks to see if it's already loaded. Modified: haiku/trunk/src/system/kernel/module.cpp =================================================================== --- haiku/trunk/src/system/kernel/module.cpp 2007-06-20 21:58:02 UTC (rev 21475) +++ haiku/trunk/src/system/kernel/module.cpp 2007-06-21 05:07:14 UTC (rev 21476) @@ -359,16 +359,22 @@ TRACE(("get_module_image(path = \"%s\", _image = %p)\n", path, _image)); + recursive_lock_lock(&sModulesLock); + image = (module_image *)hash_lookup(sModuleImagesHash, path); if (image == NULL) { status_t status = load_module_image(path, &image); - if (status < B_OK) + if (status < B_OK) { + recursive_lock_unlock(&sModulesLock); return status; + } } atomic_add(&image->ref_count, 1); *_image = image; + recursive_lock_unlock(&sModulesLock); + return B_OK; } @@ -446,9 +452,8 @@ int index = 0, match = B_ENTRY_NOT_FOUND; TRACE(("check_module_image(path = \"%s\", searchedName = \"%s\")\n", path, searchedName)); - ASSERT(hash_lookup(sModuleImagesHash, path) == NULL); - if (load_module_image(path, &image) < B_OK) + if (get_module_image(path, &image) < B_OK) return B_ENTRY_NOT_FOUND; for (info = image->info; *info; info++) { @@ -467,6 +472,9 @@ unload_module_image(image, path); } + // decrement the ref we got in get_module_image + put_module_image(image); + return match; } From geist at mail.berlios.de Thu Jun 21 07:37:47 2007 From: geist at mail.berlios.de (geist at BerliOS) Date: Thu, 21 Jun 2007 07:37:47 +0200 Subject: [Haiku-commits] r21477 - in haiku/trunk: headers/private/kernel src/system/kernel Message-ID: <200706210537.l5L5bltN009738@sheep.berlios.de> Author: geist Date: 2007-06-21 07:37:46 +0200 (Thu, 21 Jun 2007) New Revision: 21477 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21477&view=rev Modified: haiku/trunk/headers/private/kernel/debug.h haiku/trunk/headers/private/kernel/lock.h haiku/trunk/src/system/kernel/heap.c Log: re-enable kernel asserts. Disabled by default, but all kernel devs are *highly* recommended to turn them on for your builds and see if it trips anything, and then fix it. Modified: haiku/trunk/headers/private/kernel/debug.h =================================================================== --- haiku/trunk/headers/private/kernel/debug.h 2007-06-21 05:07:14 UTC (rev 21476) +++ haiku/trunk/headers/private/kernel/debug.h 2007-06-21 05:37:46 UTC (rev 21477) @@ -11,23 +11,34 @@ #include -struct kernel_args; +//#define DEBUG 1 +#if DEBUG +/* + * The kernel debug level. + * Level 1 is usual asserts, > 1 should be used for very expensive runtime checks + */ +#define KDEBUG 1 +#endif -#if DEBUG -# define ASSERT(x) \ - if (x) {} else { panic("ASSERT FAILED (%s:%d): %s\n", __FILE__, __LINE__, #x); } +#define ASSERT_ALWAYS(x) \ + do { if (!(x)) { panic("ASSERT FAILED (%s:%d): %s\n", __FILE__, __LINE__, #x); } } while (0) + +#if KDEBUG +#define ASSERT(x) ASSERT_ALWAYS(x) #else -# define ASSERT(x) +#define ASSERT(x) \ + do { } while(0) #endif extern int dbg_register_file[B_MAX_CPU_COUNT][14]; - #ifdef __cplusplus extern "C" { #endif +struct kernel_args; + extern status_t debug_init(struct kernel_args *args); extern status_t debug_init_post_vm(struct kernel_args *args); extern status_t debug_init_post_modules(struct kernel_args *args); Modified: haiku/trunk/headers/private/kernel/lock.h =================================================================== --- haiku/trunk/headers/private/kernel/lock.h 2007-06-21 05:07:14 UTC (rev 21476) +++ haiku/trunk/headers/private/kernel/lock.h 2007-06-21 05:37:46 UTC (rev 21477) @@ -39,11 +39,14 @@ #define RW_MAX_READERS 1000000 -#ifdef DEBUG +#if 0 && KDEBUG // XXX disable this for now, it causes problems when including thread.h here # include -#endif #define ASSERT_LOCKED_RECURSIVE(r) { ASSERT(thread_get_current_thread_id() == (r)->holder); } #define ASSERT_LOCKED_MUTEX(m) { ASSERT(thread_get_current_thread_id() == (m)->holder); } +#else +#define ASSERT_LOCKED_RECURSIVE(r) +#define ASSERT_LOCKED_MUTEX(m) +#endif #ifdef __cplusplus Modified: haiku/trunk/src/system/kernel/heap.c =================================================================== --- haiku/trunk/src/system/kernel/heap.c 2007-06-21 05:07:14 UTC (rev 21476) +++ haiku/trunk/src/system/kernel/heap.c 2007-06-21 05:37:46 UTC (rev 21477) @@ -28,7 +28,7 @@ #endif /* prevent freeing pointers that were not allocated by kmalloc or are already freeed */ -#ifdef DEBUG +#if KDEBUG > 1 # define PARANOID_POINTER_CHECK 1 #else # define PARANOID_POINTER_CHECK 0 @@ -125,7 +125,7 @@ #if PARANOID_POINTER_CHECK -#define PTRCHECKLIST_ENTRIES 8192 +#define PTRCHECKLIST_ENTRIES 32768 static void *ptrchecklist[PTRCHECKLIST_ENTRIES]; /* automatically initialized to zero */ static void From stefano.ceccherini at gmail.com Thu Jun 21 09:30:53 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 21 Jun 2007 09:30:53 +0200 Subject: [Haiku-commits] r21465 - in haiku/trunk: headers/private/interface src/kits/interface In-Reply-To: <20070620134755.5973.3@cs.tu-berlin.de> References: <200706192309.l5JN929X005644@sheep.berlios.de> <894b9700706200035s19c47ebek3c422ca85cc853f1@mail.gmail.com> <20070620134755.5973.3@cs.tu-berlin.de> Message-ID: <894b9700706210030x445effc2s5e1cad62485eb91e@mail.gmail.com> 2007/6/20, Ingo Weinhold : > It's the standard menu bar behavior. If you click in the area to the right > of the rightmost menu, nothing shall happen. I suppose one would have to > update the item margins (BMenu::SetItemMargins()) in > _BMCMenuBar_::FrameResized() to adjust the behavior. Yeah... or maybe there is another hacky way... I'll have a look. > No idea why Be used a BMenuBar in the first place. This all seems pretty > hacky. Yeah, don't tell me, you just don't know how much I hate how our menu classes work. > Unfortunately we're stuck with that, until we break compatibility. :-/ Indeed. From axeld at mail.berlios.de Thu Jun 21 12:14:12 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 21 Jun 2007 12:14:12 +0200 Subject: [Haiku-commits] r21478 - in haiku/trunk: build/jam src/add-ons/accelerants/s3savage src/add-ons/kernel/drivers/graphics/s3savage src/apps/aboutsystem Message-ID: <200706211014.l5LAECWM028527@sheep.berlios.de> Author: axeld Date: 2007-06-21 12:14:11 +0200 (Thu, 21 Jun 2007) New Revision: 21478 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21478&view=rev Removed: haiku/trunk/src/add-ons/accelerants/s3savage/LICENSE haiku/trunk/src/add-ons/kernel/drivers/graphics/s3savage/LICENSE Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: * Removed the old LICENSE files of the previous S3 Savage driver as suggested by Gerald. * Added Gerald Zajac and Jan Kloetzke to the list of contributors. * Added the s3savage driver and accelerant to the image. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2007-06-21 05:37:46 UTC (rev 21477) +++ haiku/trunk/build/jam/HaikuImage 2007-06-21 10:14:11 UTC (rev 21478) @@ -75,7 +75,7 @@ BEOS_ADD_ONS_ACCELERANTS = $(X86_ONLY)radeon.accelerant $(X86_ONLY)nvidia.accelerant $(X86_ONLY)matrox.accelerant $(X86_ONLY)neomagic.accelerant - $(X86_ONLY)intel_extreme.accelerant vesa.accelerant + $(X86_ONLY)intel_extreme.accelerant $(X86_ONLY)s3savage.accelerant vesa.accelerant #$(X86_ONLY)vmware.accelerant ; BEOS_ADD_ONS_TRANSLATORS = BMPTranslator GIFTranslator JPEGTranslator @@ -108,8 +108,8 @@ BEOS_ADD_ONS_SCREENSAVERS = Haiku IFS ; BEOS_ADD_ONS_DRIVERS_AUDIO = auich auvia emuxki hda ; BEOS_ADD_ONS_DRIVERS_GRAPHICS = $(X86_ONLY)radeon $(X86_ONLY)nvidia - $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme vesa - #$(X86_ONLY)vmware + $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme + $(X86_ONLY)s3savage vesa #$(X86_ONLY)vmware ; BEOS_ADD_ONS_DRIVERS_MIDI = emuxki ; BEOS_ADD_ONS_DRIVERS_NET = etherpci ipro1000 rtl8139 rtl8169 sis900 Deleted: haiku/trunk/src/add-ons/accelerants/s3savage/LICENSE Deleted: haiku/trunk/src/add-ons/kernel/drivers/graphics/s3savage/LICENSE Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2007-06-21 05:37:46 UTC (rev 21477) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2007-06-21 10:14:11 UTC (rev 21478) @@ -391,6 +391,7 @@ "Carwyn Jones\n" "Vasilis Kaoutsis\n" "Euan Kirkhope\n" + "Jan Kl?tzke\n" "Marcin Konicki\n" "Kurtis Kopf\n" "Thomas Kurschel\n" @@ -431,6 +432,7 @@ "Michael Wilber\n" "Ulrich Wimboeck\n" "Gabe Yoder\n" + "Gerald Zajac\n" "?ukasz Zemczak\n" "\n" B_UTF8_ELLIPSIS " and probably some more we forgot to mention (sorry!)" "\n\n"); From axeld at pinc-software.de Thu Jun 21 13:37:09 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 21 Jun 2007 13:37:09 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r21450_-_in_haiku/trunk=3A_header?= =?iso-8859-15?q?s/os/game_src/kits/game?= In-Reply-To: <200706180953.l5I9rbrM013002@sheep.berlios.de> Message-ID: <8468518783-BeMail@zon> jackburton at BerliOS wrote: > + status_t status = B_ERROR; [...] > + } catch (int error) { > + status = error; Shouldn't that be status_t instead of int? Bye, Axel. From axeld at pinc-software.de Thu Jun 21 13:41:06 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 21 Jun 2007 13:41:06 +0200 CEST Subject: [Haiku-commits] r21432 - haiku/trunk/src/tools/fs_shell In-Reply-To: Message-ID: <8705861248-BeMail@zon> "J?r?me Duval" wrote: > > > I suppose the ideal solution would be to change the > > > cache_next_block_in_transaction() interface, e.g. to using a void > > > * > > > cookie. > > Another option would be to simply make the cookie a uint64. I > > actually got most of the build working properly on x86-64 > > yesterday, > > took a while to debug, but I didn't check them in yet, since they > > were pretty nasty. > I wouldn't mind. Axel, do you have an opinion here ? I'd favour Ingo's suggestion and change the cookie to void* instead of uint32. Bye, Axel. From stefano.ceccherini at gmail.com Thu Jun 21 13:47:09 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 21 Jun 2007 13:47:09 +0200 Subject: [Haiku-commits] r21450 - in haiku/trunk: headers/os/game src/kits/game In-Reply-To: <8468518783-BeMail@zon> References: <200706180953.l5I9rbrM013002@sheep.berlios.de> <8468518783-BeMail@zon> Message-ID: <894b9700706210447o18cf9375v90cdd6f4b6e1c2aa@mail.gmail.com> 2007/6/21, Axel D?rfler : > jackburton at BerliOS wrote: > > + status_t status = B_ERROR; > [...] > > + } catch (int error) { > > + status = error; > > Shouldn't that be status_t instead of int? > Hmmm not sure. According to Marcus https://lists.berlios.de/pipermail/haiku-commits/2007-May/012358.html and Ingo https://lists.berlios.de/pipermail/haiku-commits/2007-May/012359.html no. From stefano.ceccherini at gmail.com Thu Jun 21 13:49:10 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 21 Jun 2007 13:49:10 +0200 Subject: [Haiku-commits] r21450 - in haiku/trunk: headers/os/game src/kits/game In-Reply-To: <894b9700706210447o18cf9375v90cdd6f4b6e1c2aa@mail.gmail.com> References: <200706180953.l5I9rbrM013002@sheep.berlios.de> <8468518783-BeMail@zon> <894b9700706210447o18cf9375v90cdd6f4b6e1c2aa@mail.gmail.com> Message-ID: <894b9700706210449y14c080ebg516168a7a95b7b58@mail.gmail.com> 2007/6/21, Stefano Ceccherini : > 2007/6/21, Axel D?rfler : > > jackburton at BerliOS wrote: > > > + status_t status = B_ERROR; > > [...] > > > + } catch (int error) { > > > + status = error; > > > > Shouldn't that be status_t instead of int? > > > > Hmmm not sure. According to Marcus > https://lists.berlios.de/pipermail/haiku-commits/2007-May/012358.html > and Ingo > https://lists.berlios.de/pipermail/haiku-commits/2007-May/012359.html > no. I just realized that was a different case. I think you are right, definitely. From axeld at pinc-software.de Thu Jun 21 13:49:59 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 21 Jun 2007 13:49:59 +0200 CEST Subject: [Haiku-commits] r21419 - in haiku/trunk/src: . kits kits/shared In-Reply-To: <20070618000642.8119.5@cs.tu-berlin.de> Message-ID: <9238500056-BeMail@zon> Ingo Weinhold wrote: > On 2007-06-17 at 23:40:15 [+0200], Axel D?rfler > > wrote: > > bonefish at BerliOS wrote: > > > Log: > > > libshared.a doesn't deserve a src/ subdirectory. Moved to > > > src/kits/shared. > > kits? Wouldn't libs be more appropriate? (as it's not shared > > between > > the kits, but between the apps?) > After checking src/libs I realized that, besides the icon and USB > stuff, it > only contains third party libraries -- which is how it was originally > intended. I think, src/kits is a way better fit. I'd also move the > src/libs/{icon,usb} to src/kits, but maybe the authors beat me to it > (hint, > hint! :-P) While that indeed cleans src/libs, it also somehow clobbers src/kits - it's no longer including the public API that makes the Be (and now Haiku) API, but also additional internally or privately only used implementations. But since only "shared" doesn't really fit in there, I'll probably survive it - I just don't like it :-) > BTW, I also consider moving src/tools to src/build/tools. I'll wait > till > the build system porting endeavors calm down a little, though. I'm not against that, but it makes me wonder why we moved Jam to the "other" buildtools tree in the first place? Bye, Axel. From axeld at mail.berlios.de Thu Jun 21 14:29:48 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 21 Jun 2007 14:29:48 +0200 Subject: [Haiku-commits] r21479 - haiku/trunk/src/kits/tracker Message-ID: <200706211229.l5LCTm5e028636@sheep.berlios.de> Author: axeld Date: 2007-06-21 14:29:48 +0200 (Thu, 21 Jun 2007) New Revision: 21479 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21479&view=rev Modified: haiku/trunk/src/kits/tracker/SettingsViews.cpp haiku/trunk/src/kits/tracker/TrackerInitialState.cpp haiku/trunk/src/kits/tracker/TrackerSettings.cpp Log: The "show shared volumes on Desktop" setting now defaults to true. Modified: haiku/trunk/src/kits/tracker/SettingsViews.cpp =================================================================== --- haiku/trunk/src/kits/tracker/SettingsViews.cpp 2007-06-21 10:14:11 UTC (rev 21478) +++ haiku/trunk/src/kits/tracker/SettingsViews.cpp 2007-06-21 12:29:48 UTC (rev 21479) @@ -308,7 +308,7 @@ settings.SetShowDisksIcon(false); settings.SetMountVolumesOntoDesktop(true); - settings.SetMountSharedVolumesOntoDesktop(false); + settings.SetMountSharedVolumesOntoDesktop(true); settings.SetIntegrateNonBootBeOSDesktops(false); settings.SetEjectWhenUnmounting(true); Modified: haiku/trunk/src/kits/tracker/TrackerInitialState.cpp =================================================================== --- haiku/trunk/src/kits/tracker/TrackerInitialState.cpp 2007-06-21 10:14:11 UTC (rev 21478) +++ haiku/trunk/src/kits/tracker/TrackerInitialState.cpp 2007-06-21 12:29:48 UTC (rev 21479) @@ -472,7 +472,6 @@ if (FSGetBootDeskDir(&dir) == B_OK) { attr_info info; if (dir.GetAttrInfo(kBackgroundImageInfo, &info) != B_OK) { - BMessage message; AddTemporaryBackgroundImages(&message, (BString(defaultFolderPath) << "bgdefault.tga").String(), Modified: haiku/trunk/src/kits/tracker/TrackerSettings.cpp =================================================================== --- haiku/trunk/src/kits/tracker/TrackerSettings.cpp 2007-06-21 10:14:11 UTC (rev 21478) +++ haiku/trunk/src/kits/tracker/TrackerSettings.cpp 2007-06-21 12:29:48 UTC (rev 21479) @@ -167,10 +167,12 @@ if (fSettingsLoaded) return; + // Set default settings before reading from disk + Add(fShowDisksIcon = new BooleanValueSetting("ShowDisksIcon", false)); Add(fMountVolumesOntoDesktop = new BooleanValueSetting("MountVolumesOntoDesktop", true)); Add(fMountSharedVolumesOntoDesktop = - new BooleanValueSetting("MountSharedVolumesOntoDesktop", false)); + new BooleanValueSetting("MountSharedVolumesOntoDesktop", true)); Add(fIntegrateNonBootBeOSDesktops = new BooleanValueSetting ("IntegrateNonBootBeOSDesktops", true)); Add(fIntegrateAllNonBootDesktops = new BooleanValueSetting From axeld at mail.berlios.de Thu Jun 21 14:34:29 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 21 Jun 2007 14:34:29 +0200 Subject: [Haiku-commits] r21480 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200706211234.l5LCYTKI031259@sheep.berlios.de> Author: axeld Date: 2007-06-21 14:34:28 +0200 (Thu, 21 Jun 2007) New Revision: 21480 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21480&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/CachedBlock.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/Lock.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/system_dependencies.h Log: * Fixed a bug in CachedBlock::Unset() that would call block_cache_put() on the same block everytime it's called - that caused negative reference counts in the block cache, causing all sorts of problems once they were flushed. * Changed order of includes in system_dependencies.h to what I prefer: descending from private to public (resp. from most specific to most generic) headers. * Minor cleanup. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/CachedBlock.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/CachedBlock.h 2007-06-21 12:29:48 UTC (rev 21479) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/CachedBlock.h 2007-06-21 12:34:28 UTC (rev 21480) @@ -1,12 +1,13 @@ -/* CachedBlock - interface for the block cache - * - * Copyright 2001-2004, Axel D?rfler, axeld at pinc-software.de. +/* + * Copyright 2001-2007, Axel D?rfler, axeld at pinc-software.de. * This file may be used under the terms of the MIT License. */ #ifndef CACHED_BLOCK_H #define CACHED_BLOCK_H +//! interface for the block cache + #include "system_dependencies.h" #include "Volume.h" @@ -35,9 +36,12 @@ inline const uint8 *SetTo(off_t block, off_t base, size_t length); inline const uint8 *SetTo(off_t block); inline const uint8 *SetTo(block_run run); - inline uint8 *SetToWritable(Transaction &transaction, off_t block, off_t base, size_t length, bool empty = false); - inline uint8 *SetToWritable(Transaction &transaction, off_t block, bool empty = false); - inline uint8 *SetToWritable(Transaction &transaction, block_run run, bool empty = false); + inline uint8 *SetToWritable(Transaction &transaction, off_t block, + off_t base, size_t length, bool empty = false); + inline uint8 *SetToWritable(Transaction &transaction, off_t block, + bool empty = false); + inline uint8 *SetToWritable(Transaction &transaction, block_run run, + bool empty = false); inline status_t MakeWritable(Transaction &transaction); const uint8 *Block() const { return fBlock; } @@ -57,7 +61,6 @@ }; -//-------------------------------------- // inlines @@ -121,8 +124,10 @@ inline void CachedBlock::Unset() { - if (fBlock != NULL) + if (fBlock != NULL) { block_cache_put(fVolume->BlockCache(), fBlockNumber); + fBlock = NULL; + } } @@ -131,7 +136,8 @@ { Unset(); fBlockNumber = block; - return fBlock = (uint8 *)block_cache_get_etc(fVolume->BlockCache(), block, base, length); + return fBlock = (uint8 *)block_cache_get_etc(fVolume->BlockCache(), + block, base, length); } @@ -150,16 +156,21 @@ inline uint8 * -CachedBlock::SetToWritable(Transaction &transaction, off_t block, off_t base, size_t length, bool empty) +CachedBlock::SetToWritable(Transaction &transaction, off_t block, off_t base, + size_t length, bool empty) { Unset(); fBlockNumber = block; - if (empty) - return fBlock = (uint8 *)block_cache_get_empty(fVolume->BlockCache(), block, transaction.ID()); + if (empty) { + fBlock = (uint8 *)block_cache_get_empty(fVolume->BlockCache(), + block, transaction.ID()); + } else { + fBlock = (uint8 *)block_cache_get_writable_etc(fVolume->BlockCache(), + block, base, length, transaction.ID()); + } - return fBlock = (uint8 *)block_cache_get_writable_etc(fVolume->BlockCache(), - block, base, length, transaction.ID()); + return fBlock; } @@ -183,7 +194,8 @@ if (fBlock == NULL) return B_NO_INIT; - return block_cache_make_writable(fVolume->BlockCache(), fBlockNumber, transaction.ID()); + return block_cache_make_writable(fVolume->BlockCache(), fBlockNumber, + transaction.ID()); } Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Lock.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Lock.h 2007-06-21 12:29:48 UTC (rev 21479) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Lock.h 2007-06-21 12:34:28 UTC (rev 21480) @@ -1,5 +1,4 @@ /* - * * Copyright 2001-2007, Axel D?rfler, axeld at pinc-software.de. * This file may be used under the terms of the MIT License. */ Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/system_dependencies.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/system_dependencies.h 2007-06-21 12:29:48 UTC (rev 21479) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/system_dependencies.h 2007-06-21 12:34:28 UTC (rev 21480) @@ -2,7 +2,6 @@ * Copyright 2007, Ingo Weinhold, bonefish at cs.tu-berlin.de. * Distributed under the terms of the MIT License. */ - #ifndef _SYSTEM_DEPENDENCIES_H #define _SYSTEM_DEPENDENCIES_H @@ -13,6 +12,28 @@ #else // !BFS_SHELL +#include +#include +#include + +#include + +#ifndef _BOOT_MODE +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif // _BOOT_MODE + #include #include #include @@ -22,28 +43,6 @@ #include #include -#include - -#ifndef _BOOT_MODE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif // _BOOT_MODE - -#include -#include -#include - #endif // !BFS_SHELL From axeld at mail.berlios.de Thu Jun 21 14:35:40 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 21 Jun 2007 14:35:40 +0200 Subject: [Haiku-commits] r21481 - haiku/trunk/src/system/kernel/cache Message-ID: <200706211235.l5LCZe8Q032573@sheep.berlios.de> Author: axeld Date: 2007-06-21 14:35:39 +0200 (Thu, 21 Jun 2007) New Revision: 21481 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21481&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: Putting an unused block will now trigger a panic. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2007-06-21 12:34:28 UTC (rev 21480) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2007-06-21 12:35:39 UTC (rev 21481) @@ -446,6 +446,11 @@ } #endif + if (block->ref_count < 1) { + panic("Invalid ref_count for block %p, cache %p\n", block, cache); + return; + } + if (--block->ref_count == 0 && block->transaction == NULL && block->previous_transaction == NULL) { From axeld at mail.berlios.de Thu Jun 21 15:57:46 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 21 Jun 2007 15:57:46 +0200 Subject: [Haiku-commits] r21482 - in haiku/trunk: headers/private/kernel src/system/kernel/vm Message-ID: <200706211357.l5LDvkre007357@sheep.berlios.de> Author: axeld Date: 2007-06-21 15:57:46 +0200 (Thu, 21 Jun 2007) New Revision: 21482 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21482&view=rev Modified: haiku/trunk/headers/private/kernel/vm_cache.h haiku/trunk/src/system/kernel/vm/vm.cpp haiku/trunk/src/system/kernel/vm/vm_cache.c Log: Ingo and I fixed a couple of VM bugs in a late night debugging session: * vm_copy_on_write_area() now does no longer overwrite the ref_count, but keeps it's reference to the cache until it has unlocked it. * It now also locks its reference from the start, preventing any other thread to interfere. * vm_cache_remove_consumer() now detects if it has to remove a foreign busy page itself in order to preserve a mapped page. * vm_soft_fault() now keeps a reference to the cache that owns the page to be mapped until it has actually mapped it. * vm_unmap_pages() removed the mappings of all pages of the area instead of only those that are within the requested range. * Kept (disabled) debug output for convenience. Modified: haiku/trunk/headers/private/kernel/vm_cache.h =================================================================== --- haiku/trunk/headers/private/kernel/vm_cache.h 2007-06-21 12:35:39 UTC (rev 21481) +++ haiku/trunk/headers/private/kernel/vm_cache.h 2007-06-21 13:57:46 UTC (rev 21482) @@ -21,7 +21,7 @@ status_t vm_cache_init(struct kernel_args *args); vm_cache *vm_cache_create(vm_store *store); -status_t vm_cache_ref_create(vm_cache *cache); +status_t vm_cache_ref_create(vm_cache *cache, bool acquireLock); void vm_cache_acquire_ref(vm_cache_ref *cache_ref); void vm_cache_release_ref(vm_cache_ref *cache_ref); vm_page *vm_cache_lookup_page(vm_cache_ref *cacheRef, off_t page); Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2007-06-21 12:35:39 UTC (rev 21481) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2007-06-21 13:57:46 UTC (rev 21482) @@ -532,7 +532,7 @@ newStore->ops->destroy(newStore); goto err1; } - status = vm_cache_ref_create(newCache); + status = vm_cache_ref_create(newCache, false); if (status < B_OK) { newStore->ops->destroy(newStore); free(newCache); @@ -802,7 +802,7 @@ status = B_NO_MEMORY; goto err2; } - status = vm_cache_ref_create(cache); + status = vm_cache_ref_create(cache, false); if (status < B_OK) goto err3; @@ -1022,7 +1022,7 @@ status = B_NO_MEMORY; goto err2; } - status = vm_cache_ref_create(cache); + status = vm_cache_ref_create(cache, false); if (status < B_OK) goto err3; @@ -1110,7 +1110,7 @@ status = B_NO_MEMORY; goto err2; } - status = vm_cache_ref_create(cache); + status = vm_cache_ref_create(cache, false); if (status < B_OK) goto err3; @@ -1166,7 +1166,7 @@ status = B_NO_MEMORY; goto err1; } - status = vm_cache_ref_create(cache); + status = vm_cache_ref_create(cache, false); if (status < B_OK) goto err2; @@ -1568,7 +1568,8 @@ goto err2; } - status = vm_cache_ref_create(lowerCache); + // we need to hold the cache_ref lock when we want to switch its cache + status = vm_cache_ref_create(lowerCache, true); if (status < B_OK) goto err3; @@ -1579,9 +1580,6 @@ if (area->protection & B_READ_AREA) protection |= B_READ_AREA; - // we need to hold the cache_ref lock when we want to switch its cache - mutex_lock(&lowerCacheRef->lock); - upperCache->type = CACHE_TYPE_RAM; upperCache->temporary = 1; upperCache->scan_skip = lowerCache->scan_skip; @@ -1600,7 +1598,8 @@ &lowerCache->consumers, consumer)) != NULL) { count++; } - lowerCacheRef->ref_count = count; + + atomic_add(&lowerCacheRef->ref_count, count); atomic_add(&upperCacheRef->ref_count, -count); } @@ -1628,6 +1627,8 @@ mutex_unlock(&lowerCacheRef->lock); mutex_unlock(&upperCacheRef->lock); + vm_cache_release_ref(lowerCacheRef); + return B_OK; err3: @@ -1962,25 +1963,27 @@ map->ops->unmap(map, base, end); if (area->wiring == B_NO_LOCK) { + uint32 startOffset = (area->cache_offset + base - area->base) + >> PAGE_SHIFT; + uint32 endOffset = startOffset + (size >> PAGE_SHIFT); + vm_page_mapping *mapping; vm_area_mappings queue; - uint32 count = 0; cpu_status state = disable_interrupts(); acquire_spinlock(&sMappingLock); - vm_page_mapping *mapping; - while ((mapping = area->mappings.RemoveHead()) != NULL) { + vm_area_mappings::Iterator iterator = area->mappings.GetIterator(); + while (iterator.HasNext()) { + mapping = iterator.Next(); + + vm_page *page = mapping->page; + if (page->cache_offset < startOffset || page->cache_offset >= endOffset) + continue; + mapping->page->mappings.Remove(mapping); + iterator.Remove(); + queue.Add(mapping); - - // temporary unlock to handle interrupts and let others play as well - if ((++count % 256) == 0) { - release_spinlock(&sMappingLock); - restore_interrupts(state); - - state = disable_interrupts(); - acquire_spinlock(&sMappingLock); - } } release_spinlock(&sMappingLock); @@ -3179,14 +3182,15 @@ if (!isLocked) mutex_lock(&cacheRef->lock); - vm_cache_remove_page(cacheRef, &dummyPage); + if (dummyPage.state == PAGE_STATE_BUSY) { + vm_cache_remove_page(cacheRef, &dummyPage); + dummyPage.state = PAGE_STATE_INACTIVE; + } if (!isLocked) mutex_unlock(&cacheRef->lock); vm_cache_release_ref(cacheRef); - - dummyPage.state = PAGE_STATE_INACTIVE; } @@ -3250,22 +3254,27 @@ size_t bytesRead; iovec vec; - vec.iov_len = bytesRead = B_PAGE_SIZE; - - mutex_unlock(&cacheRef->lock); - page = vm_page_allocate_page(PAGE_STATE_FREE); + // we mark that page busy reading, so that the file cache can + // ignore us in case it works on the very same page + // (this is actually only needed if this is the topRefCache, but we + // do it anyway for simplicity's sake) dummyPage.queue_next = page; dummyPage.busy_reading = true; - // we mark that page busy reading, so that the file cache can ignore - // us in case it works on the very same page - map->ops->get_physical_page(page->physical_page_number * B_PAGE_SIZE, (addr_t *)&vec.iov_base, PHYSICAL_PAGE_CAN_WAIT); - status_t status = store->ops->read(store, cacheOffset, &vec, 1, &bytesRead, false); + mutex_unlock(&cacheRef->lock); + + map->ops->get_physical_page(page->physical_page_number * B_PAGE_SIZE, + (addr_t *)&vec.iov_base, PHYSICAL_PAGE_CAN_WAIT); + vec.iov_len = bytesRead = B_PAGE_SIZE; + + status_t status = store->ops->read(store, cacheOffset, &vec, 1, + &bytesRead, false); if (status < B_OK) { // TODO: real error handling! - panic("reading from store %p (cacheRef %p) returned: %s!\n", store, cacheRef, strerror(status)); + panic("reading from store %p (cacheRef %p) returned: %s!\n", + store, cacheRef, strerror(status)); } map->ops->put_physical_page((addr_t)vec.iov_base); @@ -3337,7 +3346,8 @@ */ static inline vm_page * fault_get_page(vm_translation_map *map, vm_cache_ref *topCacheRef, - off_t cacheOffset, bool isWrite, vm_page &dummyPage, vm_cache_ref **_sourceRef) + off_t cacheOffset, bool isWrite, vm_page &dummyPage, vm_cache_ref **_sourceRef, + vm_cache_ref **_copiedSourceRef) { vm_cache_ref *cacheRef; vm_page *page = fault_find_page(map, topCacheRef, cacheOffset, isWrite, @@ -3375,6 +3385,11 @@ // from our source cache - if possible, that is FTRACE(("get new page, copy it, and put it into the topmost cache\n")); page = vm_page_allocate_page(PAGE_STATE_FREE); +#if 0 +if (cacheOffset == 0x12000) + dprintf("%ld: copy page %p to page %p from cache %p to cache %p\n", find_thread(NULL), + sourcePage, page, sourcePage->cache, topCacheRef->cache); +#endif // try to get a mapping for the src and dest page so we can copy it for (;;) { @@ -3413,7 +3428,7 @@ fault_remove_dummy_page(dummyPage, false); } - vm_cache_release_ref(cacheRef); + *_copiedSourceRef = cacheRef; cacheRef = topCacheRef; vm_cache_acquire_ref(cacheRef); @@ -3523,11 +3538,13 @@ dummyPage.cache = NULL; dummyPage.state = PAGE_STATE_INACTIVE; dummyPage.type = PAGE_TYPE_DUMMY; + dummyPage.busy_writing = isWrite; dummyPage.wired_count = 0; + vm_cache_ref *copiedPageSourceRef = NULL; vm_cache_ref *pageSourceRef; vm_page *page = fault_get_page(map, topCacheRef, cacheOffset, isWrite, - dummyPage, &pageSourceRef); + dummyPage, &pageSourceRef, &copiedPageSourceRef); status_t status = B_OK; @@ -3566,6 +3583,8 @@ mutex_unlock(&pageSourceRef->lock); vm_cache_release_ref(pageSourceRef); + if (copiedPageSourceRef) + vm_cache_release_ref(copiedPageSourceRef); if (dummyPage.state == PAGE_STATE_BUSY) { // We still have the dummy page in the cache - that happens if we didn't need Modified: haiku/trunk/src/system/kernel/vm/vm_cache.c =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_cache.c 2007-06-21 12:35:39 UTC (rev 21481) +++ haiku/trunk/src/system/kernel/vm/vm_cache.c 2007-06-21 13:57:46 UTC (rev 21482) @@ -119,7 +119,7 @@ status_t -vm_cache_ref_create(vm_cache *cache) +vm_cache_ref_create(vm_cache *cache, bool acquireLock) { vm_cache_ref *ref; status_t status; @@ -136,6 +136,9 @@ return status; } + if (acquireLock) + mutex_lock(&ref->lock); + ref->areas = NULL; ref->ref_count = 1; @@ -536,16 +539,33 @@ if (consumerPage == NULL) { // the page already is not yet in the consumer cache - move // it upwards +#if 0 +if (consumer->virtual_base == 0x11000) + dprintf("%ld: move page %p offset %ld from cache %p to cache %p\n", + find_thread(NULL), page, page->cache_offset, cache, consumer); +#endif vm_cache_remove_page(cacheRef, page); vm_cache_insert_page(consumerRef, page, (off_t)page->cache_offset << PAGE_SHIFT); + } else if (consumerPage->state == PAGE_STATE_BUSY + && consumerPage->type == PAGE_TYPE_DUMMY + && !consumerPage->busy_writing) { + // the page is currently busy taking a read fault - IOW, + // vm_soft_fault() has mapped our page so we can just + // move it up +//dprintf("%ld: merged busy page %p, cache %p, offset %ld\n", find_thread(NULL), page, cacheRef->cache, page->cache_offset); + vm_cache_remove_page(cacheRef, consumerPage); + consumerPage->state = PAGE_STATE_INACTIVE; + + vm_cache_remove_page(cacheRef, page); + vm_cache_insert_page(consumerRef, page, + (off_t)page->cache_offset << PAGE_SHIFT); + } #if 0 - } else if (consumerPage->state != PAGE_STATE_BUSY - && (page->mappings != 0 || page->wired_count != 0)) { - panic("page %p has still mappings (consumer cache %p)!", - page, consumerRef); +else if (consumer->virtual_base == 0x11000) + dprintf("%ld: did not move page %p offset %ld from cache %p to cache %p because there is page %p\n", + find_thread(NULL), page, page->cache_offset, cache, consumer, consumerPage); #endif - } } newSource = cache->source; From nielx at mail.berlios.de Thu Jun 21 18:29:46 2007 From: nielx at mail.berlios.de (nielx at BerliOS) Date: Thu, 21 Jun 2007 18:29:46 +0200 Subject: [Haiku-commits] r21483 - haiku/trunk/docs/user/drivers Message-ID: <200706211629.l5LGTk6Q021070@sheep.berlios.de> Author: nielx Date: 2007-06-21 18:29:43 +0200 (Thu, 21 Jun 2007) New Revision: 21483 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21483&view=rev Modified: haiku/trunk/docs/user/drivers/fs_interface.dox Log: Wrote as much documentation as I could understand. There are quite a few gaps left (search for TODO). I hope people (Ingo, Axel?) with more knowledge on this subject can check the written docs, make suggestions for improvement, and fill the gaps. After that, it needs a good revision to make the whole more consistent. Modified: haiku/trunk/docs/user/drivers/fs_interface.dox =================================================================== --- haiku/trunk/docs/user/drivers/fs_interface.dox 2007-06-21 13:57:46 UTC (rev 21482) +++ haiku/trunk/docs/user/drivers/fs_interface.dox 2007-06-21 16:29:43 UTC (rev 21483) @@ -1,4 +1,4 @@ -/* +?/* * Copyright 2007 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * @@ -12,18 +12,22 @@ /*! \file fs_interface.h \ingroup drivers + \brief Provides an interface for file system modules. + + See the \ref fs_modules "introduction to file system modules" for a guide on + how to get started with writing file system modules. */ ///// Typedefs ///// /*! \typedef typedef dev_t mount_id - \brief A \c mount_id refers to a specific mounted (virtual) volume. + \brief A \c mount_id refers to a mounted volume. */ /*! \typedef typedef ino_t vnode_id - \brief A \c vnode_id refers to one of the available virtual nodes. + \brief A \c vnode_id refers to one of the available vnodes. */ /*! @@ -69,7 +73,9 @@ /*! \var write_stat_mask::FS_WRITE_STAT_SIZE - \brief The size field should be updated. + \brief The size field should be updated. If the actual size is less than the + new provided file size, the file should be set to the new size and the + extra space should be filled with zeros. */ /*! @@ -124,7 +130,10 @@ /*! \struct file_system_module_info - \brief Kernel module interface for file systems. + \brief Kernel module interface for file systems. + + See the \ref fs_modules "introduction to file system modules" for an + introduction to writing file systems. */ /*! @@ -153,22 +162,22 @@ /*! \fn float (*file_system_module_info::identify_partition)(int fd, partition_data *partition, void **cookie) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn status_t (*file_system_module_info::scan_partition)(int fd, partition_data *partition, void *cookie) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn void (*file_system_module_info::free_identify_partition_cookie)(partition_data *partition, void *cookie) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn void (*file_system_module_info::free_partition_content_cookie)(partition_data *partition) - \brief Undocumented. + \brief Undocumented. TODO. */ //! @} @@ -269,9 +278,7 @@ Currently, the only possible mask is solely the \c FS_WRITE_FSINFO_NAME, which asks you to update the volume name represented by the value \c volume_name in the \c fs_info struct. - - TODO: ANY OTHERS? - + \param fs The cookie your filesystem supplied to the volume that should be updated. \param info The structure that contains the new data. @@ -333,9 +340,16 @@ */ /*! - \fn status_t (*file_system_module_info::get_vnode_name)(fs_volume fs, fs_vnode vnode, char *buffer, - size_t bufferSize) - \brief Undocumented. + \fn status_t (*file_system_module_info::get_vnode_name)(fs_volume fs, + fs_vnode vnode, char *buffer, size_t bufferSize) + \brief Return the file name of a vnode. + + \param fs The file system provided cookie associated with this volume. + \param vnode The file system provided cookie associated with this vnode. + \param buffer The buffer that the name can be copied into. + \param bufferSize The size of the buffer. + \retval B_OK You successfully copied the file name into the \a buffer. + \retval "other errors" There was some error looking up or copying the name. */ /*! @@ -395,7 +409,7 @@ /*! \fn bool (*file_system_module_info::can_page)(fs_volume fs, fs_vnode vnode, fs_cookie cookie) - \brief Undocumented. + \brief Undocumented. TODO. TODO: In both the dos and the bfs implementations this thing simply returns false... Is there anything more to it? @@ -405,14 +419,14 @@ \fn status_t (*file_system_module_info::read_pages)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes, bool reenter) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn status_t (*file_system_module_info::write_pages)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes, bool reenter) - \brief Undocumented. + \brief Undocumented. TODO. */ //! @} @@ -426,7 +440,7 @@ /*! \fn status_t (*file_system_module_info::get_file_map)(fs_volume fs, fs_vnode vnode, off_t offset, size_t size, struct file_io_vec *vecs, size_t *_count) - \brief Undocumented. + \brief Undocumented. TODO. */ //! @} @@ -477,13 +491,17 @@ /*! \fn status_t (*file_system_module_info::select)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, uint8 event, uint32 ref, selectsync *sync) - \brief Undocumented. + \brief Undocumented. TODO. + + TODO: What should this do? */ /*! \fn status_t (*file_system_module_info::deselect)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, uint8 event, selectsync *sync) - \brief Undocumented. + \brief Undocumented. TODO. + + TODO: What should this do? */ /*! @@ -536,20 +554,67 @@ */ /*! - \fn status_t (*file_system_module_info::link)(fs_volume fs, fs_vnode dir, const char *name, - fs_vnode vnode) - \brief Undocumented. + \fn status_t (*file_system_module_info::link)(fs_volume fs, fs_vnode dir, + const char *name, fs_vnode vnode) + \brief Create a new hard link. + + You should make sure the user has the proper permissions. + + The virtual file system will request the creation of symbolic links with + create_symlink(). + + \param fs The file system provided cookie associated with this volume. + \param dir The cookie associated to the directory where the link should be + saved. + \param name The name the link should have. + \param vnode The vnode the new link should resolve to. + \retval B_OK The hard link is properly created. + \retval B_NOT_ALLOWED The user does not have the proper permissions. + \retval "other errors" Another error occured. */ /*! - \fn status_t (*file_system_module_info::unlink)(fs_volume fs, fs_vnode dir, const char *name) - \brief Undocumented. + \fn status_t (*file_system_module_info::unlink)(fs_volume fs, fs_vnode dir, + const char *name) + \brief Remove a node or directory. + + You should make sure the user has the proper permissions. + + \param fs The file system provided cookie associated with this volume. + \param dir The parent directory of the node that should be removed. + \param name The name of the node that should be deleted. + \retval B_OK Removal succeeded. + \retval B_ENTRY_NOT_FOUND The entry does not exist. + \retval B_NOT_ALLOWED The user does not have the proper permissions. + \retval B_DIRECTORY_NOT_EMPTY The \a name refers to a directory. The virtual + file system expects directories to be emptied before they can be unlinked. + \retval "other errors" Another error occured. */ /*! - \fn status_t (*file_system_module_info::rename)(fs_volume fs, fs_vnode fromDir, const char *fromName, - fs_vnode toDir, const char *toName) - \brief Undocumented. + \fn status_t (*file_system_module_info::rename)(fs_volume fs, fs_vnode + fromDir, const char *fromName, fs_vnode toDir, const char *toName) + \brief Rename and/or relocate a vnode. + + The virtual file system merely relays the request, so make sure the user is + not changing the file name to something like '.', '..' or anything starting + with '/'. + + This also means that it if the node is a directory, that it should not be + moved into one of its own children. + + You should also make sure the user has the proper permissions. + + \param fs The file system provided cookie associated with this volume. + \param fromDir The cookie of the parent directory the vnode should be moved + from. + \param fromName The old name of the node. + \param toDir The cookie of the parent directory the vnode should be moved to. + \param toName The new name of the node. + \retval B_OK The renaming and relocating succeeded. + \retval B_BAD_VALUE One of the supplied parameters were invalid. + \retval B_NOT_ALLOWED The user does not have the proper permissions. + \retval "other errors" Another error condition was encountered. */ /*! @@ -603,9 +668,21 @@ */ /*! - \fn status_t (*file_system_module_info::write_stat)(fs_volume fs, fs_vnode vnode, - const struct stat *stat, uint32 statMask) - \brief Undocumented. + \fn status_t (*file_system_module_info::write_stat)(fs_volume fs, fs_vnode + vnode, const struct stat *stat, uint32 statMask) + \brief Update the stats for a vnode. + + You should make sure that the new values are valid and that the user has the + proper permissions to update the stats. + + \param fs The file system provided cookie to the volume. + \param vnode The cookie to the vnode. + \param stat The structure with the updated values. + \param statMask One of the #write_stat_mask enumeration, which forms a mask + of which of the values in \a stat should actually be updated. + \retval B_OK The update succeeded. + \retval B_NOT_ALLOWED The user does not have the proper permissions. + \retval "other errors" Another error condition occured. */ //! @} @@ -920,30 +997,64 @@ //! @{ /*! - \fn status_t (*file_system_module_info::open_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie *_cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::open_attr_dir)(fs_volume fs, fs_vnode + vnode, fs_cookie *_cookie) + \brief Open a 'directory' of attributes for a \a vnode. + + See \ref concepts "Generic Concepts" on directories and iterators. Basically, + the VFS uses the same way of traversing through attributes as it traverses + through a directory. + + \param fs The file system provided cookie to the volume. + \param vnode The vnode on which the file system wants to read the attributes. + \param[out] _cookie Pointer where the file system can store a directory + cookie if the attribute directory is succesfully opened. + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::close_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::close_attr_dir)(fs_volume fs, + fs_vnode vnode, fs_cookie cookie) + \brief Close a 'directory' of attributes for a \a vnode. + + Note that you should free the cookie in the free_attr_dir_cookie() call. + + \param fs The file system provided cookie to the volume. + \param vnode The vnode on which the 'directory' was opened. + \param cookie The cookie associated with this 'directory'. + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::free_attr_dir_cookie)(fs_volume fs, fs_vnode vnode, - fs_cookie cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::free_attr_dir_cookie)(fs_volume fs, + fs_vnode vnode, fs_cookie cookie) + \brief Free the \a cookie to an attribute 'directory'. + + \param fs The file system provided cookie to the volume. + \param vnode The vnode on which the 'directory' was opened. + \param cookie The cookie associated that should be freed. + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::read_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, - struct dirent *buffer, size_t bufferSize, uint32 *_num) - \brief Undocumented. + \fn status_t (*file_system_module_info::read_attr_dir)(fs_volume fs, fs_vnode + vnode, fs_cookie cookie, struct dirent *buffer, size_t bufferSize, + uint32 *_num) + \brief Read the next one or more attribute directory entries. + + This method should perform the same tasks as read_dir(), except that the '.' + and '..' entries do not have to be present. */ /*! - \fn status_t (*file_system_module_info::rewind_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::rewind_attr_dir)(fs_volume fs, + fs_vnode vnode, fs_cookie cookie) + \brief Rewind the attribute directory iterator to the first entry. + + \param fs The file system provided cookie to the volume. + \param vnode The vnode on which the 'directory' was opened. + \param cookie The cookie associated with this 'directory'. + \return \c B_OK if everything went fine, another error code otherwise. */ //! @} @@ -955,61 +1066,154 @@ //! @{ /*! - \fn status_t (*file_system_module_info::create_attr)(fs_volume fs, fs_vnode vnode, const char *name, - uint32 type, int openMode, fs_cookie *_cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::create_attr)(fs_volume fs, fs_vnode + vnode, const char *name, uint32 type, int openMode, fs_cookie *_cookie) + \brief Create a new attribute. + + If the attribute already exists, you should open it in truncated mode. + + \param fs The file system provided cookie to the volume. + \param vnode The file system provided cookie to the vnode. + \param name The name of the attribute. + \param type The \c type_code of the attribute. + \param openMode The openMode of the associated attribute. + \param[out] _cookie A pointer where you can store an associated file system + cookie. + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::open_attr)(fs_volume fs, fs_vnode vnode, const char *name, - int openMode, fs_cookie *_cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::open_attr)(fs_volume fs, fs_vnode + vnode, const char *name, int openMode, fs_cookie *_cookie) + \brief Open an existing attribute. + + \param fs The file system provided cookie to the volume. + \param vnode The file system provided cookie to the vnode. + \param name The name of the attribute. + \param openMode The mode in which you want to open the attribute data. + \param[out] _cookie A pointer where you can store an associated file system + cookie. + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::close_attr)(fs_volume fs, fs_vnode vnode, fs_cookie cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::close_attr)(fs_volume fs, fs_vnode + vnode, fs_cookie cookie) + \brief Close access to an attribute. + + Note that you should not delete the cookie yet, you should do that when the + VFS calls free_attr_cookie(). + + \param fs The file system provided cookie to the volume. + \param vnode The file system provided cookie to the vnode. + \param cookie The cookie you associated to this attribute. + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::free_attr_cookie)(fs_volume fs, fs_vnode vnode, - fs_cookie cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::free_attr_cookie)(fs_volume fs, + fs_vnode vnode, fs_cookie cookie) + \brief Free the cookie of an attribute. + + The VFS calls this hook when all operations on the attribute have ceased. + + \param fs The file system provided cookie to the volume. + \param vnode The file system provided cookie to the vnode. + \param cookie The cookie to the attribute that should be freed. + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::read_attr)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, - off_t pos, void *buffer, size_t *length) - \brief Undocumented. + \fn status_t (*file_system_module_info::read_attr)(fs_volume fs, fs_vnode + vnode, fs_cookie cookie, off_t pos, void *buffer, size_t *length) + \brief Read attribute data associated with \a cookie. + + Read until the \a buffer with size \a length is full, or until you are out of + data, in which case you should update \a length. + + \param fs The file system provided cookie to the volume. + \param vnode The file system provided cookie to the vnode. + \param cookie The cookie you associated to this attribute. + \param pos The position to start reading from. + \param buffer The buffer the data should be copied in. + \param length The length of the buffer. Update this variable to the actual + amount of bytes read. + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::write_attr)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, - off_t pos, const void *buffer, size_t *length) - \brief Undocumented. + \fn status_t (*file_system_module_info::write_attr)(fs_volume fs, fs_vnode + vnode, fs_cookie cookie, off_t pos, const void *buffer, size_t *length) + \brief Write attribute data associated with \a cookie. + + \param fs The file system provided cookie to the volume. + \param vnode The file system provided cookie to the vnode. + \param cookie The cookie you associated with this attribute. + \param pos The position to start writing to. + \param buffer The buffer the data should be copied from. + \param length The size of the buffer. Update this variable to the actual + amount of bytes written. + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::read_attr_stat)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, - struct stat *stat) - \brief Undocumented. + \fn status_t (*file_system_module_info::read_attr_stat)(fs_volume fs, + fs_vnode vnode, fs_cookie cookie, struct stat *stat) + \brief Get the stats for an attribute. + + \param fs The file system provided cookie to the volume. + \param vnode The file system provided cookie to the vnode. + \param cookie The cookie you associated with this attribute. + \param stat A pointer to a stat structure you should fill. + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::write_attr_stat)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, - const struct stat *stat, int statMask) - \brief Undocumented. + \fn status_t (*file_system_module_info::write_attr_stat)(fs_volume fs, + fs_vnode vnode, fs_cookie cookie, const struct stat *stat, int statMask) + \brief Update the stats of an attribute. + + \param fs The file system provided cookie to the volume. + \param vnode The file system provided cookie to the vnode. + \param cookie The cookie you associated with this attribute. + \param stat A pointer to the new stats you should write. + \param statMask One or more of the values of #write_stat_mask that tell you + which fields of \a stat are to be updated. + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::rename_attr)(fs_volume fs, fs_vnode fromVnode, - const char *fromName, fs_vnode toVnode, const char *toName) - \brief Undocumented. + \fn status_t (*file_system_module_info::rename_attr)(fs_volume fs, + fs_vnode fromVnode, const char *fromName, fs_vnode toVnode, + const char *toName) + \brief Rename and/or relocate an attribute. + + You should make sure the user has the proper permissions. + + \param fs The file system provided cookie associated with this volume. + \param fromVnode The cookie associated with the vnode the attribute currently + is related to. + \param fromName The old name of the attribute. + \param toVnode The cookie associated with the vnode the attribute should be + moved to. This can be the same as \a fromVnode, in which case it only means + the attribute should be renamed. + \param toName The new name of the attribute.This can be the same as + \a fromName, in which case it only means the attribute should be relocated. + \retval B_OK The renaming and/or relocating succeeded. + \retval B_BAD_VALUE One of the supplied parameters were invalid. + \retval B_NOT_ALLOWED The user does not have the proper permissions. + \retval "other errors" Another error condition was encountered. */ /*! - \fn status_t (*file_system_module_info::remove_attr)(fs_volume fs, fs_vnode vnode, const char *name) - \brief Undocumented. + \fn status_t (*file_system_module_info::remove_attr)(fs_volume fs, + fs_vnode vnode, const char *name) + \brief Remove an attribute. + + \param fs The file system provided cookie to the volume. + \param vnode The file system provided cookie to the vnode. + \param name The name of the attribute. + \return \c B_OK if everything went fine, another error code otherwise. */ //! @} @@ -1021,46 +1225,104 @@ //! @{ /*! - \fn status_t (*file_system_module_info::open_index_dir)(fs_volume fs, fs_cookie *cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::open_index_dir)(fs_volume fs, + fs_cookie *_cookie) + \brief Open the list of an indeces as a directory. + + See \ref concepts "Generic Concepts" on directories and iterators. Basically, + the VFS uses the same way of traversing through indeces as it traverses + through a directory. + + \param fs The file system provided cookie to the volume. + \param[out] _cookie Pointer where the file system can store a directory + cookie if the index directory is succesfully opened. + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::close_index_dir)(fs_volume fs, fs_cookie cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::close_index_dir)(fs_volume fs, + fs_cookie cookie) + \brief Close a 'directory' of indeces. + + Note that you should free the cookie in the free_index_dir_cookie() call.: + + \param fs The file system provided cookie to the volume. + \param cookie The cookie associated with this 'directory'. + \return B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::free_index_dir_cookie)(fs_volume fs, fs_cookie cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::free_index_dir_cookie)(fs_volume fs, + fs_cookie cookie) + \brief Free the \a cookie to the index 'directory'. + + \param fs The file system provided cookie for the volume. + \param cookie The cookie that should be freed. + \return B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::read_index_dir)(fs_volume fs, fs_cookie cookie, - struct dirent *buffer, size_t bufferSize, uint32 *_num) - \brief Undocumented. + \fn status_t (*file_system_module_info::read_index_dir)(fs_volume fs, + fs_cookie cookie, struct dirent *buffer, size_t bufferSize, uint32 *_num) + \brief Read the next one or more index entries. + + This method should perform the same task as read_dir(), except that the '.' + and the '..' entries don't have to be present. */ /*! - \fn status_t (*file_system_module_info::rewind_index_dir)(fs_volume fs, fs_cookie cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::rewind_index_dir)(fs_volume fs, + fs_cookie cookie) + \brief Reset the index directory cookie to the first entry of the directory. + + \param fs The file system provided handle to the volume. + \param cookie The directory cookie as returned by open_index_dir(). + \return \c B_OK if everything went fine, another error code otherwise. */ /*! - \fn status_t (*file_system_module_info::create_index)(fs_volume fs, const char *name, uint32 type, - uint32 flags) - \brief Undocumented. + \fn status_t (*file_system_module_info::create_index)(fs_volume fs, + const char *name, uint32 type, uint32 flags) + \brief Create a new index. + + \param fs The file system provided handle to the volume. + \param name The name of the new index. + \param type The type of index. BFS implements the following types: + - \c B_INT32_TYPE + - \c B_UINT32_TYPE + - \c B_INT64_TYPE + - \c B_UINT64_TYPE + - \c B_FLOAT_TYPE + - \c B_DOUBLE_TYPE + - \c B_STRING_TYPE + - \c B_MIME_STRING_TYPE + \param flags There are currently no extra flags specified. This parameter can + be ignored. + \return You should return \c B_OK if the creation succeeded, or return an + error otherwise. */ /*! - \fn status_t (*file_system_module_info::remove_index)(fs_volume fs, const char *name) - \brief Undocumented. + \fn status_t (*file_system_module_info::remove_index)(fs_volume fs, + const char *name) + \brief Remove the index with \a name. + + \param fs The file system provided handle to the volume. + \param name The name of the index to be removed. + \return You should return \c B_OK if the creation succeeded, or return an + error otherwise. */ /*! - \fn status_t (*file_system_module_info::read_index_stat)(fs_volume fs, const char *name, - struct stat *stat) - \brief Undocumented. + \fn status_t (*file_system_module_info::read_index_stat)(fs_volume fs, + const char *name, struct stat *stat) + \brief Read the \a stat of the index with a name. + + \param fs The file system provided handle to the volume. + \param name The name of the index to be queried. + \param stat A pointer to a structure where you should store the values. + \return You should return \c B_OK if the creation succeeded, or return an + error otherwise. */ //! @} @@ -1072,25 +1334,68 @@ //! @{ /*! - \fn status_t (*file_system_module_info::open_query)(fs_volume fs, const char *query, uint32 flags, - port_id port, uint32 token, fs_cookie *_cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::open_query)(fs_volume fs, + const char *query, uint32 flags, port_id port, uint32 token, + fs_cookie *_cookie) + \brief Open a query as a 'directory'. + + TODO: query expressions should be documented and also the format for sending + query updates over the port should be updated. + + See \ref concepts "Generic Concepts" on directories and iterators. Basically, + the VFS uses the same way of traversing through indeces as it traverses + through a directory. + + \param fs The file system provided cookie to the volume. + \param query The string that represents a query. + \param flags Either one of these flags: + - \c #B_LIVE_QUERY The query is live. When a query is live, it is + constantly updated using the \a port. In this case the file system should + be pro-active. + - \c #B_QUERY_NON_INDEXED When this parameter is provided, the query + should be carried out over the whole file system. This parameter is + provided with the idea that sometimes the indeces can be out of date. If + the requestor for this query requires absolutely everything to be + queried, it will pass this parameter. Of course, if your indeces are + always up to date, you can ignore this parameter. + \param port The id of the port where updates need to be sent to in case the + query is live. + \param token A token that should be attached to the messages sent over the + \a port. + \param[out] _cookie The cookie that will be used as 'directory' to traverse + through the results of the query. + \return You should return \c B_OK if the creation succeeded, or return an + error otherwise. */ /*! - \fn status_t (*file_system_module_info::close_query)(fs_volume fs, fs_cookie cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::close_query)(fs_volume fs, + fs_cookie cookie) + \brief Close a 'directory' of a query. + + Note that you should free the cookie in the free_query_cookie() call. + + \param fs The file system provided cookie to the volume. + \param cookie The cookie that refers to this query. + \return You should return \c B_OK if the creation succeeded, or return an + error otherwise. */ /*! - \fn status_t (*file_system_module_info::free_query_cookie)(fs_volume fs, fs_cookie cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::free_query_cookie)(fs_volume fs, + fs_cookie cookie) + \brief Free a cookie of a query. + + \param fs The file system provided cookie to the volume. + \param cookie The cookie that should be freed. + \return You should return \c B_OK if the creation succeeded, or return an + error otherwise. */ /*! \fn status_t (*file_system_module_info::read_query)(fs_volume fs, fs_cookie cookie, struct dirent *buffer, size_t bufferSize, uint32 *_num) - \brief Reads the next one or more entries matching the query. + \brief Read the next one or more entries matching the query. This hook function works pretty much the same way as read_dir(), with the difference that it doesn't read the entries of a directory, but the entries @@ -1108,8 +1413,13 @@ */ /*! - \fn status_t (*file_system_module_info::rewind_query)(fs_volume fs, fs_cookie cookie) - \brief Undocumented. + \fn status_t (*file_system_module_info::rewind_query)(fs_volume fs, + fs_cookie cookie) + \brief Reset the query cookie to the first entry of the results. + + \param fs The file system provided handle to the volume. + \param cookie The query cookie as returned by open_query(). + \return \c B_OK if everything went fine, another error code otherwise. */ //! @} @@ -1121,71 +1431,71 @@ //! @{ /*! - \fn bool (*file_system_module_info::supports_defragmenting)(partition_data *partition, - bool *whileMounted) - \brief Undocumented. + \fn bool (*file_system_module_info::supports_defragmenting)(partition_data + *partition, bool *whileMounted) + \brief Undocumented. TODO. */ /*! \fn bool (*file_system_module_info::supports_repairing)(partition_data *partition, bool checkOnly, bool *whileMounted) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn bool (*file_system_module_info::supports_resizing)(partition_data *partition, bool *whileMounted) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn bool (*file_system_module_info::supports_moving)(partition_data *partition, bool *isNoOp) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn bool (*file_system_module_info::supports_setting_content_name)(partition_data *partition, bool *whileMounted) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn bool (*file_system_module_info::supports_setting_content_parameters)(partition_data *partition, bool *whileMounted) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn bool (*file_system_module_info::supports_initializing)(partition_data *partition) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn bool (*file_system_module_info::validate_resize)(partition_data *partition, off_t *size) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn bool (*file_system_module_info::validate_move)(partition_data *partition, off_t *start) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn bool (*file_system_module_info::validate_set_content_name)(partition_data *partition, char *name) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn bool (*file_system_module_info::validate_set_content_parameters)(partition_data *partition, const char *parameters) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn bool (*file_system_module_info::validate_initialize)(partition_data *partition, char *name, const char *parameters) - \brief Undocumented. + \brief Undocumented. TODO. */ //! @} @@ -1199,7 +1509,7 @@ /*! \fn status_t (*file_system_module_info::shadow_changed)(partition_data *partition, uint32 operation) - \brief Undocumented. + \brief Undocumented. TODO. */ //! @} @@ -1213,43 +1523,43 @@ /*! \fn status_t (*file_system_module_info::defragment)(int fd, partition_id partition, disk_job_id job) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn status_t (*file_system_module_info::repair)(int fd, partition_id partition, bool checkOnly, disk_job_id job) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn status_t (*file_system_module_info::resize)(int fd, partition_id partition, off_t size, disk_job_id job) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn status_t (*file_system_module_info::move)(int fd, partition_id partition, off_t offset, disk_job_id job) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn status_t (*file_system_module_info::set_content_name)(int fd, partition_id partition, const char *name, disk_job_id job) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn status_t (*file_system_module_info::set_content_parameters)(int fd, partition_id partition, const char *parameters, disk_job_id job) - \brief Undocumented. + \brief Undocumented. TODO. */ /*! \fn status_t (*file_system_module_info::initialize)(const char *partition, const char *name, const char *parameters, disk_job_id job) - \brief Undocumented. + \brief Undocumented. TODO. */ //! @} @@ -1259,7 +1569,7 @@ /*! \fn status_t new_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode) - \brief Creates the vnode with ID \a vnodeID and associates it with the + \brief Create the vnode with ID \a vnodeID and associates it with the private data handle \a privateNode, but leaves is in an unpublished state. The effect of the function is similar to publish_vnode(), but the vnode From geist at foobox.com Thu Jun 21 20:00:05 2007 From: geist at foobox.com (Travis Geiselbrecht) Date: Thu, 21 Jun 2007 11:00:05 -0700 Subject: [Haiku-commits] r21482 - in haiku/trunk: headers/private/kernel src/system/kernel/vm References: <200706211357.l5LDvkre007357@sheep.berlios.de> Message-ID: <002701c7b42d$fffb3650$8c030b0a@secretlevel.com> > Author: axeld > Date: 2007-06-21 15:57:46 +0200 (Thu, 21 Jun 2007) > New Revision: 21482 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21482&view=rev > > Modified: > haiku/trunk/headers/private/kernel/vm_cache.h > haiku/trunk/src/system/kernel/vm/vm.cpp > haiku/trunk/src/system/kernel/vm/vm_cache.c > Log: > Ingo and I fixed a couple of VM bugs in a late night debugging session: > * vm_copy_on_write_area() now does no longer overwrite the ref_count, but > keeps > it's reference to the cache until it has unlocked it. > * It now also locks its reference from the start, preventing any other > thread > to interfere. > * vm_cache_remove_consumer() now detects if it has to remove a foreign > busy > page itself in order to preserve a mapped page. > * vm_soft_fault() now keeps a reference to the cache that owns the page to > be > mapped until it has actually mapped it. > * vm_unmap_pages() removed the mappings of all pages of the area instead > of only > those that are within the requested range. > * Kept (disabled) debug output for convenience. Ah good, glad you caught this. I dove pretty deeply into bugs in this area the other day, and it was obvious that something was amiss but I couldn't quite track it down. This does remind me, how attached are you to the current page mapping -> area stuff you added a while back? I haven't completely worked out a better alternate solution, but it seems a little heavy handed for what I was thinking. I'll run it by you, but I think that should be maintained at a lower level than that, perhaps in the vm_translation_map itself as a side effect of doing the mmu mapping, and it should be a little more friendly to being able to be walked from the low level, for a global page walker, which at this point I think was a misdesign of the newos vm (having it do a local page scan). I dont have the code in front of me, I'm at work, but I didn't really like the looks of it, though I can't quite put my finger on it yet. Travis From korli at mail.berlios.de Thu Jun 21 20:40:33 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 21 Jun 2007 20:40:33 +0200 Subject: [Haiku-commits] r21484 - haiku/trunk/src/bin Message-ID: <200706211840.l5LIeXbr012583@sheep.berlios.de> Author: korli Date: 2007-06-21 20:40:33 +0200 (Thu, 21 Jun 2007) New Revision: 21484 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21484&view=rev Modified: haiku/trunk/src/bin/mimeset.cpp Log: actually exit with an error when it happens Modified: haiku/trunk/src/bin/mimeset.cpp =================================================================== --- haiku/trunk/src/bin/mimeset.cpp 2007-06-21 16:29:43 UTC (rev 21483) +++ haiku/trunk/src/bin/mimeset.cpp 2007-06-21 18:40:33 UTC (rev 21484) @@ -39,7 +39,7 @@ } -void +status_t process_file(const char *path) { status_t status = B_OK; @@ -57,6 +57,7 @@ fprintf(stderr, "%s: \"%s\": %s\n", sProgramName, path, strerror(status)); } + return status; } @@ -94,6 +95,7 @@ BApplication app("application/x-vnd.haiku.mimeset"); + int err = 0; while (*argv) { char *arg = *argv++; @@ -103,10 +105,15 @@ while (fgets(name, sizeof(name), stdin) != NULL) { name[strlen(name) - 1] = '\0'; // remove trailing '\n' - process_file(name); + err = process_file(name); + if (err) + exit(err); } - } else - process_file(arg); + } else { + err = process_file(arg); + if (err) + exit(err); + } } return 0; From axeld at mail.berlios.de Thu Jun 21 21:51:08 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 21 Jun 2007 21:51:08 +0200 Subject: [Haiku-commits] r21485 - in haiku/trunk: headers/private/kernel headers/private/kernel/fs headers/private/userlandfs/private src/add-ons/kernel/file_systems/bfs src/add-ons/kernel/file_systems/cdda src/add-ons/kernel/file_systems/dos src/add-ons/kernel/file_systems/googlefs src/add-ons/kernel/file_systems/iso9660 src/add-ons/kernel/file_systems/nfs src/add-ons/kernel/file_systems/ntfs src/add-ons/kernel/file_systems/ramfs src/add-ons/kernel/file_systems/reiserfs src/add-ons/kernel/file_systems/udf src/add-ons/kernel/file_systems/userlandfs/kernel_add_on src/add-ons/kernel/file_systems/userlandfs/server src/system/kernel src/system/kernel/cache src/system/kernel/fs Message-ID: <200706211951.l5LJp823019617@sheep.berlios.de> Author: axeld Date: 2007-06-21 21:50:57 +0200 (Thu, 21 Jun 2007) New Revision: 21485 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21485&view=rev Modified: haiku/trunk/headers/private/kernel/file_cache.h haiku/trunk/headers/private/kernel/fs/node_monitor.h haiku/trunk/headers/private/kernel/vfs.h haiku/trunk/headers/private/userlandfs/private/Requests.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Index.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/bfs_control.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/dos/dir.c haiku/trunk/src/add-ons/kernel/file_systems/dos/dir.h haiku/trunk/src/add-ons/kernel/file_systems/dos/dlist.c haiku/trunk/src/add-ons/kernel/file_systems/dos/dlist.h haiku/trunk/src/add-ons/kernel/file_systems/dos/dosfs.c haiku/trunk/src/add-ons/kernel/file_systems/dos/dosfs.h haiku/trunk/src/add-ons/kernel/file_systems/dos/file.c haiku/trunk/src/add-ons/kernel/file_systems/dos/file.h haiku/trunk/src/add-ons/kernel/file_systems/dos/vcache.c haiku/trunk/src/add-ons/kernel/file_systems/dos/vcache.h haiku/trunk/src/add-ons/kernel/file_systems/googlefs/fsproto.h haiku/trunk/src/add-ons/kernel/file_systems/googlefs/googlefs.c haiku/trunk/src/add-ons/kernel/file_systems/googlefs/googlefs.h haiku/trunk/src/add-ons/kernel/file_systems/googlefs/vnidpool.c haiku/trunk/src/add-ons/kernel/file_systems/googlefs/vnidpool.h haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso.c haiku/trunk/src/add-ons/kernel/file_systems/iso9660/iso.h haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/nfs/fsproto.h haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.h haiku/trunk/src/add-ons/kernel/file_systems/ntfs/fs_func.c haiku/trunk/src/add-ons/kernel/file_systems/ntfs/fs_func.h haiku/trunk/src/add-ons/kernel/file_systems/ntfs/fsproto.h haiku/trunk/src/add-ons/kernel/file_systems/ntfs/ntfs.h haiku/trunk/src/add-ons/kernel/file_systems/ramfs/Node.h haiku/trunk/src/add-ons/kernel/file_systems/ramfs/NodeChildTable.h haiku/trunk/src/add-ons/kernel/file_systems/ramfs/NodeTable.cpp haiku/trunk/src/add-ons/kernel/file_systems/ramfs/NodeTable.h haiku/trunk/src/add-ons/kernel/file_systems/ramfs/Volume.cpp haiku/trunk/src/add-ons/kernel/file_systems/ramfs/Volume.h haiku/trunk/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/VNode.cpp haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/VNode.h haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/Volume.cpp haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/Volume.h haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/udf/DirectoryIterator.cpp haiku/trunk/src/add-ons/kernel/file_systems/udf/DirectoryIterator.h haiku/trunk/src/add-ons/kernel/file_systems/udf/Icb.cpp haiku/trunk/src/add-ons/kernel/file_systems/udf/Icb.h haiku/trunk/src/add-ons/kernel/file_systems/udf/Utils.cpp haiku/trunk/src/add-ons/kernel/file_systems/udf/Utils.h haiku/trunk/src/add-ons/kernel/file_systems/udf/fsproto.h haiku/trunk/src/add-ons/kernel/file_systems/udf/udf.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystem.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystem.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelFileSystem.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelFileSystem.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FileSystem.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelFileSystem.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelFileSystem.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandRequestHandler.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_interface.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_kernel_emu.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_file_cache.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_fs_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_kernel_emu.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.h haiku/trunk/src/system/kernel/cache/file_cache.cpp haiku/trunk/src/system/kernel/fs/devfs.cpp haiku/trunk/src/system/kernel/fs/node_monitor.cpp haiku/trunk/src/system/kernel/fs/pipefs.cpp haiku/trunk/src/system/kernel/fs/rootfs.c haiku/trunk/src/system/kernel/fs/vfs.cpp haiku/trunk/src/system/kernel/main.c Log: Got rid of vnode_id and mount_id, replaced with ino_t and dev_t. Modified: haiku/trunk/headers/private/kernel/file_cache.h =================================================================== --- haiku/trunk/headers/private/kernel/file_cache.h 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/headers/private/kernel/file_cache.h 2007-06-21 19:50:57 UTC (rev 21485) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2005, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2004-2007, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ #ifndef _KERNEL_FILE_CACHE_H @@ -26,9 +26,9 @@ struct cache_module_info { module_info info; - void (*node_opened)(void *vnode, int32 fdType, mount_id mountID, vnode_id parentID, - vnode_id vnodeID, const char *name, off_t size); - void (*node_closed)(void *vnode, int32 fdType, mount_id mountID, vnode_id vnodeID, + void (*node_opened)(void *vnode, int32 fdType, dev_t mountID, ino_t parentID, + ino_t vnodeID, const char *name, off_t size); + void (*node_closed)(void *vnode, int32 fdType, dev_t mountID, ino_t vnodeID, int32 accessType); void (*node_launched)(size_t argCount, char * const *args); }; @@ -38,12 +38,12 @@ #endif extern void cache_node_opened(void *vnode, int32 fdType, vm_cache_ref *cache, - mount_id mountID, vnode_id parentID, vnode_id vnodeID, const char *name); + dev_t mountID, ino_t parentID, ino_t vnodeID, const char *name); extern void cache_node_closed(void *vnode, int32 fdType, vm_cache_ref *cache, - mount_id mountID, vnode_id vnodeID); + dev_t mountID, ino_t vnodeID); extern void cache_node_launched(size_t argCount, char * const *args); extern void cache_prefetch_vnode(void *vnode, off_t offset, size_t size); -extern void cache_prefetch(mount_id mountID, vnode_id vnodeID, off_t offset, size_t size); +extern void cache_prefetch(dev_t mountID, ino_t vnodeID, off_t offset, size_t size); extern status_t file_cache_init_post_boot_device(void); extern status_t file_cache_init(void); Modified: haiku/trunk/headers/private/kernel/fs/node_monitor.h =================================================================== --- haiku/trunk/headers/private/kernel/fs/node_monitor.h 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/headers/private/kernel/fs/node_monitor.h 2007-06-21 19:50:57 UTC (rev 21485) @@ -1,5 +1,5 @@ /* - * Copyright 2003-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2003-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _KERNEL_NODE_MONITOR_H @@ -18,9 +18,9 @@ // private kernel API extern status_t remove_node_monitors(struct io_context *context); extern status_t node_monitor_init(void); -extern status_t notify_unmount(mount_id device); -extern status_t notify_mount(mount_id device, mount_id parentDevice, - vnode_id parentDirectory); +extern status_t notify_unmount(dev_t device); +extern status_t notify_mount(dev_t device, dev_t parentDevice, + ino_t parentDirectory); // user-space exported calls extern status_t _user_stop_notifying(port_id port, uint32 token); Modified: haiku/trunk/headers/private/kernel/vfs.h =================================================================== --- haiku/trunk/headers/private/kernel/vfs.h 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/headers/private/kernel/vfs.h 2007-06-21 19:50:57 UTC (rev 21485) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2002-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -21,10 +21,9 @@ #include -/* R5 figures, but we don't use a table for monitors anyway */ -#define DEFAULT_FD_TABLE_SIZE 128 +#define DEFAULT_FD_TABLE_SIZE 256 #define MAX_FD_TABLE_SIZE 8192 -#define DEFAULT_NODE_MONITORS 4096 +#define DEFAULT_NODE_MONITORS 4096 #define MAX_NODE_MONITORS 65536 struct kernel_args; @@ -78,12 +77,12 @@ /* calls needed by the VM for paging and by the file cache */ int vfs_get_vnode_from_fd(int fd, bool kernel, void **vnode); status_t vfs_get_vnode_from_path(const char *path, bool kernel, void **vnode); -status_t vfs_get_vnode(mount_id mountID, vnode_id vnodeID, void **_vnode); -status_t vfs_entry_ref_to_vnode(mount_id mountID, vnode_id directoryID, +status_t vfs_get_vnode(dev_t mountID, ino_t vnodeID, void **_vnode); +status_t vfs_entry_ref_to_vnode(dev_t mountID, ino_t directoryID, const char *name, void **_vnode); -void vfs_vnode_to_node_ref(void *_vnode, mount_id *_mountID, vnode_id *_vnodeID); +void vfs_vnode_to_node_ref(void *_vnode, dev_t *_mountID, ino_t *_vnodeID); -status_t vfs_lookup_vnode(mount_id mountID, vnode_id vnodeID, void **_vnode); +status_t vfs_lookup_vnode(dev_t mountID, ino_t vnodeID, void **_vnode); void vfs_put_vnode(void *vnode); void vfs_acquire_vnode(void *vnode); status_t vfs_get_cookie_from_fd(int fd, void **_cookie); @@ -95,13 +94,13 @@ status_t vfs_get_vnode_cache(void *vnode, struct vm_cache_ref **_cache, bool allocate); status_t vfs_get_file_map( void *_vnode, off_t offset, size_t size, struct file_io_vec *vecs, size_t *_count); -status_t vfs_get_fs_node_from_path(mount_id mountID, const char *path, +status_t vfs_get_fs_node_from_path(dev_t mountID, const char *path, bool kernel, void **_node); status_t vfs_stat_vnode(void *_vnode, struct stat *stat); status_t vfs_get_vnode_name(void *vnode, char *name, size_t nameSize); -status_t vfs_get_cwd(mount_id *_mountID, vnode_id *_vnodeID); +status_t vfs_get_cwd(dev_t *_mountID, ino_t *_vnodeID); void vfs_unlock_vnode_if_locked(struct file_descriptor *descriptor); -status_t vfs_disconnect_vnode(mount_id mountID, vnode_id vnodeID); +status_t vfs_disconnect_vnode(dev_t mountID, ino_t vnodeID); void vfs_free_unused_vnodes(int32 level); /* special module convenience call */ @@ -113,8 +112,8 @@ bool kernel); /* service call for the node monitor */ -status_t resolve_mount_point_to_volume_root(mount_id mountID, vnode_id nodeID, - mount_id *resolvedMountID, vnode_id *resolvedNodeID); +status_t resolve_mount_point_to_volume_root(dev_t mountID, ino_t nodeID, + dev_t *resolvedMountID, ino_t *resolvedNodeID); /* calls the syscall dispatcher should use for user file I/O */ dev_t _user_mount(const char *path, const char *device, const char *fs_name, Modified: haiku/trunk/headers/private/userlandfs/private/Requests.h =================================================================== --- haiku/trunk/headers/private/userlandfs/private/Requests.h 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/headers/private/userlandfs/private/Requests.h 2007-06-21 19:50:57 UTC (rev 21485) @@ -326,7 +326,7 @@ MountVolumeRequest() : Request(MOUNT_VOLUME_REQUEST) {} status_t GetAddressInfos(AddressInfo* infos, int32* count); - mount_id nsid; + dev_t nsid; Address cwd; // current working dir of the mount() caller Address device; uint32 flags; @@ -338,7 +338,7 @@ public: MountVolumeReply() : ReplyRequest(MOUNT_VOLUME_REPLY) {} - vnode_id rootID; + ino_t rootID; fs_volume volume; }; @@ -430,7 +430,7 @@ public: LookupReply() : ReplyRequest(LOOKUP_REPLY) {} - vnode_id vnid; + ino_t vnid; int type; }; @@ -456,7 +456,7 @@ public: ReadVNodeRequest() : VolumeRequest(READ_VNODE_REQUEST) {} - vnode_id vnid; + ino_t vnid; bool reenter; }; @@ -731,7 +731,7 @@ public: CreateReply() : ReplyRequest(CREATE_REPLY) {} - vnode_id vnid; + ino_t vnid; fs_cookie fileCookie; }; @@ -831,7 +831,7 @@ public: CreateDirReply() : ReplyRequest(CREATE_DIR_REPLY) {} - vnode_id newDir; + ino_t newDir; }; // RemoveDirRequest @@ -1374,10 +1374,10 @@ int32 operation; uint32 details; // for B_STAT_CHANGED:statFields // and B_ATTRIBUTE_CHANGED:cause - mount_id device; - vnode_id oldDirectory; - vnode_id directory; - vnode_id node; + dev_t device; + ino_t oldDirectory; + ino_t directory; + ino_t node; Address oldName; Address name; }; @@ -1414,9 +1414,9 @@ port_id port; int32 token; int32 operation; // B_ENTRY_{CREATED,REMOVED} - mount_id device; - vnode_id directory; - vnode_id node; + dev_t device; + ino_t directory; + ino_t node; Address name; }; @@ -1435,8 +1435,8 @@ public: GetVNodeRequest() : Request(GET_VNODE_REQUEST) {} - mount_id nsid; - vnode_id vnid; + dev_t nsid; + ino_t vnid; }; // GetVNodeReply @@ -1452,8 +1452,8 @@ public: PutVNodeRequest() : Request(PUT_VNODE_REQUEST) {} - mount_id nsid; - vnode_id vnid; + dev_t nsid; + ino_t vnid; }; // PutVNodeReply @@ -1467,8 +1467,8 @@ public: NewVNodeRequest() : Request(NEW_VNODE_REQUEST) {} - mount_id nsid; - vnode_id vnid; + dev_t nsid; + ino_t vnid; fs_vnode node; }; @@ -1483,8 +1483,8 @@ public: PublishVNodeRequest() : Request(PUBLISH_VNODE_REQUEST) {} - mount_id nsid; - vnode_id vnid; + dev_t nsid; + ino_t vnid; fs_vnode node; }; @@ -1499,8 +1499,8 @@ public: RemoveVNodeRequest() : Request(REMOVE_VNODE_REQUEST) {} - mount_id nsid; - vnode_id vnid; + dev_t nsid; + ino_t vnid; }; // RemoveVNodeReply @@ -1514,8 +1514,8 @@ public: UnremoveVNodeRequest() : Request(UNREMOVE_VNODE_REQUEST) {} - mount_id nsid; - vnode_id vnid; + dev_t nsid; + ino_t vnid; }; // UnremoveVNodeReply @@ -1529,8 +1529,8 @@ public: GetVNodeRemovedRequest() : Request(GET_VNODE_REMOVED_REQUEST) {} - mount_id nsid; - vnode_id vnid; + dev_t nsid; + ino_t vnid; }; // GetVNodeRemovedReply Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2007-06-21 19:50:57 UTC (rev 21485) @@ -977,7 +977,7 @@ char name[B_FILE_NAME_LENGTH]; uint16 length; - vnode_id id; + ino_t id; status_t status = cookie->iterator->GetNextEntry(name, &length, B_FILE_NAME_LENGTH, &id); if (status == B_ENTRY_NOT_FOUND) { Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Index.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Index.cpp 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Index.cpp 2007-06-21 19:50:57 UTC (rev 21485) @@ -79,7 +79,7 @@ if (indices->GetTree(&tree) != B_OK) return B_BAD_VALUE; - vnode_id id; + ino_t id; status_t status = tree->Find((uint8 *)name, (uint16)strlen(name), &id); if (status != B_OK) return status; Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2007-06-21 19:50:57 UTC (rev 21485) @@ -165,7 +165,7 @@ // #pragma mark - Inode -Inode::Inode(Volume *volume, vnode_id id) +Inode::Inode(Volume *volume, ino_t id) : fVolume(volume), fID(id), @@ -194,7 +194,8 @@ } -Inode::Inode(Volume *volume, Transaction &transaction, vnode_id id, mode_t mode, block_run &run) +Inode::Inode(Volume *volume, Transaction &transaction, ino_t id, mode_t mode, + block_run &run) : fVolume(volume), fID(id), @@ -1002,7 +1003,7 @@ BPlusTree *tree; status_t status = attributes->GetTree(&tree); if (status == B_OK) { - vnode_id id; + ino_t id; status = tree->Find((uint8 *)name, (uint16)strlen(name), &id); if (status == B_OK) { Vnode vnode(fVolume, id); @@ -1090,7 +1091,7 @@ uint32 count = 0; char name[BPLUSTREE_MAX_KEY_LENGTH]; uint16 length; - vnode_id id; + ino_t id; while (iterator.GetNextEntry(name, &length, B_FILE_NAME_LENGTH, &id) == B_OK) { if (Mode() & (S_ATTR_DIR | S_INDEX_DIR)) @@ -2011,7 +2012,7 @@ char name[B_FILE_NAME_LENGTH]; uint32 type; size_t length; - vnode_id id; + ino_t id; while ((status = iterator.GetNext(name, &length, &type, &id)) == B_OK) { RemoveAttribute(transaction, name); } @@ -2123,7 +2124,7 @@ status_t -Inode::Remove(Transaction &transaction, const char *name, vnode_id *_id, +Inode::Remove(Transaction &transaction, const char *name, ino_t *_id, bool isDirectory) { BPlusTree *tree; @@ -2220,7 +2221,7 @@ */ status_t Inode::Create(Transaction &transaction, Inode *parent, const char *name, - int32 mode, int openMode, uint32 type, bool *_created, vnode_id *_id, + int32 mode, int openMode, uint32 type, bool *_created, ino_t *_id, Inode **_inode) { FUNCTION_START(("name = %s, mode = %ld\n", name, mode)); @@ -2456,7 +2457,7 @@ status_t AttributeIterator::GetNext(char *name, size_t *_length, uint32 *_type, - vnode_id *_id) + ino_t *_id) { // read attributes out of the small data section @@ -2484,7 +2485,7 @@ strncpy(name, item->Name(), B_FILE_NAME_LENGTH); *_type = item->Type(); *_length = item->NameSize(); - *_id = (vnode_id)fCurrentSmallData; + *_id = (ino_t)fCurrentSmallData; fCurrentSmallData = i; } @@ -2510,7 +2511,7 @@ if (fAttributes == NULL) { if (get_vnode(volume->ID(), volume->ToVnode(fInode->Attributes()), (void **)&fAttributes) != B_OK) { - FATAL(("get_vnode() failed in AttributeIterator::GetNext(vnode_id" + FATAL(("get_vnode() failed in AttributeIterator::GetNext(ino_t" " = %Ld,name = \"%s\")\n",fInode->ID(),name)); return B_ENTRY_NOT_FOUND; } @@ -2518,14 +2519,14 @@ BPlusTree *tree; if (fAttributes->GetTree(&tree) < B_OK || (fIterator = new TreeIterator(tree)) == NULL) { - FATAL(("could not get tree in AttributeIterator::GetNext(vnode_id" + FATAL(("could not get tree in AttributeIterator::GetNext(ino_t" " = %Ld,name = \"%s\")\n",fInode->ID(),name)); return B_ENTRY_NOT_FOUND; } } uint16 length; - vnode_id id; + ino_t id; status_t status = fIterator->GetNextEntry(name, &length, B_FILE_NAME_LENGTH, &id); if (status < B_OK) Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.h 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.h 2007-06-21 19:50:57 UTC (rev 21485) @@ -35,14 +35,14 @@ class Inode { public: - Inode(Volume *volume, vnode_id id); - Inode(Volume *volume, Transaction &transaction, vnode_id id, + Inode(Volume *volume, ino_t id); + Inode(Volume *volume, Transaction &transaction, ino_t id, mode_t mode, block_run &run); //Inode(CachedBlock *cached); ~Inode(); //bfs_inode *Node() const { return (bfs_inode *)fBlock; } - vnode_id ID() const { return fID; } + ino_t ID() const { return fID; } off_t BlockNumber() const { return fVolume->VnodeToBlock(fID); } ReadWriteLock &Lock() { return fLock; } @@ -138,10 +138,10 @@ // create/remove inodes status_t Remove(Transaction &transaction, const char *name, - vnode_id *_id = NULL, bool isDirectory = false); + ino_t *_id = NULL, bool isDirectory = false); static status_t Create(Transaction &transaction, Inode *parent, const char *name, int32 mode, int openMode, uint32 type, - bool *_created = NULL, vnode_id *_id = NULL, Inode **_inode = NULL); + bool *_created = NULL, ino_t *_id = NULL, Inode **_inode = NULL); // index maintaining helper void UpdateOldSize() @@ -194,7 +194,7 @@ private: ReadWriteLock fLock; Volume *fVolume; - vnode_id fID; + ino_t fID; BPlusTree *fTree; Inode *fAttributes; void *fCache; @@ -251,7 +251,7 @@ class Vnode { public: - Vnode(Volume *volume, vnode_id id) + Vnode(Volume *volume, ino_t id) : fVolume(volume), fID(id) @@ -290,7 +290,7 @@ private: Volume *fVolume; - vnode_id fID; + ino_t fID; }; @@ -300,7 +300,7 @@ ~AttributeIterator(); status_t Rewind(); - status_t GetNext(char *name, size_t *length, uint32 *type, vnode_id *id); + status_t GetNext(char *name, size_t *length, uint32 *type, ino_t *id); private: friend class Chain; Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2007-06-21 19:50:57 UTC (rev 21485) @@ -242,7 +242,7 @@ // #pragma mark - -Volume::Volume(mount_id id) +Volume::Volume(dev_t id) : fID(id), fBlockAllocator(this), Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h 2007-06-21 19:50:57 UTC (rev 21485) @@ -1,6 +1,5 @@ -/* Volume - BFS super block, mounting, etc. - * - * Copyright 2001-2004, Axel D?rfler, axeld at pinc-software.de. +/* + * Copyright 2001-2007, Axel D?rfler, axeld at pinc-software.de. * This file may be used under the terms of the MIT License. */ #ifndef VOLUME_H @@ -27,7 +26,7 @@ class Volume { public: - Volume(mount_id id); + Volume(dev_t id); ~Volume(); status_t Mount(const char *device, uint32 flags); @@ -49,7 +48,7 @@ vint32 &LogEnd() { return fLogEnd; } int Device() const { return fDevice; } - mount_id ID() const { return fID; } + dev_t ID() const { return fID; } const char *Name() const { return fSuperBlock.name; } off_t NumBlocks() const { return fSuperBlock.NumBlocks(); } @@ -70,7 +69,7 @@ off_t ToVnode(block_run run) const { return ToBlock(run); } off_t ToVnode(off_t block) const { return block; } - off_t VnodeToBlock(vnode_id id) const { return (off_t)id; } + off_t VnodeToBlock(ino_t id) const { return (off_t)id; } status_t CreateIndicesRoot(Transaction &transaction); @@ -106,7 +105,7 @@ static status_t Identify(int fd, disk_super_block *superBlock); protected: - mount_id fID; + dev_t fID; int fDevice; disk_super_block fSuperBlock; Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/bfs_control.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/bfs_control.h 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/bfs_control.h 2007-06-21 19:50:57 UTC (rev 21485) @@ -1,12 +1,13 @@ +/* + * Copyright 2001-2007, Axel D?rfler, axeld at pinc-software.de + * This file may be used under the terms of the MIT License. + */ #ifndef BFS_CONTROL_H #define BFS_CONTROL_H -/* bfs_control - additional functionality exported via ioctl() -** -** Copyright 2001-2004, Axel D?rfler, axeld at pinc-software.de -** This file may be used under the terms of the OpenBeOS License. -*/ +//! additional functionality exported via ioctl() + #include "system_dependencies.h" @@ -29,7 +30,7 @@ uint32 magic; uint32 flags; char name[B_FILE_NAME_LENGTH]; - vnode_id inode; + ino_t inode; uint32 mode; uint32 errors; struct { Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2007-06-21 19:50:57 UTC (rev 21485) @@ -104,8 +104,8 @@ static status_t -bfs_mount(mount_id mountID, const char *device, uint32 flags, const char *args, - void **_data, vnode_id *_rootID) +bfs_mount(dev_t mountID, const char *device, uint32 flags, const char *args, + void **_data, ino_t *_rootID) { FUNCTION(); @@ -229,9 +229,9 @@ */ static status_t -bfs_read_vnode(void *_ns, vnode_id id, void **_node, bool reenter) +bfs_read_vnode(void *_ns, ino_t id, void **_node, bool reenter) { - //FUNCTION_START(("vnode_id = %Ld\n", id)); + //FUNCTION_START(("ino_t = %Ld\n", id)); Volume *volume = (Volume *)_ns; // first inode may be after the log area, we don't go through @@ -444,7 +444,7 @@ static status_t -bfs_lookup(void *_ns, void *_directory, const char *file, vnode_id *_vnodeID, int *_type) +bfs_lookup(void *_ns, void *_directory, const char *file, ino_t *_vnodeID, int *_type) { //FUNCTION_START(("file = %s\n", file)); if (_ns == NULL || _directory == NULL || file == NULL || _vnodeID == NULL) @@ -740,7 +740,7 @@ status_t bfs_create(void *_ns, void *_directory, const char *name, int openMode, int mode, - void **_cookie, vnode_id *_vnodeID) + void **_cookie, ino_t *_vnodeID) { FUNCTION_START(("name = \"%s\", perms = %d, openMode = %d\n", name, mode, openMode)); @@ -942,8 +942,8 @@ // If we meet our inode on that way, we have to bail out. if (oldDirectory != newDirectory) { - vnode_id parent = volume->ToVnode(newDirectory->Parent()); - vnode_id root = volume->RootNode()->ID(); + ino_t parent = volume->ToVnode(newDirectory->Parent()); + ino_t root = volume->RootNode()->ID(); while (true) { if (parent == id) @@ -1357,7 +1357,7 @@ static status_t bfs_create_dir(void *_ns, void *_directory, const char *name, int mode, - vnode_id *_newVnodeID) + ino_t *_newVnodeID) { FUNCTION_START(("name = \"%s\", perms = %d\n", name, mode)); @@ -1466,7 +1466,7 @@ RETURN_ERROR(B_BAD_VALUE); uint16 length; - vnode_id id; + ino_t id; status_t status = iterator->GetNextEntry(dirent->d_name, &length, bufferSize, &id); if (status == B_ENTRY_NOT_FOUND) { *_num = 0; Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2007-06-21 19:50:57 UTC (rev 21485) @@ -76,24 +76,24 @@ class Volume { public: - Volume(mount_id id); + Volume(dev_t id); ~Volume(); status_t InitCheck(); - mount_id ID() const { return fID; } + dev_t ID() const { return fID; } uint32 DiscID() const { return fDiscID; } Inode &RootNode() const { return *fRootNode; } status_t Mount(const char* device); int Device() const { return fDevice; } - vnode_id GetNextNodeID() { return fNextID++; } + ino_t GetNextNodeID() { return fNextID++; } const char *Name() const { return fName; } status_t SetName(const char *name); Semaphore &Lock(); - Inode *Find(vnode_id id); + Inode *Find(ino_t id); Inode *Find(const char *name); Inode *FirstEntry() const { return fFirstEntry; } @@ -116,10 +116,10 @@ Semaphore fLock; int fDevice; - mount_id fID; + dev_t fID; uint32 fDiscID; Inode *fRootNode; - vnode_id fNextID; + ino_t fNextID; char *fName; off_t fNumBlocks; @@ -160,7 +160,7 @@ ~Inode(); status_t InitCheck(); - vnode_id ID() const { return fID; } + ino_t ID() const { return fID; } const char *Name() const { return fName; } status_t SetName(const char* name); @@ -206,7 +206,7 @@ private: Inode *fNext; - vnode_id fID; + ino_t fID; int32 fType; char *fName; gid_t fGroupID; @@ -447,7 +447,7 @@ // #pragma mark - Volume class -Volume::Volume(mount_id id) +Volume::Volume(dev_t id) : fLock("cdda"), fDevice(-1), @@ -655,7 +655,7 @@ Inode * -Volume::Find(vnode_id id) +Volume::Find(ino_t id) { for (Inode *inode = fFirstEntry; inode != NULL; inode = inode->Next()) { if (inode->ID() == id) @@ -1268,8 +1268,8 @@ static status_t -cdda_mount(mount_id id, const char *device, uint32 flags, const char *args, - fs_volume *_volume, vnode_id *_rootVnodeID) +cdda_mount(dev_t id, const char *device, uint32 flags, const char *args, + fs_volume *_volume, ino_t *_rootVnodeID) { TRACE(("cdda_mount: entry\n")); @@ -1355,7 +1355,7 @@ static status_t -cdda_lookup(fs_volume _volume, fs_vnode _dir, const char *name, vnode_id *_id, int *_type) +cdda_lookup(fs_volume _volume, fs_vnode _dir, const char *name, ino_t *_id, int *_type) { Volume *volume = (Volume *)_volume; status_t status; @@ -1398,7 +1398,7 @@ static status_t -cdda_get_vnode(fs_volume _volume, vnode_id id, fs_vnode *_inode, bool reenter) +cdda_get_vnode(fs_volume _volume, ino_t id, fs_vnode *_inode, bool reenter) { Volume *volume = (Volume *)_volume; Inode *inode; Modified: haiku/trunk/src/add-ons/kernel/file_systems/dos/dir.c =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/dos/dir.c 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/src/add-ons/kernel/file_systems/dos/dir.c 2007-06-21 19:50:57 UTC (rev 21485) @@ -39,7 +39,7 @@ static CHECK_MAGIC(dircookie,struct dircookie, DIRCOOKIE_MAGIC) static status_t findfile(nspace *vol, vnode *dir, const char *file, - vnode_id *vnid, vnode **node, bool check_case, + ino_t *vnid, vnode **node, bool check_case, bool check_dups, bool *dups_exist); // private structure for returning data from _next_dirent_() @@ -205,7 +205,7 @@ static status_t -get_next_dirent(nspace *vol, vnode *dir, struct diri *iter, vnode_id *vnid, +get_next_dirent(nspace *vol, vnode *dir, struct diri *iter, ino_t *vnid, char *filename, int len) { struct _dirent_info_ info; @@ -229,7 +229,7 @@ if (vnid) *vnid = dir->dir_vnid; } else { if (vnid) { - vnode_id loc = (IS_DATA_CLUSTER(info.cluster)) + ino_t loc = (IS_DATA_CLUSTER(info.cluster)) ? GENERATE_DIR_CLUSTER_VNID(dir->vnid, info.cluster) : GENERATE_DIR_INDEX_VNID(dir->vnid, info.sindex); bool added_to_vcache = false; @@ -320,7 +320,7 @@ status_t -findfile_case(nspace *vol, vnode *dir, const char *file, vnode_id *vnid, +findfile_case(nspace *vol, vnode *dir, const char *file, ino_t *vnid, vnode **node) { return findfile(vol, dir, file, vnid, node, true, false, NULL); @@ -328,7 +328,7 @@ status_t -findfile_nocase(nspace *vol, vnode *dir, const char *file, vnode_id *vnid, +findfile_nocase(nspace *vol, vnode *dir, const char *file, ino_t *vnid, vnode **node) { return findfile(vol, dir, file, vnid, node, false, false, NULL); @@ -337,7 +337,7 @@ status_t findfile_nocase_duplicates(nspace *vol, vnode *dir, const char *file, - vnode_id *vnid, vnode **node, bool *dups_exist) + ino_t *vnid, vnode **node, bool *dups_exist) { return findfile(vol, dir, file, vnid, node, false, true, dups_exist); } @@ -345,14 +345,14 @@ status_t findfile_case_duplicates(nspace *vol, vnode *dir, const char *file, - vnode_id *vnid, vnode **node, bool *dups_exist) + ino_t *vnid, vnode **node, bool *dups_exist) { return findfile(vol, dir, file, vnid, node, true, true, dups_exist); } static status_t -findfile(nspace *vol, vnode *dir, const char *file, vnode_id *vnid, +findfile(nspace *vol, vnode *dir, const char *file, ino_t *vnid, vnode **node, bool check_case, bool check_dups, bool *dups_exist) { /* Starting at the base, find the file in the subdir @@ -366,7 +366,7 @@ any other case-insensitive matches. If there are, the dups_exist flag is set to true. */ int result = 0; - vnode_id found_vnid = 0; + ino_t found_vnid = 0; bool found_file = false; // dprintf("findfile: %s in %Lx, case %d dups %d\n", file, dir->vnid, check_case, check_dups); @@ -400,7 +400,7 @@ while (1) { char filename[512]; - vnode_id _vnid; + ino_t _vnid; result = get_next_dirent(vol, dir, &diri, &_vnid, filename, 512); if (result != B_NO_ERROR) @@ -922,11 +922,11 @@ status_t -dosfs_read_vnode(void *_vol, vnode_id vnid, void **_node, bool reenter) +dosfs_read_vnode(void *_vol, ino_t vnid, void **_node, bool reenter) { nspace *vol = (nspace*)_vol; int result = B_NO_ERROR; - vnode_id loc, dir_vnid; + ino_t loc, dir_vnid; vnode *entry; struct _dirent_info_ info; struct diri iter; @@ -1027,11 +1027,11 @@ entry->st_size = count_clusters(vol,entry->cluster) * vol->sectors_per_cluster * vol->bytes_per_sector; } - if (entry->cluster) + if (entry->cluster) { entry->end_cluster = get_nth_fat_entry(vol, info.cluster, - (entry->st_size + vol->bytes_per_sector * vol->sectors_per_cluster - 1) / - vol->bytes_per_sector / vol->sectors_per_cluster - 1); - else + (entry->st_size + vol->bytes_per_sector * vol->sectors_per_cluster - 1) / + vol->bytes_per_sector / vol->sectors_per_cluster - 1); + } else entry->end_cluster = 0; entry->st_time = dos2time_t(info.time); #if TRACK_FILENAME @@ -1044,17 +1044,21 @@ *_node = entry; -bi2:diri_free(&iter); -bi: if (!reenter) UNLOCK_VOL(vol); +bi2: + diri_free(&iter); +bi: + if (!reenter) + UNLOCK_VOL(vol); - if (result != B_OK) DPRINTF(0, ("dosfs_read_vnode (%s)\n", strerror(result))); + if (result != B_OK) + DPRINTF(0, ("dosfs_read_vnode (%s)\n", strerror(result))); return result; } status_t -dosfs_walk(void *_vol, void *_dir, const char *file, vnode_id *_vnid, int *_type) +dosfs_walk(void *_vol, void *_dir, const char *file, ino_t *_vnid, int *_type) { /* Starting at the base, find file in the subdir, and return path string and vnode id of file. */ Modified: haiku/trunk/src/add-ons/kernel/file_systems/dos/dir.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/dos/dir.h 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/src/add-ons/kernel/file_systems/dos/dir.h 2007-06-21 19:50:57 UTC (rev 21485) @@ -8,29 +8,29 @@ bool is_filename_legal(const char *name); status_t check_dir_empty(nspace *vol, vnode *dir); status_t findfile_case(nspace *vol, vnode *dir, const char *file, - vnode_id *vnid, vnode **node); + ino_t *vnid, vnode **node); status_t findfile_nocase(nspace *vol, vnode *dir, const char *file, - vnode_id *vnid, vnode **node); + ino_t *vnid, vnode **node); status_t findfile_nocase_duplicates(nspace *vol, vnode *dir, const char *file, - vnode_id *vnid, vnode **node, bool *dups_exist); + ino_t *vnid, vnode **node, bool *dups_exist); status_t findfile_case_duplicates(nspace *vol, vnode *dir, const char *file, - vnode_id *vnid, vnode **node, bool *dups_exist); + ino_t *vnid, vnode **node, bool *dups_exist); status_t erase_dir_entry(nspace *vol, vnode *node); status_t compact_directory(nspace *vol, vnode *dir); status_t create_volume_label(nspace *vol, const char name[11], uint32 *index); status_t create_dir_entry(nspace *vol, vnode *dir, vnode *node, const char *name, uint32 *ns, uint32 *ne); -status_t dosfs_read_vnode(void *_vol, vnode_id vnid, void **node, bool reenter); -status_t dosfs_walk(void *_vol, void *_dir, const char *file, - vnode_id *_vnid, int *_type); -status_t dosfs_access(void *_vol, void *_node, int mode); -status_t dosfs_readlink(void *_vol, void *_node, char *buf, size_t *bufsize); -status_t dosfs_opendir(void *_vol, void *_node, void **cookie); -status_t dosfs_readdir(void *_vol, void *_node, void *cookie, +status_t dosfs_read_vnode(void *_vol, ino_t vnid, void **node, bool reenter); +status_t dosfs_walk(void *_vol, void *_dir, const char *file, + ino_t *_vnid, int *_type); +status_t dosfs_access(void *_vol, void *_node, int mode); +status_t dosfs_readlink(void *_vol, void *_node, char *buf, size_t *bufsize); +status_t dosfs_opendir(void *_vol, void *_node, void **cookie); +status_t dosfs_readdir(void *_vol, void *_node, void *cookie, struct dirent *buf, size_t bufsize, uint32 *num); -status_t dosfs_rewinddir(void *_vol, void *_node, void *cookie); -status_t dosfs_closedir(void *_vol, void *_node, void *cookie); -status_t dosfs_free_dircookie(void *_vol, void *_node, void *cookie); +status_t dosfs_rewinddir(void *_vol, void *_node, void *cookie); +status_t dosfs_closedir(void *_vol, void *_node, void *cookie); +status_t dosfs_free_dircookie(void *_vol, void *_node, void *cookie); #endif Modified: haiku/trunk/src/add-ons/kernel/file_systems/dos/dlist.c =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/dos/dlist.c 2007-06-21 18:40:33 UTC (rev 21484) +++ haiku/trunk/src/add-ons/kernel/file_systems/dos/dlist.c 2007-06-21 19:50:57 UTC (rev 21485) [... truncated: 5196 lines follow ...] From jackburton at mail.berlios.de Thu Jun 21 22:25:08 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 21 Jun 2007 22:25:08 +0200 Subject: [Haiku-commits] r21486 - haiku/trunk/src/kits/game Message-ID: <200706212025.l5LKP8PN022402@sheep.berlios.de> Author: jackburton Date: 2007-06-21 22:25:08 +0200 (Thu, 21 Jun 2007) New Revision: 21486 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21486&view=rev Modified: haiku/trunk/src/kits/game/WindowScreen.cpp Log: Fixed problems with try/catch, hopefully. Thanks Axel for pointing them out. Modified: haiku/trunk/src/kits/game/WindowScreen.cpp =================================================================== --- haiku/trunk/src/kits/game/WindowScreen.cpp 2007-06-21 19:50:57 UTC (rev 21485) +++ haiku/trunk/src/kits/game/WindowScreen.cpp 2007-06-21 20:25:08 UTC (rev 21486) @@ -610,11 +610,11 @@ fActivateSem = create_sem(0, "WindowScreen start lock"); if (fActivateSem < B_OK) - throw fActivateSem; + throw (status_t)fActivateSem; fDebugSem = create_sem(1, "WindowScreen debug sem"); if (fDebugSem < B_OK) - throw fDebugSem; + throw (status_t)fDebugSem; memcpy(fPalette, screen.ColorMap()->color_list, sizeof(fPalette)); fActivateState = 0; @@ -624,7 +624,7 @@ } catch (std::bad_alloc) { status = B_NO_MEMORY; - } catch (int error) { + } catch (status_t error) { status = error; } catch (...) { status = B_ERROR; From jackburton at mail.berlios.de Thu Jun 21 22:47:20 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 21 Jun 2007 22:47:20 +0200 Subject: [Haiku-commits] r21487 - haiku/trunk/src/kits/interface Message-ID: <200706212047.l5LKlKRQ023769@sheep.berlios.de> Author: jackburton Date: 2007-06-21 22:47:19 +0200 (Thu, 21 Jun 2007) New Revision: 21487 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21487&view=rev Modified: haiku/trunk/src/kits/interface/MenuField.cpp Log: I *think* I've fixed the problem of menu fields not being opened when the user clicks on the part which has been resized... Modified: haiku/trunk/src/kits/interface/MenuField.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuField.cpp 2007-06-21 20:25:08 UTC (rev 21486) +++ haiku/trunk/src/kits/interface/MenuField.cpp 2007-06-21 20:47:19 UTC (rev 21487) @@ -301,7 +301,7 @@ BRect bounds = fMenuBar->ConvertFromParent(Bounds()); - fMenuBar->StartMenuBar(-1, false, true, &bounds); + fMenuBar->StartMenuBar(0, false, true, &bounds); fMenuTaskID = spawn_thread((thread_func)MenuTask, "_m_task_", B_NORMAL_PRIORITY, this); if (fMenuTaskID) From axeld at pinc-software.de Thu Jun 21 23:23:42 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 21 Jun 2007 23:23:42 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r21482_-_in_haiku/trunk=3A_header?= =?iso-8859-15?q?s/private/kernel_src/system/kernel/vm?= In-Reply-To: <002701c7b42d$fffb3650$8c030b0a@secretlevel.com> Message-ID: <24302455211-BeMail@zon> "Travis Geiselbrecht" wrote: > Ah good, glad you caught this. I dove pretty deeply into bugs in this > area > the other day, and it was obvious that something was amiss but I > couldn't > quite track it down. There is still some stuff left to track down, feel yourself warmly invited ;-) Anyway, Ingo and I have talked about the VM a bit, and planned to get rid of the vm_cache_ref/vm_cache differentiation (finally) and rework the locking model a bit. The ref stuff actually doesn't give you a lot, but makes the whole VM a lot more complicated than needed. > This does remind me, how attached are you to the current page mapping > -> > area stuff you added a while back? I haven't completely worked out a > better > alternate solution, but it seems a little heavy handed for what I was > thinking. I'll run it by you, but I think that should be maintained > at a > lower level than that, perhaps in the vm_translation_map itself as a > side > effect of doing the mmu mapping, and it should be a little more > friendly to > being able to be walked from the low level, for a global page walker, > which > at this point I think was a misdesign of the newos vm (having it do a > local > page scan). The global page scanner was the whole point of the introduction of the mapping code; I just haven't written it yet (but started locally some time ago) :-) > I dont have the code in front of me, I'm at work, but I didn't really > like > the looks of it, though I can't quite put my finger on it yet. I'm definitely open for suggestions once you can :-) Bye, Axel. From superstippi at gmx.de Thu Jun 21 23:36:20 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Thu, 21 Jun 2007 23:36:20 +0200 Subject: [Haiku-commits] r21482 - in haiku/trunk: headers/private/kernel src/system/kernel/vm In-Reply-To: <200706211357.l5LDvkre007357@sheep.berlios.de> References: <200706211357.l5LDvkre007357@sheep.berlios.de> Message-ID: <20070621233620.18066.6@stippis.WG> Hi Axel & Ingo, > Modified: > haiku/trunk/headers/private/kernel/vm_cache.h > haiku/trunk/src/system/kernel/vm/vm.cpp > haiku/trunk/src/system/kernel/vm/vm_cache.c > Log: > Ingo and I fixed a couple of VM bugs in a late night debugging session: [...] Exciting set of fixes! I know you said you were not done yet... but I haven't managed to freeze or panic Haiku after this patch, I launched all included apps at once several times and played around with them... so this is a nice improvement already! Best regards, -Stephan From stippi at mail.berlios.de Fri Jun 22 00:14:44 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 22 Jun 2007 00:14:44 +0200 Subject: [Haiku-commits] r21488 - haiku/trunk/src/apps/icon-o-matic/generic/gui/scrollview Message-ID: <200706212214.l5LMEiZ9030016@sheep.berlios.de> Author: stippi Date: 2007-06-22 00:14:44 +0200 (Fri, 22 Jun 2007) New Revision: 21488 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21488&view=rev Modified: haiku/trunk/src/apps/icon-o-matic/generic/gui/scrollview/ScrollView.cpp haiku/trunk/src/apps/icon-o-matic/generic/gui/scrollview/Scrollable.cpp Log: * fixed ScrollView framework to support data rects with negative left/top coordinate correctly Modified: haiku/trunk/src/apps/icon-o-matic/generic/gui/scrollview/ScrollView.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/generic/gui/scrollview/ScrollView.cpp 2007-06-21 20:47:19 UTC (rev 21487) +++ haiku/trunk/src/apps/icon-o-matic/generic/gui/scrollview/ScrollView.cpp 2007-06-21 22:14:44 UTC (rev 21488) @@ -662,11 +662,11 @@ float hProportion = min(1.0f, (visibleBounds.Width() + 1.0f) / (dataRect.Width() + 1.0f)); float hMaxValue = max(dataRect.left, - dataRect.Width() - visibleBounds.Width()); + dataRect.right - visibleBounds.Width()); float vProportion = min(1.0f, (visibleBounds.Height() + 1.0f) / (dataRect.Height() + 1.0f)); float vMaxValue = max(dataRect.top, - dataRect.Height() - visibleBounds.Height()); + dataRect.bottom - visibleBounds.Height()); // update horizontal scroll bar if (fHScrollBar) { fHScrollBar->SetProportion(hProportion); Modified: haiku/trunk/src/apps/icon-o-matic/generic/gui/scrollview/Scrollable.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/generic/gui/scrollview/Scrollable.cpp 2007-06-21 20:47:19 UTC (rev 21487) +++ haiku/trunk/src/apps/icon-o-matic/generic/gui/scrollview/Scrollable.cpp 2007-06-21 22:14:44 UTC (rev 21488) @@ -211,8 +211,8 @@ BPoint Scrollable::_ValidScrollOffsetFor(BPoint offset) const { - float maxX = max(fDataRect.left, fDataRect.Width() - fVisibleWidth); - float maxY = max(fDataRect.top, fDataRect.Height() - fVisibleHeight); + float maxX = max(fDataRect.left, fDataRect.right - fVisibleWidth); + float maxY = max(fDataRect.top, fDataRect.bottom - fVisibleHeight); // adjust the offset to be valid if (offset.x < fDataRect.left) offset.x = fDataRect.left; From stippi at mail.berlios.de Fri Jun 22 00:19:05 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 22 Jun 2007 00:19:05 +0200 Subject: [Haiku-commits] r21489 - in haiku/trunk/src/apps: . mediaconverter mediaconverter/languages Message-ID: <200706212219.l5LMJ5e5030320@sheep.berlios.de> Author: stippi Date: 2007-06-22 00:19:02 +0200 (Fri, 22 Jun 2007) New Revision: 21489 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21489&view=rev Added: haiku/trunk/src/apps/mediaconverter/ haiku/trunk/src/apps/mediaconverter/Jamfile haiku/trunk/src/apps/mediaconverter/LICENSE haiku/trunk/src/apps/mediaconverter/MediaConverter.rdef haiku/trunk/src/apps/mediaconverter/MediaConverterApp.cpp haiku/trunk/src/apps/mediaconverter/MediaConverterApp.h haiku/trunk/src/apps/mediaconverter/MediaConverterWindow.cpp haiku/trunk/src/apps/mediaconverter/MediaConverterWindow.h haiku/trunk/src/apps/mediaconverter/MediaEncoderWindow.cpp haiku/trunk/src/apps/mediaconverter/MediaEncoderWindow.h haiku/trunk/src/apps/mediaconverter/MediaFileInfoView.cpp haiku/trunk/src/apps/mediaconverter/MediaFileInfoView.h haiku/trunk/src/apps/mediaconverter/MediaFileListView.cpp haiku/trunk/src/apps/mediaconverter/MediaFileListView.h haiku/trunk/src/apps/mediaconverter/MessageConstants.h haiku/trunk/src/apps/mediaconverter/StatusView.cpp haiku/trunk/src/apps/mediaconverter/StatusView.h haiku/trunk/src/apps/mediaconverter/Strings.h haiku/trunk/src/apps/mediaconverter/languages/ haiku/trunk/src/apps/mediaconverter/languages/MediaConverter.frFR haiku/trunk/src/apps/mediaconverter/languages/MediaConverter.itIT haiku/trunk/src/apps/mediaconverter/languages/MediaConverter.jaJP Modified: haiku/trunk/src/apps/Jamfile Log: * added MediaConverter, the improved version by Jun Suzuki, to the source tree * I completely rearranged the source and fixed a few bugs, one of which prevented me to use this tool to convert some XViD encoded AVIs that had sound to PJPEG encoding. * it is currently agreed to have this in the source, but not on the image yet, the MediaKit doesn't support writing anyways as of now Modified: haiku/trunk/src/apps/Jamfile =================================================================== --- haiku/trunk/src/apps/Jamfile 2007-06-21 22:14:44 UTC (rev 21488) +++ haiku/trunk/src/apps/Jamfile 2007-06-21 22:19:02 UTC (rev 21489) @@ -17,6 +17,7 @@ SubInclude HAIKU_TOP src apps magnify ; SubInclude HAIKU_TOP src apps mail ; SubInclude HAIKU_TOP src apps mandelbrot ; +SubInclude HAIKU_TOP src apps mediaconverter ; SubInclude HAIKU_TOP src apps mediaplayer ; SubInclude HAIKU_TOP src apps midiplayer ; SubInclude HAIKU_TOP src apps networkstatus ; Added: haiku/trunk/src/apps/mediaconverter/Jamfile =================================================================== --- haiku/trunk/src/apps/mediaconverter/Jamfile 2007-06-21 22:14:44 UTC (rev 21488) +++ haiku/trunk/src/apps/mediaconverter/Jamfile 2007-06-21 22:19:02 UTC (rev 21489) @@ -0,0 +1,15 @@ +SubDir HAIKU_TOP src apps mediaconverter ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +Application MediaConverter : + MediaConverterApp.cpp + MediaConverterWindow.cpp + MediaEncoderWindow.cpp + MediaFileInfoView.cpp + MediaFileListView.cpp + StatusView.cpp + + : be media tracker + : MediaConverter.rdef +; Added: haiku/trunk/src/apps/mediaconverter/LICENSE =================================================================== --- haiku/trunk/src/apps/mediaconverter/LICENSE 2007-06-21 22:14:44 UTC (rev 21488) +++ haiku/trunk/src/apps/mediaconverter/LICENSE 2007-06-21 22:19:02 UTC (rev 21489) @@ -0,0 +1,31 @@ +---------------------- +Be Sample Code License +---------------------- + +Copyright 1991-1999, Be Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions, and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions, and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Added: haiku/trunk/src/apps/mediaconverter/MediaConverter.rdef =================================================================== --- haiku/trunk/src/apps/mediaconverter/MediaConverter.rdef 2007-06-21 22:14:44 UTC (rev 21488) +++ haiku/trunk/src/apps/mediaconverter/MediaConverter.rdef 2007-06-21 22:19:02 UTC (rev 21489) @@ -0,0 +1,77 @@ + +resource app_signature "application/x-vnd.Haiku-MediaConverter"; + +resource app_version { + major = 1, + middle = 3, + minor = 1, + variety = B_APPV_BETA, + internal = 0, + short_info = "MediaConverter", + long_info = "MediaConverter ?1999, Be, Inc., ?2000-2004 Jun Suzuki, ?2007 Haiku, Inc." +}; + +resource app_flags B_SINGLE_LAUNCH; + +resource file_types message { + "types" = "application/ogg", + "types" = "application/x-ogg", + "types" = "audio", + "types" = "video" +}; + + +resource large_icon { + $"FFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFF00003F3F3F3F3F3F0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFF003F3F3F000000003F3F3F00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFF003F3F3F0000000000003F3F3F00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FF003F3F3F3F0000000000003F3F3F3F00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FF003F3F3F3F3F000000003F3F3F3F3F00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"003F3F00003F3F3F00003F3F3F00003F3F00FFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"003F000000003F3F3F3F3F3F000000003F00FFFF010101010101FFFFFFFFFFFF" + $"003F00000000003F00003F00000000003F00FFFF01FAFAFAFAFA01FFFFFFFFFF" + $"003F00000000003F00003F00000000003F00FFFF01FAFAFAFAFAFA01FFFFFFFF" + $"003F000000003F3F3F3F3F3F000000003F00FFFF0101010101FAFAFA01FFFFFF" + $"003F3F00003F3F3F00003F3F3F00003F3F00FFFFFFFFFFFFFF01FAFA01FFFFFF" + $"FF003F3F3F3F3F000000003F3F3F3F3F00FFFFFFFFFFFFFFFF01FAFA01FFFFFF" + $"FF003F3F3F3F0000000000003F3F3F3F00FFFFFFFFFF01010101FAFA01010101" + $"FFFF003F3F3F0000000000003F3F3F00FFFFFFFFFFFF01FAFAFAFAFAFAFAFA01" + $"FFFFFF003F3F3F000000003F3F3F00FFFFFFFFFFFFFFFF01FAFAFAFAFAFA01FF" + $"FFFFFFFF00003F3F3F3F3F3F0000FFFFFFFFFFFFFFFFFFFF01FAFAFAFA01FFFF" + $"FFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFFFFFFFFF01FAFA01FFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0101FFFFFFFF" + $"FFFFFFFF0101FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFF01FAFA01FFFFFFFFFFFF00000000000000000000000000000000000000" + $"FFFF01FAFAFAFA01FFFFFFFFFF00003F003F003F003F003F003F003F003F0000" + $"FF01FAFAFAFAFAFA01FFFFFFFF00000000000000000000000000000000000000" + $"01FAFAFAFAFAFAFAFA01FFFFFF00000000000000000000000000000000000000" + $"01010101FAFA01010101FFFFFF0000003F3F3F3F003F3F3F003F3F3F3F000000" + $"FFFFFF01FAFA01FFFFFFFFFFFF00003F3F3F3F3F3F003F003F3F3F3F3F3F0000" + $"FFFFFF01FAFA01FFFFFFFFFFFF00003F3F00003F3F003F003F3F00003F3F0000" + $"FFFFFF01FAFAFA0101010101FF00003F3F00003F3F003F003F3F00003F3F0000" + $"FFFFFFFF01FAFAFAFAFAFA01FF00003F3F3F3F3F3F003F003F3F3F3F3F3F0000" + $"FFFFFFFFFF01FAFAFAFAFA01FF0000003F3F3F3F003F3F3F003F3F3F3F000000" + $"FFFFFFFFFFFF010101010101FF00000000000000000000000000000000000000" + $"FFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000000000" +}; + +resource mini_icon { + $"FFFFFFFFFFFF00000000FFFFFFFFFFFF" + $"FFFFFFFF00003F3F3F3F0000FFFFFFFF" + $"FFFFFF003F3F3F00003F3F3F00FFFFFF" + $"FFFF003F3F0000000000003F3F00FFFF" + $"FF003F3F3F3F000000003F3F3F3F00FF" + $"FF003F003F3F3F00003F3F3F003F00FF" + $"003F3F00003F3F3F3F3F3F00003F3F00" + $"003F000000003F00003F000000003F00" + $"003F000000003F00003F000000003F00" + $"003F3F00003F3F3F3F3F3F00003F3F00" + $"FF003F003F3F3F00003F3F3F003F00FF" + $"FF003F3F3F3F000000003F3F3F3F00FF" + $"FFFF003F3F0000000000003F3F00FFFF" + $"FFFFFF003F3F3F00003F3F3F00FFFFFF" + $"FFFFFFFF00003F3F3F3F0000FFFFFFFF" + $"FFFFFFFFFFFF00000000FFFFFFFFFFFF" +}; + Added: haiku/trunk/src/apps/mediaconverter/MediaConverterApp.cpp =================================================================== --- haiku/trunk/src/apps/mediaconverter/MediaConverterApp.cpp 2007-06-21 22:14:44 UTC (rev 21488) +++ haiku/trunk/src/apps/mediaconverter/MediaConverterApp.cpp 2007-06-21 22:19:02 UTC (rev 21489) @@ -0,0 +1,599 @@ +// Copyright 1999, Be Incorporated. All Rights Reserved. +// Copyright 2000-2004, Jun Suzuki. All Rights Reserved. +// Copyright 2007, Stephan A?mus. All Rights Reserved. +// This file may be used under the terms of the Be Sample Code License. +#include "MediaConverterApp.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "MediaConverterWindow.h" +#include "MediaEncoderWindow.h" +#include "MessageConstants.h" +#include "Strings.h" + + +using std::nothrow; + +const char APP_SIGNATURE[] = "application/x-vnd.Haiku-MediaConverter"; + + +MediaConverterApp::MediaConverterApp() + : BApplication(APP_SIGNATURE) + , fWin(NULL) + , fConvertThreadID(-1) + , fConverting(false) + , fCancel(false) +{ + // TODO: implement settings for window pos + fWin = new MediaConverterWindow(BRect(50, 50, 520, 555)); +} + + +MediaConverterApp::~MediaConverterApp() +{ + if (fConvertThreadID >= 0) { + fCancel = true; + status_t exitValue; + wait_for_thread(fConvertThreadID, &exitValue); + } +} + + +// #pragma mark - + + +void +MediaConverterApp::MessageReceived(BMessage *msg) +{ + switch (msg->what) { + case FILE_LIST_CHANGE_MESSAGE: + if (fWin->Lock()) { + bool enable = fWin->CountSourceFiles() > 0; + fWin->SetEnabled(enable, enable); + fWin->Unlock(); + } + break; + + case START_CONVERSION_MESSAGE: + if (!fConverting) + StartConverting(); + break; + + case CANCEL_CONVERSION_MESSAGE: + fCancel = true; + break; + + case CONVERSION_DONE_MESSAGE: + fCancel = false; + fConverting = false; + DetachCurrentMessage(); + BMessenger(fWin).SendMessage(msg); + break; + + default: + BApplication::MessageReceived(msg); + } +} + + +void +MediaConverterApp::ReadyToRun() +{ + fWin->Show(); + fWin->PostMessage(INIT_FORMAT_MENUS); +} + +void +MediaConverterApp::RefsReceived(BMessage *msg) +{ + entry_ref ref; + int32 i = 0; + BMediaFile *f; + BString errorFiles; + int32 errors = 0; + + // from Open dialog or drag & drop + + while (msg->FindRef("refs", i++, &ref) == B_OK) { + f = new BMediaFile(&ref/*, B_MEDIA_FILE_NO_READ_AHEAD*/); + if (f->InitCheck() != B_OK) { + errorFiles << ref.name << "\n"; + errors++; + delete f; + continue; + } + if (fWin->Lock()) { + fWin->AddSourceFile(f, ref); + fWin->Unlock(); + } + } + + if (errors) { + BString alertText; + alertText << errors << ((errors > 1) ? FILES : FILE) + << NOTRECOGNIZE << "\n"; + alertText << errorFiles; + BAlert *alert = new BAlert(ERROR_LOAD_STRING, alertText.String(), + CONTINUE_STRING , NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert->Go(); + } +} + + +// #pragma mark - + + +bool +MediaConverterApp::IsConverting() const +{ + return fConverting; +} + + +void +MediaConverterApp::StartConverting() +{ + bool locked = fWin->Lock(); + + if (locked && (fWin->CountSourceFiles() > 0)) { + fConvertThreadID = spawn_thread(MediaConverterApp::_RunConvertEntry, + "converter thread", B_LOW_PRIORITY, (void *)this); + if (fConvertThreadID >= 0) { + fConverting = true; + fCancel = false; + resume_thread(fConvertThreadID); + } + } + + if (locked) { + fWin->Unlock(); + } +} + + +void +MediaConverterApp::SetStatusMessage(const char *message) +{ + if (fWin != NULL && fWin->Lock()) { + fWin->SetStatusMessage(message); + fWin->Unlock(); + } +} + + +// #pragma mark - + + +BEntry +MediaConverterApp::_CreateOutputFile(BDirectory directory, + entry_ref* ref, media_file_format* outputFormat) +{ + BString name(ref->name); + // create output file name + int32 extIndex = name.FindLast('.'); + if (extIndex != B_ERROR) + name.Truncate(extIndex + 1); + else + name.Append("."); + + name.Append(outputFormat->file_extension); + + BEntry inEntry(ref); + BEntry outEntry; + + if (inEntry.InitCheck() == B_OK) { + // ensure that output name is unique + int32 len = name.Length(); + int32 i = 1; + while (directory.Contains(name.String())) { + name.Truncate(len); + name << " " << i; + i++; + } + outEntry.SetTo(&directory, name.String()); + } + + return outEntry; +} + + +int32 +MediaConverterApp::_RunConvertEntry(void* castToMediaConverterApp) +{ + MediaConverterApp* app = (MediaConverterApp*)castToMediaConverterApp; + app->_RunConvert(); + return 0; +} + + +void +MediaConverterApp::_RunConvert() +{ + bigtime_t start = 0; + bigtime_t end = 0; + int32 audioQuality = 75; + int32 videoQuality = 75; + + if (fWin->Lock()) { + char *a; + start = strtoimax(fWin->StartDuration(), &a, 0) * 1000; + end = strtoimax(fWin->EndDuration(), &a, 0) * 1000; + audioQuality = fWin->AudioQuality(); + videoQuality = fWin->VideoQuality(); + fWin->Unlock(); + } + + int32 srcIndex = 0; + + BMediaFile *inFile(NULL), *outFile(NULL); + BEntry outEntry; + entry_ref inRef; + entry_ref outRef; + BPath path; + BString name; + + while (!fCancel) { + if (fWin->Lock()) { + status_t r = fWin->GetSourceFileAt(srcIndex, &inFile, &inRef); + if (r == B_OK) { + media_codec_info* audioCodec; + media_codec_info* videoCodec; + media_file_format* fileFormat; + fWin->GetSelectedFormatInfo(&fileFormat, &audioCodec, &videoCodec); + BDirectory directory = fWin->OutputDirectory(); + fWin->Unlock(); + outEntry = _CreateOutputFile(directory, &inRef, fileFormat); + + // display file name + + outEntry.GetPath(&path); + name.SetTo(path.Leaf()); + + if (outEntry.InitCheck() == B_OK) { + entry_ref outRef; + outEntry.GetRef(&outRef); + outFile = new BMediaFile(&outRef, fileFormat); + + name.Prepend(" '"); + name.Prepend(OUTPUT_FILE_STRING1); + name.Append("' "); + name.Append(OUTPUT_FILE_STRING2); + } else { + name.Prepend(" '"); + name.Prepend(OUTPUT_FILE_STRING3); + name.Append("'"); + } + + if (fWin->Lock()) { + fWin->SetFileMessage(name.String()); + fWin->Unlock(); + } + + if (outFile != NULL) { + r = _ConvertFile(inFile, outFile, audioCodec, videoCodec, + audioQuality, videoQuality, start, end); + + // set mime + update_mime_info(path.Path(), false, false, false); + + fWin->Lock(); + if (r == B_OK) { + fWin->RemoveSourceFile(srcIndex); + } else { + srcIndex++; + BString error(CONVERT_ERROR_STRING); + error << " '" << inRef.name << "'"; + fWin->SetStatusMessage(error.String()); + } + fWin->Unlock(); + } + + + } else { + fWin->Unlock(); + break; + } + } else { + break; + } + } + + BMessenger(this).SendMessage(CONVERSION_DONE_MESSAGE); +} + + +// #pragma mark - + + +status_t +MediaConverterApp::_ConvertFile(BMediaFile* inFile, BMediaFile* outFile, + media_codec_info* audioCodec, media_codec_info* videoCodec, + int32 audioQuality, int32 videoQuality, + bigtime_t startDuration, bigtime_t endDuration) +{ + BMediaTrack* inVidTrack = NULL; + BMediaTrack* inAudTrack = NULL; + BMediaTrack* outVidTrack = NULL; + BMediaTrack* outAudTrack = NULL; + + media_format inFormat; + media_format outAudFormat; + media_format outVidFormat; + + media_raw_audio_format* raf = NULL; + media_raw_video_format* rvf = NULL; + + int32 width = -1; + int32 height = -1; + + short audioFrameSize = 1; + + uint8* videoBuffer = NULL; + uint8* audioBuffer = NULL; + + // gather the necessary format information and construct output tracks + int64 videoFrameCount = 0; + int64 audioFrameCount = 0; + + status_t ret = B_OK; + + int32 tracks = inFile->CountTracks(); + for (int32 i = 0; i < tracks && (!outAudTrack || !outVidTrack); i++) { + BMediaTrack* inTrack = inFile->TrackAt(i); + memset(&inFormat, 0, sizeof(media_format)); + inTrack->EncodedFormat(&inFormat); + if (inFormat.IsAudio() && (audioCodec != NULL)) { + inAudTrack = inTrack; + memset(&outAudFormat, 0, sizeof(media_format)); + outAudFormat.type = B_MEDIA_RAW_AUDIO; + raf = &(outAudFormat.u.raw_audio); + inTrack->DecodedFormat(&outAudFormat); + + audioBuffer = new uint8[raf->buffer_size]; +// audioFrameSize = (raf->format & media_raw_audio_format::B_AUDIO_SIZE_MASK) + audioFrameSize = (raf->format & 0xf) * raf->channel_count; + outAudTrack = outFile->CreateTrack(&outAudFormat, audioCodec); + + if (outAudTrack != NULL) { + if (outAudTrack->SetQuality(audioQuality / 100.0f) != B_OK + && fWin->Lock()) { + fWin->SetAudioQualityLabel(AUDIO_SUPPORT_STRING); + fWin->Unlock(); + } + } + + } else if (inFormat.IsVideo() && (videoCodec != NULL)) { + inVidTrack = inTrack; + width = (int32)inFormat.Width(); + height = (int32)inFormat.Height(); + + // construct desired decoded video format +// memset(&outVidFormat, 0, sizeof(outVidFormat)); + outVidFormat.type = B_MEDIA_RAW_VIDEO; + rvf = &(outVidFormat.u.raw_video); + rvf->last_active = (uint32)(height - 1); + rvf->orientation = B_VIDEO_TOP_LEFT_RIGHT; + rvf->pixel_width_aspect = 1; + rvf->pixel_height_aspect = 1; + rvf->display.format = B_RGB32; + rvf->display.bytes_per_row = 4 * width; + rvf->display.line_width = width; + rvf->display.line_count = height; + + inVidTrack->DecodedFormat(&outVidFormat); + + if (rvf->display.format == B_RGBA32) { + printf("fixing color space (B_RGBA32 -> B_RGB32)"); + rvf->display.format = B_RGB32; + } + + videoBuffer = new (nothrow) uint8[height * rvf->display.bytes_per_row]; + outVidTrack = outFile->CreateTrack(&outVidFormat, videoCodec); + + if (outVidTrack != NULL) { + // DLM Added to use 3ivx Parameter View + const char* videoQualitySupport = NULL; + BView* encoderView = outVidTrack->GetParameterView(); + if (encoderView) { + MediaEncoderWindow* encoderWin + = new MediaEncoderWindow(BRect(50, 50, 520, 555), encoderView); + encoderWin->Go(); + // blocks until the window is quit + + // The quality setting is ignored by the 3ivx encoder if the + // view was displayed, but this method is the trigger to read + // all the parameter settings + outVidTrack->SetQuality(videoQuality / 100.0f); + + // We can now delete the encoderView created for us by the encoder + delete encoderView; + encoderView = NULL; + + videoQualitySupport = VIDEO_PARAMFORM_STRING; + } else { + if (outVidTrack->SetQuality(videoQuality / 100.0f) >= B_OK) + videoQualitySupport = VIDEO_SUPPORT_STRING; + } + if (videoQualitySupport && fWin->Lock()) { + fWin->SetVideoQualityLabel(videoQualitySupport); + fWin->Unlock(); + } + } + } else { + // didn't do anything with the track + inFile->ReleaseTrack(inTrack); + } + } + + if (!outVidTrack && !outAudTrack) { + printf("MediaConverterApp::_ConvertFile() - no tracks found!\n"); + ret = B_ERROR; + } + + if (fCancel) { + // don't have any video or audio tracks here, or cancelled + printf("MediaConverterApp::_ConvertFile() - user canceld before transcoding\n"); + ret = B_CANCELED; + } + + if (ret < B_OK) { + delete[] audioBuffer; + delete[] videoBuffer; + delete outFile; + return ret; + } + + outFile->CommitHeader(); + // this is where you would call outFile->AddCopyright(...) + + int64 framesRead; + media_header mh; + int32 lastPercent, currPercent; + float completePercent; + BString status; + + int64 start; + int64 end; + int32 stat = 0; + + // read video from source and write to destination, if necessary + if (outVidTrack != NULL) { + lastPercent = -1; + videoFrameCount = inVidTrack->CountFrames(); + if (endDuration == 0 || endDuration < startDuration) { + start = 0; + end = videoFrameCount; + } else { + inVidTrack->SeekToTime(&endDuration, stat); + end = inVidTrack->CurrentFrame(); + inVidTrack->SeekToTime(&startDuration, stat); + start = inVidTrack->CurrentFrame(); + if (end > videoFrameCount) + end = videoFrameCount; + if (start > end) + start = 0; + } + + framesRead = 0; + for (int64 i = start; (i <= end) && !fCancel; i += framesRead) { + if ((ret = inVidTrack->ReadFrames(videoBuffer, &framesRead, + &mh)) != B_OK) { + fprintf(stderr, "Error reading video frame %Ld: %s\n", i, + strerror(ret)); + status.SetTo(ERROR_READ_VIDEO_STRING); + status << i; + SetStatusMessage(status.String()); + + break; + } +//printf("writing frame %lld\n", i); + if ((ret = outVidTrack->WriteFrames(videoBuffer, framesRead, + mh.u.encoded_video.field_flags)) != B_OK) { + fprintf(stderr, "Error writing video frame %Ld: %s\n", i, + strerror(ret)); + status.SetTo(ERROR_WRITE_VIDEO_STRING); + status << i; + SetStatusMessage(status.String()); + break; + } + completePercent = (float)(i - start) / (float)(end - start) * 100; + currPercent = (int16)floor(completePercent); + if (currPercent > lastPercent) { + lastPercent = currPercent; + status.SetTo(WRITE_VIDEO_STRING); + status.Append(" "); + status << currPercent << "% " << COMPLETE_STRING; + SetStatusMessage(status.String()); + + } + } + outVidTrack->Flush(); + inFile->ReleaseTrack(inVidTrack); + } + + // read audio from source and write to destination, if necessary + if (outAudTrack != NULL) { + lastPercent = -1; + + audioFrameCount = inAudTrack->CountFrames(); + + if (endDuration == 0 || endDuration < startDuration) { + start = 0; + end = audioFrameCount; + } else { + inAudTrack->SeekToTime(&endDuration, stat); + end = inAudTrack->CurrentFrame(); + inAudTrack->SeekToTime(&startDuration, stat); + start = inAudTrack->CurrentFrame(); + if (end > audioFrameCount) + end = audioFrameCount; + if (start > end) + start = 0; + } + + for (int64 i = start; (i <= end) && !fCancel; i += framesRead) { + if ((ret = inAudTrack->ReadFrames(audioBuffer, &framesRead, + &mh)) != B_OK) { + fprintf(stderr, "Error reading audio frames: %s\n", strerror(ret)); + status.SetTo(ERROR_READ_AUDIO_STRING); + status << i; + SetStatusMessage(status.String()); + break; + } +//printf("writing audio frames %lld\n", i); + if ((ret = outAudTrack->WriteFrames(audioBuffer, + framesRead)) != B_OK) { + fprintf(stderr, "Error writing audio frames: %s\n", + strerror(ret)); + status.SetTo(ERROR_WRITE_AUDIO_STRING); + status << i; + SetStatusMessage(status.String()); + break; + } + completePercent = (float)(i - start) / (float)(end - start) * 100; + currPercent = (int16)floor(completePercent); + if (currPercent > lastPercent) { + lastPercent = currPercent; + status.SetTo(WRITE_AUDIO_STRING); + status.Append(" "); + status << currPercent << "% " << COMPLETE_STRING; + SetStatusMessage(status.String()); + } + } + outAudTrack->Flush(); + inFile->ReleaseTrack(inAudTrack); + + } + + outFile->CloseFile(); + delete outFile; + + delete[] videoBuffer; + delete[] audioBuffer; + + return ret; +} + + +// #pragma mark - + + +int +main(int, char **) +{ + MediaConverterApp app; + app.Run(); + + return 0; +} Added: haiku/trunk/src/apps/mediaconverter/MediaConverterApp.h =================================================================== --- haiku/trunk/src/apps/mediaconverter/MediaConverterApp.h 2007-06-21 22:14:44 UTC (rev 21488) +++ haiku/trunk/src/apps/mediaconverter/MediaConverterApp.h 2007-06-21 22:19:02 UTC (rev 21489) @@ -0,0 +1,56 @@ +// Copyright 1999, Be Incorporated. All Rights Reserved. +// Copyright 2000-2004, Jun Suzuki. All Rights Reserved. +// Copyright 2007, Stephan A?mus. All Rights Reserved. +// This file may be used under the terms of the Be Sample Code License. +#ifndef MEDIA_CONVERTER_APP_H +#define MEDIA_CONVERTER_APP_H + + +#include +#include +#include +#include +#include + + +class BMediaFile; +class MediaConverterWindow; + +class MediaConverterApp : public BApplication { + public: + MediaConverterApp(); + virtual ~MediaConverterApp(); + + protected: + + virtual void MessageReceived(BMessage* message); + virtual void ReadyToRun(); + virtual void RefsReceived(BMessage* message); + + public: + bool IsConverting() const; + void StartConverting(); + + void SetStatusMessage(const char* message); + + private: + BEntry _CreateOutputFile(BDirectory directory, + entry_ref* ref, + media_file_format* outputFormat); + + static int32 _RunConvertEntry(void* castToMediaConverterApp); + void _RunConvert(); + status_t _ConvertFile(BMediaFile* inFile, + BMediaFile* outFile, + media_codec_info* audioCodec, + media_codec_info* videoCodec, + int32 audioQuality, int32 videoQuality, + bigtime_t StartTime, bigtime_t EndTime); + + MediaConverterWindow* fWin; + thread_id fConvertThreadID; + bool fConverting; + volatile bool fCancel; +}; + +#endif // MEDIA_CONVERTER_APP_H Added: haiku/trunk/src/apps/mediaconverter/MediaConverterWindow.cpp =================================================================== --- haiku/trunk/src/apps/mediaconverter/MediaConverterWindow.cpp 2007-06-21 22:14:44 UTC (rev 21488) +++ haiku/trunk/src/apps/mediaconverter/MediaConverterWindow.cpp 2007-06-21 22:19:02 UTC (rev 21489) @@ -0,0 +1,1045 @@ +// Copyright 1999, Be Incorporated. All Rights Reserved. +// Copyright 2000-2004, Jun Suzuki. All Rights Reserved. +// Copyright 2007, Stephan A?mus. All Rights Reserved. +// This file may be used under the terms of the Be Sample Code License. +#include "MediaConverterWindow.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "MediaFileInfoView.h" +#include "MediaFileListView.h" +#include "MessageConstants.h" +#include "StatusView.h" +#include "Strings.h" + + +// #pragma mark - DirectoryFilter + + +class DirectoryFilter : public BRefFilter +{ +public: + DirectoryFilter(){}; + virtual bool Filter(const entry_ref *ref, + BNode *node, struct stat *st, const char *filetype) + { + return node->IsDirectory(); + } +private: +}; + + +// #pragma mark - FileFormatMenuItem + + +class FileFormatMenuItem : public BMenuItem { + public: + FileFormatMenuItem(media_file_format* format); + virtual ~FileFormatMenuItem(); + + media_file_format fFileFormat; +}; + + +FileFormatMenuItem::FileFormatMenuItem(media_file_format *format) + : BMenuItem(format->pretty_name, new BMessage(FORMAT_SELECT_MESSAGE)) +{ + memcpy(&fFileFormat, format, sizeof(fFileFormat)); +} + + +FileFormatMenuItem::~FileFormatMenuItem() +{ +} + + +// #pragma mark - CodecMenuItem + + +class CodecMenuItem : public BMenuItem { + public: + CodecMenuItem(media_codec_info *ci, uint32 msg_type); + virtual ~CodecMenuItem(); + + media_codec_info fCodecInfo; +}; + + +CodecMenuItem::CodecMenuItem(media_codec_info *ci, uint32 msg_type) + : BMenuItem(ci->pretty_name, new BMessage(msg_type)) +{ + memcpy(&fCodecInfo, ci, sizeof(fCodecInfo)); +} + + +CodecMenuItem::~CodecMenuItem() +{ +} + + +// #pragma mark - MediaConverterWindow + + +MediaConverterWindow::MediaConverterWindow(BRect frame) + : BWindow(frame, "MediaConverter", B_TITLED_WINDOW_LOOK, + B_NORMAL_WINDOW_FEEL, B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) + + , fVideoQuality(75) + , fAudioQuality(75) + + , fSaveFilePanel(NULL) + , fOpenFilePanel(NULL) + + , fOutputDirSpecified(false) + + , fEnabled(true) + , fConverting(false) + , fCancelling(false) +{ + char defaultdirectory[] = "/boot/home"; + fOutputDir.SetTo(defaultdirectory); + +#if B_BEOS_VERSION >= 0x530 // 0x520 RC2 0x530 RC3 + // load Locale files for ZETA + entry_ref mypath; + app_info info; + + be_app->GetAppInfo(&info); + mypath = info.ref; + + BPath path(&mypath); + path.GetParent(&path); + path.Append("Language/Dictionaries"); + path.Append("MediaConverter"); + be_locale.LoadLanguageFile(path.Path()); + +#endif + + BRect dummyRect(0, 0, 10, 10); + fMenuBar = new BMenuBar(dummyRect, "menubar"); + _CreateMenu(); + AddChild(fMenuBar); + + // background + BRect r(frame); + r.OffsetTo(0, 0); + BView *background = new BView(r, NULL, B_FOLLOW_ALL_SIDES, 0); + rgb_color c = ui_color(B_PANEL_BACKGROUND_COLOR); + background->SetViewColor(c); + background->SetLowColor(c); + r.InsetBy(5, 25); + + // file list view box + BRect r2(r); + r2.bottom = r2.top + 420; + r2.right = r2.left + 150; + fBox1 = new BBox(r2, NULL, B_FOLLOW_ALL); + + BRect r3(r2); + r3.OffsetTo(0, 0); + r3.InsetBy(8, 8); + r3.top += be_bold_font->Size() - 3; + bool useHorizontalScrollBar = false; + if (useHorizontalScrollBar) + r3.bottom -= B_H_SCROLL_BAR_HEIGHT; + r3.right -= B_V_SCROLL_BAR_WIDTH; + fListView = new MediaFileListView(r3, B_FOLLOW_ALL); + BScrollView *scroller = new BScrollView(NULL, fListView, + B_FOLLOW_ALL, 0, useHorizontalScrollBar, true); + fBox1->AddChild(scroller); + background->AddChild(fBox1); + + // info box + r2.left = r2.right + 5; + r2.right = r.right - 5; + r2.bottom = r2.top + 120; [... truncated: 1953 lines follow ...] From axeld at mail.berlios.de Fri Jun 22 00:38:18 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 22 Jun 2007 00:38:18 +0200 Subject: [Haiku-commits] r21490 - haiku/trunk/src/preferences/time Message-ID: <200706212238.l5LMcICS014070@sheep.berlios.de> Author: axeld Date: 2007-06-22 00:38:16 +0200 (Fri, 22 Jun 2007) New Revision: 21490 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21490&view=rev Modified: haiku/trunk/src/preferences/time/DateTimeEdit.cpp haiku/trunk/src/preferences/time/DateTimeEdit.h Log: * The AM/PM value wasn't correctly shown when it was 12 o'clock. This fixes bug #1184. * Minor cleanup. Modified: haiku/trunk/src/preferences/time/DateTimeEdit.cpp =================================================================== --- haiku/trunk/src/preferences/time/DateTimeEdit.cpp 2007-06-21 22:19:02 UTC (rev 21489) +++ haiku/trunk/src/preferences/time/DateTimeEdit.cpp 2007-06-21 22:38:16 UTC (rev 21490) @@ -9,8 +9,8 @@ TDateTimeSection::TDateTimeSection(BRect frame, uint32 data) - : TSection(frame) - , f_data(data) + : TSection(frame), + fData(data) { } @@ -23,17 +23,18 @@ uint32 TDateTimeSection::Data() const { - return f_data; + return fData; } void TDateTimeSection::SetData(uint32 data) { - f_data = data; + fData = data; } +// #pragma mark - TTimeEdit::TTimeEdit(BRect frame, const char *name, uint32 sections) @@ -46,9 +47,10 @@ TTimeEdit::~TTimeEdit() { TSection *section; - if (f_sections->CountItems() > 0) + if (f_sections->CountItems() > 0) { for (int32 idx = 0; (section = (TSection *)f_sections->ItemAt(idx)); idx++) delete section; + } delete f_sections; } @@ -62,54 +64,56 @@ void -TTimeEdit::DrawSection(uint32 index, bool isfocus) +TTimeEdit::DrawSection(uint32 index, bool hasFocus) { if (f_sections->CountItems() == 0) printf("No Sections!!!\n"); - + // user defined section drawing TDateTimeSection *section; section = (TDateTimeSection *)f_sections->ItemAt(index); - + BRect bounds = section->Frame(); - - + // format value to display uint32 value; - - if (isfocus) { + + if (hasFocus) { SetLowColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); value = f_holdvalue; } else { SetLowColor(ViewColor()); value = section->Data(); } - + BString text; // format value (new method?) switch (index) { case 0: // hour - if (value> 12) { - if (value < 22) text << "0"; - text << value -12; + if (value > 12) { + if (value < 22) + text << "0"; + text << value - 12; } else if (value == 0) { text << "12"; } else { - if (value <10) text << "0"; + if (value < 10) + text << "0"; text << value; } break; - + case 1: // minute case 2: // second - if (value <10) text << "0"; + if (value < 10) + text << "0"; text << value; break; - case 3: //am/pm + case 3: // am/pm value = ((TDateTimeSection *)f_sections->ItemAt(0))->Data(); - if (value >12 || value == 0) + if (value >= 12) text << "PM"; else text << "AM"; @@ -297,28 +301,28 @@ { int32 value = f_holdvalue; switch (f_focus) { - case 0: //hour + case 0: // hour if (value> 23) value = 0; else if (value < 0) value = 23; break; - - case 1: //minute + + case 1: // minute if (value> 59) value = 0; else if (value < 0) value = 59; break; - - case 2: //second + + case 2: // second if (value > 59) value = 0; else if (value < 0) value = 59; break; - + case 3: // modify hour value to reflect change in am/pm value = ((TDateTimeSection *)f_sections->ItemAt(0))->Data(); @@ -326,28 +330,27 @@ value += 12; else value -= 12; - if (value == 24) value = 0; + if (value == 24) + value = 0; ((TDateTimeSection *)f_sections->ItemAt(0))->SetData(value); break; - + default: return; } - + ((TDateTimeSection *)f_sections->ItemAt(f_focus))->SetData(value); f_holdvalue = value; - - Draw(Bounds()); + + Invalidate(Bounds()); } +// #pragma mark - -/* DATE TSECTIONEDIT */ - - -const char *months[] = -{ "January", "Febuary", "March", "April", "May", "June", - "July", "August", "September", "October", "November", "December" +const char *months[] = { + "January", "Febuary", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" }; @@ -361,9 +364,10 @@ TDateEdit::~TDateEdit() { TSection *section; - if (f_sections->CountItems() > 0) + if (f_sections->CountItems() > 0) { for (int32 idx = 0; (section = (TSection *)f_sections->ItemAt(idx)); idx++) delete section; + } delete f_sections; } @@ -377,7 +381,7 @@ void -TDateEdit::DrawSection(uint32 index, bool isfocus) +TDateEdit::DrawSection(uint32 index, bool hasFocus) { if (f_sections->CountItems() == 0) printf("No Sections!!!\n"); @@ -385,55 +389,53 @@ // user defined section drawing TDateTimeSection *section; section = (TDateTimeSection *)f_sections->ItemAt(index); - + BRect bounds = section->Frame(); - - + // format value to display uint32 value; - - if (isfocus) { + + if (hasFocus) { SetLowColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); value = f_holdvalue; } else { SetLowColor(ViewColor()); value = section->Data(); } - - BString text; + + char text[64]; // format value (new method?) switch (index) { case 0: // month - text << months[value]; - break; - + struct tm tm; + tm.tm_mon = value; + strftime(text, sizeof(text), "%B", &tm); + break; + case 1: // day - text << value; - break; - + snprintf(text, sizeof(text), "%lu", value); + break; + case 2: // year - text << value +1900; - break; - + snprintf(text, sizeof(text), "%lu", value + 1900); + break; + default: return; - break; } // calc and center text in section rect - - float width = be_plain_font->StringWidth(text.String()); - - BPoint offset(-(bounds.Width()/2.0 -width/2.0) -1.0, (bounds.Height()/2.0 -6.0)); - + + float width = StringWidth(text); + + BPoint offset(-(bounds.Width() - width) /2.0 - 1.0, (bounds.Height() / 2.0 - 6.0)); + if (index == 0) - offset.x = -(bounds.Width() -width) ; - - BPoint drawpt(bounds.LeftBottom() -offset); - + offset.x = -(bounds.Width() - width) ; + SetHighColor(0, 0, 0, 255); FillRect(bounds, B_SOLID_LOW); - DrawString(text.String(), drawpt); + DrawString(text, bounds.LeftBottom() - offset); } @@ -444,14 +446,18 @@ in f_sections or the section to the seps left */ - if (index == 3) return; // no seperator for am/pm + if (index == 3) { + // no seperator for am/pm + return; + } + BString text("/"); uint32 sep; GetSeperatorWidth(&sep); - + TDateTimeSection *section = (TDateTimeSection *)f_sections->ItemAt(index); BRect bounds = section->Frame(); - + float width = be_plain_font->StringWidth(text.String()); BPoint offset(-(sep/2.0 -width/2.0) -1.0, bounds.Height()/2.0 -6.0); BPoint drawpt(bounds.RightBottom() -offset); @@ -469,25 +475,25 @@ section = new TDateTimeSection(area); f_sections->AddItem(section); } - + BRect bounds(area); float width; - + // year width = be_plain_font->StringWidth("0000") +6; bounds.right = area.right; bounds.left = bounds.right -width; ((TDateTimeSection *)f_sections->ItemAt(2))->SetBounds(bounds); - + uint32 sep; GetSeperatorWidth(&sep); - + // day width = be_plain_font->StringWidth("00") +6; bounds.right = bounds.left -sep; bounds.left = bounds.right -width; ((TDateTimeSection *)f_sections->ItemAt(1))->SetBounds(bounds); - + // month bounds.right = bounds.left -sep; bounds.left = area.left; @@ -509,7 +515,7 @@ // update hold value f_holdvalue = ((TDateTimeSection *)f_sections->ItemAt(f_focus))->Data(); - + Draw(Bounds()); } @@ -517,30 +523,29 @@ void TDateEdit::SetTo(uint32 year, uint32 month, uint32 day) { - if (f_sections->CountItems()> 0) - { + if (f_sections->CountItems() > 0) { bool update = false; - + TDateTimeSection *section = (TDateTimeSection *)f_sections->ItemAt(0); if (section->Data() != month) { section->SetData(month); update = true; } - + section = (TDateTimeSection *)f_sections->ItemAt(1); if (section->Data() != day) { section->SetData(day); update = true; } - + section = (TDateTimeSection *)f_sections->ItemAt(2); if (section->Data() != year) { section->SetData(year); update = true; } - + if (update) - Draw(Bounds()); + Invalidate(Bounds()); } } @@ -553,9 +558,9 @@ // update displayed value f_holdvalue += 1; - + CheckRange(); - + // send message to change Date DispatchMessage(); } @@ -569,9 +574,9 @@ // update display value f_holdvalue -= 1; - + CheckRange(); - + // send message to change Date DispatchMessage(); } @@ -581,17 +586,17 @@ TDateEdit::BuildDispatch(BMessage *message) { static const char *fields[3] = {"month", "day", "year"}; - + message->AddBool("time", false); - + for (int32 idx = 0; idx < f_sections->CountItems(); idx++) { uint32 data; - + if (f_focus == idx) data = f_holdvalue; else data = ((TDateTimeSection *)f_sections->ItemAt(idx))->Data(); - + message->AddInt32(fields[idx], data); } } @@ -611,7 +616,7 @@ value = 11; break; } - + case 1: //day { uint32 month = ((TDateTimeSection *)f_sections->ItemAt(0))->Data(); @@ -624,7 +629,7 @@ value = daycnt; break; } - + case 2: //year { if (value > YEAR_DELTA_MAX) @@ -633,16 +638,14 @@ value = YEAR_DELTA_MAX; break; } - + default: return; } - + ((TDateTimeSection *)f_sections->ItemAt(f_focus))->SetData(value); f_holdvalue = value; - + Draw(Bounds()); } - -//---// Modified: haiku/trunk/src/preferences/time/DateTimeEdit.h =================================================================== --- haiku/trunk/src/preferences/time/DateTimeEdit.h 2007-06-21 22:19:02 UTC (rev 21489) +++ haiku/trunk/src/preferences/time/DateTimeEdit.h 2007-06-21 22:38:16 UTC (rev 21490) @@ -4,7 +4,7 @@ #include "SectionEdit.h" // TSection descendent to hold uint32 value -class TDateTimeSection: public TSection { +class TDateTimeSection : public TSection { public: TDateTimeSection(BRect frame, uint32 data = 0); ~TDateTimeSection(); @@ -12,38 +12,35 @@ uint32 Data() const; void SetData(uint32 data); private: - uint32 f_data; + uint32 fData; }; // TSectionEdit descendent to edit time -class TTimeEdit: public TSectionEdit { +class TTimeEdit : public TSectionEdit { public: TTimeEdit(BRect frame, const char *name, uint32 sections); ~TTimeEdit(); - + virtual void InitView(); virtual void DrawSection(uint32 index, bool isfocus); virtual void DrawSeperator(uint32 index); - + virtual void SetSections(BRect area); virtual void SectionFocus(uint32 index); virtual void GetSeperatorWidth(uint32 *width); - + void CheckRange(); - + virtual void DoUpPress(); virtual void DoDownPress(); - + virtual void BuildDispatch(BMessage *message); - + void SetTo(uint32 hour, uint32 minute, uint32 second); }; - -/* DATE TSECTIONEDIT */ - // TSectionEdit descendent to edit Date -class TDateEdit: public TSectionEdit { +class TDateEdit : public TSectionEdit { public: TDateEdit(BRect frame, const char *name, uint32 sections); ~TDateEdit(); @@ -66,5 +63,4 @@ void SetTo(uint32 hour, uint32 minute, uint32 second); }; - -#endif //DATETIME_H +#endif // DATETIME_H From axeld at mail.berlios.de Fri Jun 22 00:42:41 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 22 Jun 2007 00:42:41 +0200 Subject: [Haiku-commits] r21491 - haiku/trunk/src/servers/app Message-ID: <200706212242.l5LMgfFV019549@sheep.berlios.de> Author: axeld Date: 2007-06-22 00:42:39 +0200 (Fri, 22 Jun 2007) New Revision: 21491 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21491&view=rev Modified: haiku/trunk/src/servers/app/Desktop.cpp Log: The Workspaces layer will now also be updated when the window hidden/shown is not on the current workspace - this fixes bug #1191. Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2007-06-21 22:38:16 UTC (rev 21490) +++ haiku/trunk/src/servers/app/Desktop.cpp 2007-06-21 22:42:39 UTC (rev 21491) @@ -1490,6 +1490,7 @@ ActivateWindow(window); } else { // then we don't need to send the fake mouse event either + _WindowChanged(window); UnlockAllWindows(); return; } @@ -1527,7 +1528,8 @@ if (FocusWindow() == window) SetFocusWindow(_CurrentWindows().LastWindow()); - } + } else + _WindowChanged(window); if (fWorkspacesLayer != NULL) fWorkspacesLayer->WindowRemoved(window); From axeld at mail.berlios.de Fri Jun 22 01:38:54 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 22 Jun 2007 01:38:54 +0200 Subject: [Haiku-commits] r21492 - in haiku/trunk: headers/private/graphics/s3savage src/add-ons/accelerants/s3savage src/add-ons/kernel/drivers/graphics/s3savage Message-ID: <200706212338.l5LNcsGu017825@sheep.berlios.de> Author: axeld Date: 2007-06-22 01:38:53 +0200 (Fri, 22 Jun 2007) New Revision: 21492 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21492&view=rev Modified: haiku/trunk/headers/private/graphics/s3savage/DriverInterface.h haiku/trunk/src/add-ons/accelerants/s3savage/GlobalData.h haiku/trunk/src/add-ons/accelerants/s3savage/InitAccelerant.c haiku/trunk/src/add-ons/kernel/drivers/graphics/s3savage/driver.c Log: * Korli renamed the driver, but forgot to let the driver ask for the new accelerant name. * Added a TRACE_S3SAVAGE macro that turns on debug output - should be set conditionally if DEBUG is defined (see DriverInterface.h), but is currently always on, as requested by Gerald. * Some minor style fixes. Modified: haiku/trunk/headers/private/graphics/s3savage/DriverInterface.h =================================================================== --- haiku/trunk/headers/private/graphics/s3savage/DriverInterface.h 2007-06-21 22:42:39 UTC (rev 21491) +++ haiku/trunk/headers/private/graphics/s3savage/DriverInterface.h 2007-06-21 23:38:53 UTC (rev 21492) @@ -5,10 +5,10 @@ Other authors: Gerald Zajac 2006-2007 */ - #ifndef DRIVERINTERFACE_H #define DRIVERINTERFACE_H + #include #include #include @@ -23,11 +23,14 @@ extern "C" { #endif +#if 1 /* DEBUG */ +# define TRACE_S3SAVAGE + // turns on debug output +#endif #define NUM_ELEMENTS(a) ((int)(sizeof(a) / sizeof(a[0]))) // for computing number of elements in an array -typedef struct -{ +typedef struct { sem_id sem; int32 ben; } benaphore; @@ -41,8 +44,7 @@ #define SAVAGE_PRIVATE_DATA_MAGIC 0x5791 // a private driver rev, of sorts -enum -{ +enum { SAVAGE_GET_PRIVATE_DATA = B_DEVICE_OP_CODES_END + 1, SAVAGE_GET_PCI, SAVAGE_SET_PCI, @@ -54,8 +56,7 @@ // Chip tags. These are used to group the adapters into related // families. See table SavageChipsetTable in driver.c -enum S3ChipTags -{ +enum S3ChipTags { S3_UNKNOWN = 0, S3_SAVAGE3D, S3_SAVAGE_MX, @@ -111,9 +112,7 @@ } BMPDESC; - -typedef struct -{ +typedef struct { // Device ID info. uint16 vendorID; // PCI vendor ID, from pci_info uint16 deviceID; // PCI device ID, from pci_info @@ -147,8 +146,7 @@ int32 flags; // Cursor info. - struct - { + struct { uint16 hot_x; // Cursor hot spot. The top left corner of the cursor uint16 hot_y; // is 0,0 uint16 x; // The location of the cursor hot spot on the @@ -164,8 +162,7 @@ frame_buffer_config fbc; // frame buffer addresses and bytes_per_row // Acceleration engine. - struct - { + struct { uint64 count; // last fifo slot used uint64 lastIdle; // last fifo slot we *know* the engine was idle after benaphore lock; // for serializing access to the acceleration engine @@ -202,8 +199,7 @@ // Read or write a value in PCI configuration space -typedef struct -{ +typedef struct { uint32 magic; // magic number to make sure the caller groks us uint32 offset; // Offset to read/write uint32 size; // Number of bytes to transfer @@ -212,16 +208,14 @@ // Set some boolean condition (like enabling or disabling interrupts) -typedef struct -{ +typedef struct { uint32 magic; // magic number to make sure the caller groks us bool bEnable; // state to set } SavageSetBoolState; // Retrieve the area_id of the kernel/accelerant shared info -typedef struct -{ +typedef struct { uint32 magic; // magic number to make sure the caller groks us area_id sharedInfoArea; // ID of area containing shared information } SavageGetPrivateData; @@ -229,8 +223,7 @@ // Retrieve the device name. Usefull for when we have a file handle, but want // to know the device name (like when we are cloning the accelerant) -typedef struct -{ +typedef struct { uint32 magic; // magic number to make sure the caller groks us char *name; // The name of the device, less the /dev root } SavageDeviceName; @@ -240,5 +233,4 @@ } #endif - -#endif +#endif /* DRIVERINTERFACE_H */ Modified: haiku/trunk/src/add-ons/accelerants/s3savage/GlobalData.h =================================================================== --- haiku/trunk/src/add-ons/accelerants/s3savage/GlobalData.h 2007-06-21 22:42:39 UTC (rev 21491) +++ haiku/trunk/src/add-ons/accelerants/s3savage/GlobalData.h 2007-06-21 23:38:53 UTC (rev 21492) @@ -23,10 +23,10 @@ void TraceLog(const char* fmt, ...); -#ifdef DEBUG -#define TRACE(a) TraceLog a +#ifdef TRACE_S3SAVAGE +# define TRACE(a) TraceLog a #else -#define TRACE(a) +# define TRACE(a) #endif #endif // GLOBALDATA_H Modified: haiku/trunk/src/add-ons/accelerants/s3savage/InitAccelerant.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/s3savage/InitAccelerant.c 2007-06-21 22:42:39 UTC (rev 21491) +++ haiku/trunk/src/add-ons/accelerants/s3savage/InitAccelerant.c 2007-06-21 23:38:53 UTC (rev 21492) @@ -269,7 +269,6 @@ } - // Kernel function dprintf() is not available in user space; however, // _sPrintf performs the same function in user space but is undefined // in the OS header files. Thus, it is defined here. Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/s3savage/driver.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/s3savage/driver.c 2007-06-21 22:42:39 UTC (rev 21491) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/s3savage/driver.c 2007-06-21 23:38:53 UTC (rev 21492) @@ -20,11 +20,10 @@ #include - -#ifdef DEBUG -#define TRACE(a) TraceLog a +#ifdef TRACE_S3SAVAGE +# define TRACE(a) TraceLog a #else -#define TRACE(a) +# define TRACE(a) #endif @@ -46,8 +45,7 @@ /* these structures are private to the kernel driver */ -typedef struct -{ +typedef struct { uint16 chipID; // PCI device id of the chipset uint16 chipset; // assigned chipset family identifier char* chipName; // user recognizable name for chipset (must be < 32 chars) @@ -55,8 +53,7 @@ /* This table maps a PCI device ID to a chipset family identifier and the chipset name. */ -static ChipInfo SavageChipTable[] = -{ +static ChipInfo SavageChipTable[] = { { 0x8a20, S3_SAVAGE3D, "Savage3D" }, { 0x8a21, S3_SAVAGE3D, "Savage3D-MV" }, { 0x8a22, S3_SAVAGE4, "Savage4" }, @@ -86,19 +83,16 @@ #define VENDOR_ID_SAVAGE 0x5333 /* S3 Savage vendor ID */ -static struct -{ +static struct { uint16 vendorID; ChipInfo* devices; -} SupportedDevices[] = -{ +} SupportedDevices[] = { { VENDOR_ID_SAVAGE, SavageChipTable }, { 0x0000, NULL } }; -typedef struct -{ +typedef struct { uint32 is_open; /* a count of how many times the devices has been opened */ area_id sharedArea; /* the area shared between the driver and all of the accelerants */ SharedInfo *si; /* a pointer to the shared area, for convenience */ @@ -109,8 +103,7 @@ } DeviceInfo; -typedef struct -{ +typedef struct { uint32 count; /* number of devices actually found */ benaphore kernel; /* for serializing opens/closes */ char *deviceNames[MAX_DEVICES+1]; /* device name pointer storage */ @@ -146,11 +139,11 @@ NULL }; -#ifdef DEBUG +#ifdef TRACE_S3SAVAGE static void TraceLog(const char *fmt, ...) { - char string[1024]; + char string[1024]; va_list args; strcpy(string, "savage: "); @@ -521,8 +514,11 @@ } +// #pragma mark - Device Hooks + + static status_t -open_hook (const char* name, uint32 flags, void** cookie) +open_hook(const char* name, uint32 flags, void** cookie) { int32 index = 0; DeviceInfo *di; @@ -642,9 +638,6 @@ } -/* ---------- - read_hook - does nothing, gracefully ------ */ static status_t read_hook(void* dev, off_t pos, void* buf, size_t* len) { @@ -658,10 +651,6 @@ } - -/* ---------- - write_hook - does nothing, gracefully ------ */ static status_t write_hook(void* dev, off_t pos, const void* buf, size_t* len) { @@ -675,9 +664,6 @@ } -/* ---------- - close_hook - does nothing, gracefully ------ */ static status_t close_hook(void* dev) { @@ -689,9 +675,6 @@ } -/* ----------- - free_hook - close down the device ------------ */ static status_t free_hook(void* dev) { @@ -738,11 +721,8 @@ } -/* ----------- - control_hook - where the real work is done ------------ */ static status_t -control_hook (void* dev, uint32 msg, void *buf, size_t len) +control_hook(void* dev, uint32 msg, void *buf, size_t len) { DeviceInfo *di = (DeviceInfo *)dev; status_t result = B_DEV_INVALID_IOCTL; @@ -753,53 +733,59 @@ switch (msg) { /* the only PUBLIC ioctl */ - case B_GET_ACCELERANT_SIGNATURE: { + case B_GET_ACCELERANT_SIGNATURE: + { char *sig = (char *)buf; - strcpy(sig, "savage.accelerant"); + strcpy(sig, "s3savage.accelerant"); result = B_OK; + break; } - break; /* PRIVATE ioctl from here on */ - case SAVAGE_GET_PRIVATE_DATA: { + case SAVAGE_GET_PRIVATE_DATA: + { SavageGetPrivateData *gpd = (SavageGetPrivateData *)buf; if (gpd->magic == SAVAGE_PRIVATE_DATA_MAGIC) { gpd->sharedInfoArea = di->sharedArea; result = B_OK; } + break; } - break; - case SAVAGE_GET_PCI: { + case SAVAGE_GET_PCI: + { SavageGetSetPci *gsp = (SavageGetSetPci *)buf; if (gsp->magic == SAVAGE_PRIVATE_DATA_MAGIC) { pci_info *pcii = &(di->pcii); gsp->value = get_pci(gsp->offset, gsp->size); result = B_OK; } + break; } - break; - case SAVAGE_SET_PCI: { + case SAVAGE_SET_PCI: + { SavageGetSetPci *gsp = (SavageGetSetPci *)buf; if (gsp->magic == SAVAGE_PRIVATE_DATA_MAGIC) { pci_info *pcii = &(di->pcii); set_pci(gsp->offset, gsp->size, gsp->value); result = B_OK; } + break; } - break; - case SAVAGE_DEVICE_NAME: { + case SAVAGE_DEVICE_NAME: + { SavageDeviceName *dn = (SavageDeviceName *)buf; if (dn->magic == SAVAGE_PRIVATE_DATA_MAGIC) { strcpy(dn->name, di->name); result = B_OK; } + break; } - break; - case SAVAGE_RUN_INTERRUPTS: { + case SAVAGE_RUN_INTERRUPTS: + { SavageSetBoolState *ri = (SavageSetBoolState *)buf; if (ri->magic == SAVAGE_PRIVATE_DATA_MAGIC) { if (ri->bEnable) { @@ -809,8 +795,8 @@ } } result = B_OK; + break; } - break; } return result; } From axeld at pinc-software.de Fri Jun 22 01:46:31 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 22 Jun 2007 01:46:31 +0200 CEST Subject: [Haiku-commits] r21482 - in haiku/trunk: headers/private/kernel src/system/kernel/vm In-Reply-To: <20070621233620.18066.6@stippis.WG> Message-ID: <32871077858-BeMail@zon> Stephan Assmus wrote: > > Modified: > > haiku/trunk/headers/private/kernel/vm_cache.h > > haiku/trunk/src/system/kernel/vm/vm.cpp > > haiku/trunk/src/system/kernel/vm/vm_cache.c > > Log: > > Ingo and I fixed a couple of VM bugs in a late night debugging > > session: > [...] > Exciting set of fixes! I know you said you were not done yet... but I > haven't > managed to freeze or panic Haiku after this patch, I launched all > included > apps at once several times and played around with them... so this is > a nice > improvement already! Just run GCC a couple of times and you'll easily get it done ;-) Bye, Axel. From axeld at mail.berlios.de Fri Jun 22 02:15:21 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 22 Jun 2007 02:15:21 +0200 Subject: [Haiku-commits] r21493 - in haiku/trunk: headers/private/mail src/kits/mail src/servers/mail Message-ID: <200706220015.l5M0FL2F020609@sheep.berlios.de> Author: axeld Date: 2007-06-22 02:15:17 +0200 (Fri, 22 Jun 2007) New Revision: 21493 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21493&view=rev Modified: haiku/trunk/headers/private/mail/status.h haiku/trunk/src/kits/mail/MailSettings.cpp haiku/trunk/src/kits/mail/StatusWindow.cpp haiku/trunk/src/servers/mail/deskbarview.cpp Log: * The Deskbar tray icon menu "Check Mail" and the status window "Check Now" button are now only enabled if there are any inbound accounts. * BMailSettings::StatusWindowFrame() now returns some useful defaults. * Minor cleanup. * The MDR kit needs some serious overhaul before it can be part of R1. Modified: haiku/trunk/headers/private/mail/status.h =================================================================== --- haiku/trunk/headers/private/mail/status.h 2007-06-21 23:38:53 UTC (rev 21492) +++ haiku/trunk/headers/private/mail/status.h 2007-06-22 00:15:17 UTC (rev 21493) @@ -1,15 +1,18 @@ +/* + * Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. + * Copyright 2004-2007, Haiku Inc. All rights reserved. + * + * Distributed under the terms of the MIT License. + */ #ifndef ZOIDBERG_STATUS_WINDOW_H #define ZOIDBERG_STATUS_WINDOW_H -/* StatusWindow - the status window while fetching/sending mails -** -** Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. -*/ -#include +#include #include #include -#include +#include +#include class BStatusBar; class BStringView; @@ -17,7 +20,7 @@ class BMailStatusWindow : public BWindow { public: - BMailStatusWindow(BRect rect, const char *name, uint32 show_when); + BMailStatusWindow(BRect rect, const char *name, uint32 showMode); ~BMailStatusWindow(); virtual void FrameMoved(BPoint origin); @@ -35,9 +38,12 @@ private: friend class BMailStatusView; + void _CheckChains(); void SetBorderStyle(int32 look); void ActuallyAddStatusView(BMailStatusView *status); + node_ref fChainDirectory; + BButton* fCheckNowButton; BList fStatusViews; uint32 fShowMode; BView *fDefaultView; @@ -47,7 +53,7 @@ int32 fWindowMoved; int32 fLastWorkspace; BRect fFrame; - + uint32 _reserved[5]; }; Modified: haiku/trunk/src/kits/mail/MailSettings.cpp =================================================================== --- haiku/trunk/src/kits/mail/MailSettings.cpp 2007-06-21 23:38:53 UTC (rev 21492) +++ haiku/trunk/src/kits/mail/MailSettings.cpp 2007-06-22 00:15:17 UTC (rev 21493) @@ -1,9 +1,15 @@ -/* BMailSettings - the mail daemon's settings -** -** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. -*/ +/* + * Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. + * Copyright 2004-2007, Haiku Inc. All rights reserved. + * + * Distributed under the terms of the MIT License. + */ +//! The mail daemon's settings + +#include + #include #include #include @@ -17,64 +23,175 @@ #include #include + class BMailSettings; namespace MailInternal { - status_t WriteMessageFile(const BMessage& archive, const BPath& path, const char* name); + status_t WriteMessageFile(const BMessage& archive, const BPath& path, + const char* name); } -#include +// #pragma mark - Chain methods + +// +// To do +// +BMailChain* +NewMailChain() +{ + // attempted solution: use time(NULL) and hope it's unique. Is there a better idea? + // note that two chains in two second is quite possible. how to fix this? + // maybe we could | in some bigtime_t as well. hrrm... + + // This is to fix a problem with generating the correct id for chains. + // Basically if the chains dir does not exist, the first time you create + // an account both the inbound and outbound chains will be called 0. + create_directory("/boot/home/config/settings/Mail/chains",0777); + + BPath path; + find_directory(B_USER_SETTINGS_DIRECTORY, &path); + path.Append("Mail/chains"); + BDirectory chain_dir(path.Path()); + BDirectory outbound_dir(&chain_dir,"outbound"), inbound_dir(&chain_dir,"inbound"); + + chain_dir.Lock(); //---------Try to lock the directory + + int32 id = -1; //-----When inc'ed, we start with 0---- + chain_dir.ReadAttr("last_issued_chain_id",B_INT32_TYPE,0,&id,sizeof(id)); + + BString string_id; + + do { + id++; + string_id = ""; + string_id << id; + } while ((outbound_dir.Contains(string_id.String())) + || (inbound_dir.Contains(string_id.String()))); + + chain_dir.WriteAttr("last_issued_chain_id",B_INT32_TYPE,0,&id,sizeof(id)); + + return new BMailChain(id); +} + + +BMailChain* +GetMailChain(uint32 id) +{ + return new BMailChain(id); +} + + +status_t +GetInboundMailChains(BList *list) +{ + BPath path; + status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path); + if (status != B_OK) { + fprintf(stderr, "Couldn't find user settings directory: %s\n", + strerror(status)); + return status; + } + + path.Append("Mail/chains/inbound"); + BDirectory chainDirectory(path.Path()); + entry_ref ref; + + while (chainDirectory.GetNextRef(&ref) == B_OK) { + char *end; + uint32 id = strtoul(ref.name, &end, 10); + + if (!end || *end == '\0') + list->AddItem((void*)new BMailChain(id)); + } + + return B_OK; +} + + +status_t +GetOutboundMailChains(BList *list) +{ + BPath path; + status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path); + if (status != B_OK) { + fprintf(stderr, "Couldn't find user settings directory: %s\n", + strerror(status)); + return status; + } + + path.Append("Mail/chains/outbound"); + BDirectory chainDirectory(path.Path()); + entry_ref ref; + + while (chainDirectory.GetNextRef(&ref) == B_OK) { + char *end; + uint32 id = strtoul(ref.name, &end, 10); + if (!end || *end == '\0') + list->AddItem((void*)new BMailChain(id)); + } + + return B_OK; +} + + +// #pragma mark - BMailSettings + + BMailSettings::BMailSettings() { Reload(); } + BMailSettings::~BMailSettings() { } -status_t BMailSettings::InitCheck() const + +status_t +BMailSettings::InitCheck() const { return B_OK; } -status_t BMailSettings::Save(bigtime_t /*timeout*/) +status_t +BMailSettings::Save(bigtime_t /*timeout*/) { status_t ret; // // Find chain-saving directory // - + BPath path; ret = find_directory(B_USER_SETTINGS_DIRECTORY, &path); - if (ret != B_OK) - { + if (ret != B_OK) { fprintf(stderr, "Couldn't find user settings directory: %s\n", strerror(ret)); return ret; } - + path.Append("Mail"); - + status_t result = MailInternal::WriteMessageFile(data,path,"new_mail_daemon"); if (result < B_OK) return result; - + BMessenger("application/x-vnd.Be-POST").SendMessage('mrrs'); - + return B_OK; } -status_t BMailSettings::Reload() + +status_t +BMailSettings::Reload() { status_t ret; BPath path; ret = find_directory(B_USER_SETTINGS_DIRECTORY, &path); - if (ret != B_OK) - { + if (ret != B_OK) { fprintf(stderr, "Couldn't find user settings directory: %s\n", strerror(ret)); return ret; @@ -85,8 +202,7 @@ // open BFile settings(path.Path(),B_READ_ONLY); ret = settings.InitCheck(); - if (ret != B_OK) - { + if (ret != B_OK) { fprintf(stderr, "Couldn't open settings file '%s': %s\n", path.Path(), strerror(ret)); return ret; @@ -95,8 +211,7 @@ // read settings BMessage tmp; ret = tmp.Unflatten(&settings); - if (ret != B_OK) - { + if (ret != B_OK) { fprintf(stderr, "Couldn't read settings from '%s': %s\n", path.Path(), strerror(ret)); return ret; @@ -108,169 +223,97 @@ } -// Chain methods +// # pragma mark - Global settings -// -// To do -// -_EXPORT BMailChain* NewMailChain() -{ - // attempted solution: use time(NULL) and hope it's unique. Is there a better idea? - // note that two chains in two second is quite possible. how to fix this? - // maybe we could | in some bigtime_t as well. hrrm... - // This is to fix a problem with generating the correct id for chains. - // Basically if the chains dir does not exist, the first time you create - // an account both the inbound and outbound chains will be called 0. - create_directory("/boot/home/config/settings/Mail/chains",0777); - - BPath path; - find_directory(B_USER_SETTINGS_DIRECTORY, &path); - path.Append("Mail/chains"); - BDirectory chain_dir(path.Path()); - BDirectory outbound_dir(&chain_dir,"outbound"), inbound_dir(&chain_dir,"inbound"); - - chain_dir.Lock(); //---------Try to lock the directory - - int32 id = -1; //-----When inc'ed, we start with 0---- - chain_dir.ReadAttr("last_issued_chain_id",B_INT32_TYPE,0,&id,sizeof(id)); - - BString string_id; - - do { - id++; - string_id = ""; - string_id << id; - } while ((outbound_dir.Contains(string_id.String())) || (inbound_dir.Contains(string_id.String()))); - - - chain_dir.WriteAttr("last_issued_chain_id",B_INT32_TYPE,0,&id,sizeof(id)); - - return new BMailChain(id); -} -// -// Done -// - -_EXPORT BMailChain* GetMailChain(uint32 id) +int32 +BMailSettings::WindowFollowsCorner() { - return new BMailChain(id); + return data.FindInt32("WindowFollowsCorner"); } -_EXPORT status_t GetInboundMailChains(BList *list) -{ - BPath path; - status_t ret = B_OK; - - ret = find_directory(B_USER_SETTINGS_DIRECTORY, &path); - if (ret != B_OK) - { - fprintf(stderr, "Couldn't find user settings directory: %s\n", - strerror(ret)); - return ret; - } - - path.Append("Mail/chains/inbound"); - BDirectory chain_dir(path.Path()); - entry_ref ref; - - while (chain_dir.GetNextRef(&ref)==B_OK) - { - char *end; - uint32 id = strtoul(ref.name, &end, 10); - - if (!end || *end == '\0') - list->AddItem((void*)new BMailChain(id)); - } - - return ret; -} -_EXPORT status_t GetOutboundMailChains(BList *list) +void +BMailSettings::SetWindowFollowsCorner(int32 which_corner) { - BPath path; - status_t ret = B_OK; - - ret = find_directory(B_USER_SETTINGS_DIRECTORY, &path); - if (ret != B_OK) - { - fprintf(stderr, "Couldn't find user settings directory: %s\n", - strerror(ret)); - return ret; - } - - path.Append("Mail/chains/outbound"); - BDirectory chain_dir(path.Path()); - entry_ref ref; - - while (chain_dir.GetNextRef(&ref)==B_OK) - { - char *end; - uint32 id = strtoul(ref.name, &end, 10); - if (!end || *end == '\0') - list->AddItem((void*)new BMailChain(id)); - } - - return ret; -} - - -// Global settings -int32 BMailSettings::WindowFollowsCorner() -{ - return data.FindInt32("WindowFollowsCorner"); -} -void BMailSettings::SetWindowFollowsCorner(int32 which_corner) -{ if (data.ReplaceInt32("WindowFollowsCorner",which_corner)) data.AddInt32("WindowFollowsCorner",which_corner); } -uint32 BMailSettings::ShowStatusWindow() + +uint32 +BMailSettings::ShowStatusWindow() { return data.FindInt32("ShowStatusWindow"); } -void BMailSettings::SetShowStatusWindow(uint32 mode) + + +void +BMailSettings::SetShowStatusWindow(uint32 mode) { if (data.ReplaceInt32("ShowStatusWindow",mode)) data.AddInt32("ShowStatusWindow",mode); } -bool BMailSettings::DaemonAutoStarts() + +bool +BMailSettings::DaemonAutoStarts() { return data.FindBool("DaemonAutoStarts"); } -void BMailSettings::SetDaemonAutoStarts(bool does_it) + + +void +BMailSettings::SetDaemonAutoStarts(bool does_it) { if (data.ReplaceBool("DaemonAutoStarts",does_it)) data.AddBool("DaemonAutoStarts",does_it); } -BRect BMailSettings::ConfigWindowFrame() + +BRect +BMailSettings::ConfigWindowFrame() { return data.FindRect("ConfigWindowFrame"); } -void BMailSettings::SetConfigWindowFrame(BRect frame) + + +void +BMailSettings::SetConfigWindowFrame(BRect frame) { if (data.ReplaceRect("ConfigWindowFrame",frame)) data.AddRect("ConfigWindowFrame",frame); } -BRect BMailSettings::StatusWindowFrame() + +BRect +BMailSettings::StatusWindowFrame() { - return data.FindRect("StatusWindowFrame"); + BRect frame; + if (data.FindRect("StatusWindowFrame", &frame) != B_OK) + return BRect(100, 100, 200, 120); + + return frame; } -void BMailSettings::SetStatusWindowFrame(BRect frame) + + +void +BMailSettings::SetStatusWindowFrame(BRect frame) { if (data.ReplaceRect("StatusWindowFrame",frame)) data.AddRect("StatusWindowFrame",frame); } -int32 BMailSettings::StatusWindowWorkspaces() + +int32 +BMailSettings::StatusWindowWorkspaces() { return data.FindInt32("StatusWindowWorkSpace"); } -void BMailSettings::SetStatusWindowWorkspaces(int32 workspace) + + +void +BMailSettings::SetStatusWindowWorkspaces(int32 workspace) { if (data.ReplaceInt32("StatusWindowWorkSpace",workspace)) data.AddInt32("StatusWindowWorkSpace",workspace); @@ -280,11 +323,16 @@ BMessenger("application/x-vnd.Be-POST").SendMessage(&msg); } -int32 BMailSettings::StatusWindowLook() + +int32 +BMailSettings::StatusWindowLook() { return data.FindInt32("StatusWindowLook"); } -void BMailSettings::SetStatusWindowLook(int32 look) + + +void +BMailSettings::SetStatusWindowLook(int32 look) { if (data.ReplaceInt32("StatusWindowLook",look)) data.AddInt32("StatusWindowLook",look); @@ -294,40 +342,64 @@ BMessenger("application/x-vnd.Be-POST").SendMessage(&msg); } -bigtime_t BMailSettings::AutoCheckInterval() { + +bigtime_t +BMailSettings::AutoCheckInterval() +{ bigtime_t value = B_INFINITE_TIMEOUT; data.FindInt64("AutoCheckInterval",&value); return value; } -void BMailSettings::SetAutoCheckInterval(bigtime_t interval) { + +void +BMailSettings::SetAutoCheckInterval(bigtime_t interval) +{ if (data.ReplaceInt64("AutoCheckInterval",interval)) data.AddInt64("AutoCheckInterval",interval); } -bool BMailSettings::CheckOnlyIfPPPUp() { + +bool +BMailSettings::CheckOnlyIfPPPUp() +{ return data.FindBool("CheckOnlyIfPPPUp"); } -void BMailSettings::SetCheckOnlyIfPPPUp(bool yes) { + +void +BMailSettings::SetCheckOnlyIfPPPUp(bool yes) +{ if (data.ReplaceBool("CheckOnlyIfPPPUp",yes)) data.AddBool("CheckOnlyIfPPPUp",yes); } -bool BMailSettings::SendOnlyIfPPPUp() { + +bool +BMailSettings::SendOnlyIfPPPUp() +{ return data.FindBool("SendOnlyIfPPPUp"); } -void BMailSettings::SetSendOnlyIfPPPUp(bool yes) { + +void +BMailSettings::SetSendOnlyIfPPPUp(bool yes) +{ if (data.ReplaceBool("SendOnlyIfPPPUp",yes)) data.AddBool("SendOnlyIfPPPUp",yes); } -uint32 BMailSettings::DefaultOutboundChainID() { + +uint32 +BMailSettings::DefaultOutboundChainID() +{ return data.FindInt32("DefaultOutboundChainID"); } -void BMailSettings::SetDefaultOutboundChainID(uint32 to) { + +void +BMailSettings::SetDefaultOutboundChainID(uint32 to) +{ if (data.ReplaceInt32("DefaultOutboundChainID",to)) data.AddInt32("DefaultOutboundChainID",to); } Modified: haiku/trunk/src/kits/mail/StatusWindow.cpp =================================================================== --- haiku/trunk/src/kits/mail/StatusWindow.cpp 2007-06-21 23:38:53 UTC (rev 21492) +++ haiku/trunk/src/kits/mail/StatusWindow.cpp 2007-06-22 00:15:17 UTC (rev 21493) @@ -1,58 +1,58 @@ -/* BMailStatusWindow - the status window while fetching/sending mails -** -** Copyright (c) 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. -*/ +/* + * Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. + * Copyright 2004-2007, Haiku Inc. All rights reserved. + * + * Distributed under the terms of the MIT License. + */ +//! The status window while fetching/sending mails + +#include "status.h" +#include "MailSettings.h" + +#include + #include #include #include -#include +#include +#include +#include +#include +#include +#include +#include #include +#include #include -#include -#include -#include -#include +#include #include #include -class _EXPORT BMailStatusWindow; -class _EXPORT BMailStatusView; -#include "status.h" -#include "MailSettings.h" - -#include - -/*------------------------------------------------ - -BMailStatusWindow - -------------------------------------------------*/ - static BLocker sLock; -BMailStatusWindow::BMailStatusWindow(BRect rect, const char *name, uint32 s) +BMailStatusWindow::BMailStatusWindow(BRect rect, const char *name, uint32 showMode) : BWindow(rect, name, B_MODAL_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, - B_NOT_CLOSABLE | B_NO_WORKSPACE_ACTIVATION | B_NOT_V_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE), - fShowMode(s), + B_NOT_CLOSABLE | B_NO_WORKSPACE_ACTIVATION | B_NOT_V_RESIZABLE + | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE), + fShowMode(showMode), fWindowMoved(0L) { BRect frame(Bounds()); frame.InsetBy(90.0 + 5.0, 5.0); - BButton *button = new BButton(frame, "check_mail", - MDR_DIALECT_CHOICE ("Check Mail Now","???????"), - new BMessage('mbth'), B_FOLLOW_LEFT_RIGHT, - B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_NAVIGABLE); - button->ResizeToPreferred(); - frame = button->Frame(); + fCheckNowButton = new BButton(frame, "check_mail", + MDR_DIALECT_CHOICE ("Check Mail Now","???????"), + new BMessage('mbth'), B_FOLLOW_LEFT_RIGHT, + B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_NAVIGABLE); + fCheckNowButton->ResizeToPreferred(); + frame = fCheckNowButton->Frame(); - button->ResizeTo(button->Bounds().Width(),25); - button->SetTarget(be_app_messenger); + fCheckNowButton->SetTarget(be_app_messenger); frame.OffsetBy(0.0, frame.Height()); frame.InsetBy(-90.0, 0.0); @@ -63,17 +63,17 @@ fMessageView->SetText(MDR_DIALECT_CHOICE ("No new messages.","?????????????")); float framewidth = frame.Width(); fMessageView->ResizeToPreferred(); - fMessageView->ResizeTo(framewidth,fMessageView->Bounds().Height()); + fMessageView->ResizeTo(framewidth, fMessageView->Bounds().Height()); frame = fMessageView->Frame(); frame.InsetBy(-5.0, -5.0); frame.top = 0.0; - fDefaultView = new BBox(frame, "default_view", B_FOLLOW_LEFT_RIGHT, - B_WILL_DRAW|B_FRAME_EVENTS|B_NAVIGABLE_JUMP, B_PLAIN_BORDER); + fDefaultView = new BView(frame, "default_view", B_FOLLOW_LEFT_RIGHT, + B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP); fDefaultView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - fDefaultView->AddChild(button); + fDefaultView->AddChild(fCheckNowButton); fDefaultView->AddChild(fMessageView); fMinWidth = fDefaultView->Bounds().Width(); @@ -95,7 +95,7 @@ ResizeBy(x_off_set, y_off_set); fDefaultView->ResizeBy(x_off_set, y_off_set); - button->ResizeBy(x_off_set, y_off_set); + fCheckNowButton->ResizeBy(x_off_set, y_off_set); fMessageView->ResizeBy(x_off_set, y_off_set); } } @@ -115,8 +115,22 @@ fFrame = Frame(); + BPath path; + status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path); + if (status == B_OK) { + path.Append("Mail/chains/inbound"); + create_directory(path.Path(), 0755); + BDirectory chainDirectory(path.Path()); + if (chainDirectory.GetNodeRef(&fChainDirectory) == B_OK) { + // Watch this directory for changes + watch_node(&fChainDirectory, B_WATCH_DIRECTORY, this); + _CheckChains(); + } + } + if (fShowMode != B_MAIL_SHOW_STATUS_WINDOW_ALWAYS) Hide(); + Show(); } @@ -134,10 +148,25 @@ general.SetStatusWindowWorkspaces((int32)Workspaces()); general.Save(); } + + stop_watching(this); } +//! Activate the "Check Now" button only if there are inbound accounts void +BMailStatusWindow::_CheckChains() +{ + BDirectory directory(&fChainDirectory); + + entry_ref ref; + bool isEmpty = directory.GetNextRef(&ref) != B_OK; + + fCheckNowButton->SetEnabled(!isEmpty); +} + + +void BMailStatusWindow::FrameMoved(BPoint /*origin*/) { if (fLastWorkspace == current_workspace()) @@ -190,6 +219,10 @@ be_roster->Launch(B_MAIL_TYPE, msg); break; + case B_NODE_MONITOR: + _CheckChains(); + break; + default: BWindow::MessageReceived(msg); } Modified: haiku/trunk/src/servers/mail/deskbarview.cpp =================================================================== --- haiku/trunk/src/servers/mail/deskbarview.cpp 2007-06-21 23:38:53 UTC (rev 21492) +++ haiku/trunk/src/servers/mail/deskbarview.cpp 2007-06-22 00:15:17 UTC (rev 21493) @@ -1,7 +1,7 @@ /* DeskbarView - main_daemon's deskbar menu and view -** -** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. -*/ + * + * Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved. + */ #include @@ -279,23 +279,25 @@ } } -void DeskbarView::ChangeIcon(int32 icon) + +void +DeskbarView::ChangeIcon(int32 icon) { - if(fCurrentIconState == icon) + if (fCurrentIconState == icon) return; - + BBitmap *newIcon(NULL); image_info info; - if (our_image(&info) == B_OK) - { - BFile file(info.name,B_READ_ONLY); + if (our_image(&info) == B_OK) { + BFile file(info.name, B_READ_ONLY); if (file.InitCheck() < B_OK) goto err; BResources rsrc(&file); size_t len; - const void *data = rsrc.LoadResource('BBMP',icon == NEW_MAIL ? "New" : "Read",&len); + const void *data = rsrc.LoadResource('BBMP', icon == NEW_MAIL + ? "New" : "Read",&len); if (len == 0) goto err; @@ -305,8 +307,7 @@ if (archive.Unflatten(&stream) != B_OK) goto err; newIcon = new BBitmap(&archive); - } - else + } else fputs("no image!", stderr); err: @@ -316,12 +317,16 @@ Invalidate(); } -void DeskbarView::Pulse() + +void +DeskbarView::Pulse() { - // Check if mail_daemon is still running + // TODO: Check if mail_daemon is still running } -void DeskbarView::MouseUp(BPoint pos) + +void +DeskbarView::MouseUp(BPoint pos) { if (fLastButtons & B_PRIMARY_MOUSE_BUTTON) { if (OpenFolder("mail/mailbox") != B_OK) @@ -334,22 +339,27 @@ BMailDaemon::CheckMail(true); } -void DeskbarView::MouseDown(BPoint pos) + +void +DeskbarView::MouseDown(BPoint pos) { Looper()->CurrentMessage()->FindInt32("buttons",&fLastButtons); Looper()->CurrentMessage()->PrintToStream(); - if (fLastButtons & B_SECONDARY_MOUSE_BUTTON) - { + if (fLastButtons & B_SECONDARY_MOUSE_BUTTON) { ConvertToScreen(&pos); - + BPopUpMenu *menu = BuildMenu(); - if (menu) - menu->Go(pos,true,true,BRect(pos.x - 2, pos.y - 2, pos.x + 2, pos.y + 2),true); + if (menu) { + menu->Go(pos, true, true, BRect(pos.x - 2, pos.y - 2, + pos.x + 2, pos.y + 2), true); + } } } -bool DeskbarView::CreateMenuLinks(BDirectory &directory,BPath &path) + +bool +DeskbarView::CreateMenuLinks(BDirectory &directory,BPath &path) { status_t status = directory.SetTo(path.Path()); if (status == B_OK) @@ -366,23 +376,23 @@ || directory.CreateDirectory(path.Leaf(), NULL) < B_OK || directory.SetTo(path.Path()) < B_OK) return false; - + BPath targetPath; find_directory(B_USER_DIRECTORY, &targetPath); targetPath.Append("mail/in"); - - directory.CreateSymLink("Open Inbox Folder",targetPath.Path(),NULL); + + directory.CreateSymLink("Open Inbox Folder", targetPath.Path(), NULL); targetPath.GetParent(&targetPath); - directory.CreateSymLink("Open Mail Folder",targetPath.Path(),NULL); + directory.CreateSymLink("Open Mail Folder", targetPath.Path(), NULL); // create the draft query - + BFile file; - if (directory.CreateFile("Open Draft",&file) < B_OK) + if (directory.CreateFile("Open Draft", &file) < B_OK) return true; BString string("MAIL:draft==1"); - file.WriteAttrString("_trk/qrystr",&string); + file.WriteAttrString("_trk/qrystr", &string); string = "E-mail"; file.WriteAttrString("_trk/qryinitmime", &string); BNodeInfo(&file).SetType("application/x-vnd.Be-query"); @@ -390,14 +400,17 @@ return true; } -void DeskbarView::CreateNewMailQuery(BEntry &query) + +void +DeskbarView::CreateNewMailQuery(BEntry &query) { BFile file(&query, B_READ_WRITE | B_CREATE_FILE); - if(file.InitCheck() != B_OK) + if (file.InitCheck() != B_OK) return; - BString string("((" B_MAIL_ATTR_STATUS "==\"[nN][eE][wW]\")&&((BEOS:TYPE==\"text/x-email\")||(BEOS:TYPE==\"text/x-partial-email\")))"); - file.WriteAttrString("_trk/qrystr",&string); + BString string("((" B_MAIL_ATTR_STATUS "==\"[nN][eE][wW]\")&&((BEOS:TYPE==" + "\"text/x-email\")||(BEOS:TYPE==\"text/x-partial-email\")))"); + file.WriteAttrString("_trk/qrystr", &string); string = "E-mail"; file.WriteAttrString("_trk/qryinitmime", &string); BNodeInfo(&file).SetType("application/x-vnd.Be-query"); @@ -407,9 +420,9 @@ BPopUpMenu * DeskbarView::BuildMenu() { - BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING,false,false); + BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false); menu->SetFont(be_plain_font); - + menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE ( "Create New Message","N) ?????????")B_UTF8_ELLIPSIS, new BMessage(MD_OPEN_NEW))); @@ -424,14 +437,12 @@ BPath path; find_directory(B_USER_SETTINGS_DIRECTORY, &path); path.Append("Mail/Menu Links"); - + BDirectory directory; - if (CreateMenuLinks(directory,path)) - { + if (CreateMenuLinks(directory, path)) { int32 count = 0; - while (directory.GetNextRef(&ref) == B_OK) - { + while (directory.GetNextRef(&ref) == B_OK) { count++; path.SetTo(&ref); @@ -442,12 +453,10 @@ // we are using the NavMenu only for directories and queries bool useNavMenu = false; - if (entry.InitCheck() == B_OK) - { + if (entry.InitCheck() == B_OK) { if (entry.IsDirectory()) useNavMenu = true; - else if (entry.IsFile()) - { + else if (entry.IsFile()) { [... truncated: 153 lines follow ...] From stefano.ceccherini at gmail.com Fri Jun 22 09:27:59 2007 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Fri, 22 Jun 2007 09:27:59 +0200 Subject: [Haiku-commits] r21465 - in haiku/trunk: headers/private/interface src/kits/interface In-Reply-To: <894b9700706210030x445effc2s5e1cad62485eb91e@mail.gmail.com> References: <200706192309.l5JN929X005644@sheep.berlios.de> <894b9700706200035s19c47ebek3c422ca85cc853f1@mail.gmail.com> <20070620134755.5973.3@cs.tu-berlin.de> <894b9700706210030x445effc2s5e1cad62485eb91e@mail.gmail.com> Message-ID: <894b9700706220027q63557edcw7aae2eae97a5e819@mail.gmail.com> 2007/6/21, Stefano Ceccherini : > 2007/6/20, Ingo Weinhold : > > > It's the standard menu bar behavior. If you click in the area to the right > > of the rightmost menu, nothing shall happen. I suppose one would have to Can you retest this after r21487 ? From korli at users.berlios.de Fri Jun 22 10:49:57 2007 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Fri, 22 Jun 2007 10:49:57 +0200 Subject: [Haiku-commits] r21492 - in haiku/trunk: headers/private/graphics/s3savage src/add-ons/accelerants/s3savage src/add-ons/kernel/drivers/graphics/s3savage In-Reply-To: <200706212338.l5LNcsGu017825@sheep.berlios.de> References: <200706212338.l5LNcsGu017825@sheep.berlios.de> Message-ID: 2007/6/22, axeld at BerliOS : > > Log: > * Korli renamed the driver, but forgot to let the driver ask for the new > accelerant name. > Sorry for the trouble. I had no indication on the place for this driver. Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From korli at users.berlios.de Fri Jun 22 10:54:06 2007 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Fri, 22 Jun 2007 10:54:06 +0200 Subject: [Haiku-commits] r21493 - in haiku/trunk: headers/private/mail src/kits/mail src/servers/mail In-Reply-To: <200706220015.l5M0FL2F020609@sheep.berlios.de> References: <200706220015.l5M0FL2F020609@sheep.berlios.de> Message-ID: 2007/6/22, axeld at BerliOS : > > * The MDR kit needs some serious overhaul before it can be part of R1. > > What does this mean ? Open bugs ? If no bug is open, we could ask testers to testbed it some more. Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From axeld at pinc-software.de Fri Jun 22 11:02:50 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 22 Jun 2007 11:02:50 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r21492_-_in_haiku/trunk=3A_header?= =?iso-8859-15?q?s/private/graphics/s3savage__src/add-ons/accelerants/s3sa?= =?iso-8859-15?q?vage_src/add-ons/kernel/drivers/graphics/s3savage?= In-Reply-To: Message-ID: <950887859-BeMail@zon> "J?r?me Duval" wrote: > 2007/6/22, axeld at BerliOS : > > Log: > > * Korli renamed the driver, but forgot to let the driver ask for > > the new > > accelerant name. > Sorry for the trouble. I had no indication on the place for this > driver. No problem; it's not that obvious, anyway. Bye, Axel. From axeld at pinc-software.de Fri Jun 22 11:05:38 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 22 Jun 2007 11:05:38 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r21493_-_in_haiku/trunk=3A_header?= =?iso-8859-15?q?s/private/mail_src/kits/mail_src/servers/mail?= In-Reply-To: Message-ID: <1118591756-BeMail@zon> "J?r?me Duval" wrote: > 2007/6/22, axeld at BerliOS : > > * The MDR kit needs some serious overhaul before it can be part of > > R1. > What does this mean ? Open bugs ? If no bug is open, we could ask > testers to > testbed it some more. Not just bugs; it also clobbers the public namespace with a lot of useless classes. I also think it exports too much of its inner workings so that we might get into trouble once we want to improve upon the current architecture. Bye, Axel. From revol at free.fr Fri Jun 22 15:11:52 2007 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Fri, 22 Jun 2007 15:11:52 +0200 CEST Subject: [Haiku-commits] r21484 - haiku/trunk/src/bin In-Reply-To: <200706211840.l5LIeXbr012583@sheep.berlios.de> Message-ID: <462933661-BeMail@laptop> > Author: korli > Date: 2007-06-21 20:40:33 +0200 (Thu, 21 Jun 2007) > New Revision: 21484 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21484&view=rev > > Modified: > haiku/trunk/src/bin/mimeset.cpp > Log: > actually exit with an error when it happens It's better to return 1 on error, or 2, 3.. The 32 bits are cut to 16, because the top 16 bits are used to tell the cause (signal, ...), so returning a status_t is meaningless. Fran?ois. From korli at users.berlios.de Fri Jun 22 15:21:47 2007 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Fri, 22 Jun 2007 15:21:47 +0200 Subject: [Haiku-commits] r21484 - haiku/trunk/src/bin In-Reply-To: <462933661-BeMail@laptop> References: <200706211840.l5LIeXbr012583@sheep.berlios.de> <462933661-BeMail@laptop> Message-ID: 2007/6/22, Fran?ois Revol : > > > actually exit with an error when it happens > > It's better to return 1 on error, or 2, 3.. I agree completely, I thought about it afterwards, and had another issue. Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From korli at mail.berlios.de Fri Jun 22 18:23:51 2007 From: korli at mail.berlios.de (korli at BerliOS) Date: Fri, 22 Jun 2007 18:23:51 +0200 Subject: [Haiku-commits] r21494 - haiku/trunk/src/bin Message-ID: <200706221623.l5MGNpRn015588@sheep.berlios.de> Author: korli Date: 2007-06-22 18:23:51 +0200 (Fri, 22 Jun 2007) New Revision: 21494 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21494&view=rev Modified: haiku/trunk/src/bin/mimeset.cpp Log: exit with 1 when an error occurs Modified: haiku/trunk/src/bin/mimeset.cpp =================================================================== --- haiku/trunk/src/bin/mimeset.cpp 2007-06-22 00:15:17 UTC (rev 21493) +++ haiku/trunk/src/bin/mimeset.cpp 2007-06-22 16:23:51 UTC (rev 21494) @@ -67,7 +67,7 @@ // parse arguments if (argc < 2) - usage(-1); + usage(1); while (*++argv) { char *arg = *argv; @@ -87,7 +87,7 @@ usage(0); else { fprintf(stderr, "unknown option \"%s\"\n", arg); - usage(-1); + usage(1); } } @@ -95,7 +95,6 @@ BApplication app("application/x-vnd.haiku.mimeset"); - int err = 0; while (*argv) { char *arg = *argv++; @@ -105,14 +104,12 @@ while (fgets(name, sizeof(name), stdin) != NULL) { name[strlen(name) - 1] = '\0'; // remove trailing '\n' - err = process_file(name); - if (err) - exit(err); + if (process_file(name) != B_OK) + exit(1); } } else { - err = process_file(arg); - if (err) - exit(err); + if (process_file(arg) != B_OK) + exit(1); } } From bonefish at cs.tu-berlin.de Fri Jun 22 23:28:50 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Fri, 22 Jun 2007 23:28:50 +0200 Subject: [Haiku-commits] r21465 - in haiku/trunk: headers/private/interface src/kits/interface In-Reply-To: <894b9700706220027q63557edcw7aae2eae97a5e819@mail.gmail.com> References: <200706192309.l5JN929X005644@sheep.berlios.de> <894b9700706200035s19c47ebek3c422ca85cc853f1@mail.gmail.com> <20070620134755.5973.3@cs.tu-berlin.de> <894b9700706210030x445effc2s5e1cad62485eb91e@mail.gmail.com> <894b9700706220027q63557edcw7aae2eae97a5e819@mail.gmail.com> Message-ID: <20070622232850.2889.6@cs.tu-berlin.de> On 2007-06-22 at 09:27:59 [+0200], Stefano Ceccherini wrote: > 2007/6/21, Stefano Ceccherini : > > 2007/6/20, Ingo Weinhold : > > > > > It's the standard menu bar behavior. If you click in the area to the > > > right > > > of the rightmost menu, nothing shall happen. I suppose one would have to > > Can you retest this after r21487 ? It doesn't change anything in this respect. CU, Ingo From bonefish at cs.tu-berlin.de Fri Jun 22 23:40:00 2007 From: bonefish at cs.tu-berlin.de (Ingo Weinhold) Date: Fri, 22 Jun 2007 23:40:00 +0200 Subject: [Haiku-commits] r21465 - in haiku/trunk: headers/private/interface src/kits/interface In-Reply-To: <20070622232850.2889.6@cs.tu-berlin.de> References: <200706192309.l5JN929X005644@sheep.berlios.de> <894b9700706200035s19c47ebek3c422ca85cc853f1@mail.gmail.com> <20070620134755.5973.3@cs.tu-berlin.de> <894b9700706210030x445effc2s5e1cad62485eb91e@mail.gmail.com> <894b9700706220027q63557edcw7aae2eae97a5e819@mail.gmail.com> <20070622232850.2889.6@cs.tu-berlin.de> Message-ID: <20070622234000.3145.7@cs.tu-berlin.de> On 2007-06-22 at 23:28:50 [+0200], Ingo Weinhold wrote: > On 2007-06-22 at 09:27:59 [+0200], Stefano Ceccherini > wrote: > > 2007/6/21, Stefano Ceccherini : > > > 2007/6/20, Ingo Weinhold : > > > > > > > It's the standard menu bar behavior. If you click in the area to the > > > > right > > > > of the rightmost menu, nothing shall happen. I suppose one would have > > > > to > > > > Can you retest this after r21487 ? > > It doesn't change anything in this respect. Oh, BTW, if you want to test it yourself, you can just replace the implementation of _BMCMenuBar_::MaxSize() by: return BMenuBar::MaxSize(); And add LayoutTest1 to your haiku image/installation (or compile it for the test environment). The last test in the list contains a few menu fields which allow you to reproduce the problem. CU, Ingo From bonefish at mail.berlios.de Fri Jun 22 23:52:53 2007 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 22 Jun 2007 23:52:53 +0200 Subject: [Haiku-commits] r21495 - haiku/trunk/src/kits/interface Message-ID: <200706222152.l5MLqrwo017687@sheep.berlios.de> Author: bonefish Date: 2007-06-22 23:52:53 +0200 (Fri, 22 Jun 2007) New Revision: 21495 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21495&view=rev Modified: haiku/trunk/src/kits/interface/MenuField.cpp Log: * ceilf() both font ascent and descent individually before adding them up to compute the vertical space requirement of the label. * Use a better algorithm for vertically aligning the label. The menu bar (or item) seems to use another algorithm. So, ATM the label is not necessarily aligned with the menu bar text. Modified: haiku/trunk/src/kits/interface/MenuField.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuField.cpp 2007-06-22 16:23:51 UTC (rev 21494) +++ haiku/trunk/src/kits/interface/MenuField.cpp 2007-06-22 21:52:53 UTC (rev 21495) @@ -790,8 +790,11 @@ break; } - // vertical alignment -- center the ascent - float y = floor((Bounds().Height() + fh.ascent) / 2); + // vertical alignment + float y = Bounds().top + + (Bounds().Height() + 1 - fh.ascent - fh.descent) / 2 + + fh.ascent; + y = floor(y + 0.5); SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), IsEnabled() ? B_DARKEN_MAX_TINT : B_DISABLED_LABEL_TINT)); @@ -905,7 +908,7 @@ GetFontHeight(&fh); fLayoutData->label_width = (Label() ? ceilf(StringWidth(Label())) : 0); - fLayoutData->label_height = ceilf(fh.ascent + fh.descent); + fLayoutData->label_height = ceilf(fh.ascent) + ceilf(fh.descent); // compute the minimal divider float divider = 0; From mmlr at mail.berlios.de Sat Jun 23 23:48:34 2007 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 23 Jun 2007 23:48:34 +0200 Subject: [Haiku-commits] r21496 - haiku/trunk/src/add-ons/tracker/filetype Message-ID: <200706232148.l5NLmYCk000862@sheep.berlios.de> Author: mmlr Date: 2007-06-23 23:48:34 +0200 (Sat, 23 Jun 2007) New Revision: 21496 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21496&view=rev Modified: haiku/trunk/src/add-ons/tracker/filetype/FileType.rdef Log: Uncomment signature and flags of FileType add-on to fix bug #1280. Modified: haiku/trunk/src/add-ons/tracker/filetype/FileType.rdef =================================================================== --- haiku/trunk/src/add-ons/tracker/filetype/FileType.rdef 2007-06-22 21:52:53 UTC (rev 21495) +++ haiku/trunk/src/add-ons/tracker/filetype/FileType.rdef 2007-06-23 21:48:34 UTC (rev 21496) @@ -2,8 +2,8 @@ * FileType.rdef */ -//resource app_signature "application/x-vnd.Haiku-FileType"; -//resource app_flags B_MULTIPLE_LAUNCH; +resource app_signature "application/x-vnd.Haiku-FileType"; +resource app_flags B_MULTIPLE_LAUNCH; resource file_types message { "types" = "application/x-be-resource", From marcusoverhagen at mail.berlios.de Sun Jun 24 01:17:58 2007 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 24 Jun 2007 01:17:58 +0200 Subject: [Haiku-commits] r21497 - haiku/trunk/src/apps/mediaplayer Message-ID: <200706232317.l5NNHw4K004122@sheep.berlios.de> Author: marcusoverhagen Date: 2007-06-24 01:17:57 +0200 (Sun, 24 Jun 2007) New Revision: 21497 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21497&view=rev Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp Log: ck a dull boy All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/Controller.cpp 2007-06-23 21:48:34 UTC (rev 21496) +++ haiku/trunk/src/apps/mediaplayer/Controller.cpp 2007-06-23 23:17:57 UTC (rev 21497) @@ -30,6 +30,7 @@ #include #include #include +#include // for debugging only #include "ControllerView.h" #include "PlaybackState.h" @@ -220,6 +221,8 @@ fStopped = fAutoplay ? false : true; fPauseAtEndOfStream = false; fSeekToStartAfterPause = false; + fTimeSourceSysTime = system_time(); + fTimeSourcePerfTime = 0; fDuration = 0; _UpdatePosition(0); @@ -804,14 +807,6 @@ if (!fDataLock.Lock()) return; - // TODO: fix performance time update (in case no audio) - if (fTimeSourceLock.Lock()) { - fTimeSourceSysTime = system_time() + audioLatency - bufferDuration; - fTimeSourceLock.Unlock(); - } -// printf("timesource: sys: %Ld perf: %Ld\n", fTimeSourceSysTime, -// fTimeSourcePerfTime); - if (buffer->sizeUsed == 0) { bool pause = fPauseAtEndOfStream && buffer->endOfStream; fDataLock.Unlock(); @@ -841,12 +836,22 @@ } } + // TODO: fix performance time update (in case no audio) + if (fTimeSourceLock.Lock()) { + audioLatency = fSoundOutput->Latency(); + fTimeSourceSysTime = system_time() + audioLatency - bufferDuration; + fTimeSourcePerfTime = buffer->startTime; + fTimeSourceLock.Unlock(); + } +// printf("timesource: sys: %Ld perf: %Ld\n", fTimeSourceSysTime, +// fTimeSourcePerfTime); + if (fSoundOutput) { fSoundOutput->Play(buffer->buffer, buffer->sizeUsed); - audioLatency = fSoundOutput->Latency(); _UpdatePosition(buffer->startTime); } + fDataLock.Unlock(); release_sem(fAudioDecodeSem); @@ -985,31 +990,49 @@ goto wait; } -#if 0 bigtime_t waituntil; bigtime_t waitdelta; + bigtime_t now; + if (fTimeSourceLock.Lock()) { + now = system_time(); + waituntil = fTimeSourceSysTime - fTimeSourcePerfTime + buffer->startTime - 1000; + waitdelta = waituntil - now; + fTimeSourceLock.Unlock(); + } else { + // puhh... + } + +#if 0 char test[100]; - { - BAutolock lock(fTimeSourceLock); - - waituntil = fTimeSourceSysTime - fTimeSourcePerfTime + buffer->startTime; - waitdelta = waituntil - system_time(); - sprintf(test, "sys %.6f perf %.6f, vid %.6f, waituntil %.6f, waitdelta %.6f", - fTimeSourceSysTime / 1000000.0f, - fTimeSourcePerfTime / 1000000.0f, - buffer->startTime / 1000000.0f, - waituntil / 1000000.0f, - waitdelta / 1000000.0f); - } + sprintf(test, "sys %.6f perf %.6f, vid %.6f, now %.6f, waituntil %.6f, waitdelta %.6f", + fTimeSourceSysTime / 1E6, fTimeSourcePerfTime / 1E6, + buffer->startTime / 1E6, now / 1E6, + waituntil / 1E6, waitdelta / 1E6); if (fVideoView->LockLooperWithTimeout(5000) == B_OK) { fVideoView->Window()->SetTitle(test); fVideoView->UnlockLooper(); } -#else - bigtime_t waituntil; - waituntil = fTimeSourceSysTime - fTimeSourcePerfTime + buffer->startTime; #endif + if (fAudioSupplierLock.Lock()) { + if (!fAudioSupplier) { + fTimeSourceSysTime = system_time(); + fTimeSourcePerfTime = buffer->startTime; + } + fAudioSupplierLock.Unlock(); + } else { + // puhh... + } + + +#if 1 + if (waitdelta < -150000) { + printf("video: frame %.6f too late, dropped\n", waitdelta / -1E6); + release_sem(fVideoDecodeSem); + continue; + } +#endif + status = acquire_sem_etc(fVideoWaitSem, 1, B_ABSOLUTE_TIMEOUT, waituntil); if (status == B_OK) { // interrupted by seeking printf("video: video wait interruped\n"); @@ -1039,8 +1062,9 @@ fPauseAtEndOfStream = false; fSeekToStartAfterPause = true; Pause(); - } else - snooze(25000); + } +//else +// snooze(25000); continue; } } else @@ -1051,7 +1075,7 @@ // snooze(60000); release_sem(fVideoDecodeSem); } - + // status_t status = acquire_sem_etc(fVideoWaitSem, 1, B_ABSOLUTE_TIMEOUT, buffer->startTime); // if (status != B_TIMED_OUT) // return; @@ -1151,8 +1175,8 @@ if (isVideoPosition && fAudioSupplier) return; - BAutolock _(fTimeSourceLock); - fTimeSourcePerfTime = position; +// BAutolock _(fTimeSourceLock); +// fTimeSourcePerfTime = position; fPosition = position; float scale = fDuration > 0 ? (float)fPosition / fDuration : 0.0; From marcusoverhagen at mail.berlios.de Sun Jun 24 01:35:26 2007 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 24 Jun 2007 01:35:26 +0200 Subject: [Haiku-commits] r21498 - haiku/trunk/src/add-ons/media/plugins/avi_reader Message-ID: <200706232335.l5NNZQDf021681@sheep.berlios.de> Author: marcusoverhagen Date: 2007-06-24 01:35:26 +0200 (Sun, 24 Jun 2007) New Revision: 21498 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21498&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp Log: better error handling Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp 2007-06-23 23:17:57 UTC (rev 21497) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp 2007-06-23 23:35:26 UTC (rev 21498) @@ -29,6 +29,7 @@ #include #include #include +#include #include "RawFormats.h" #include "avi_reader.h" @@ -107,7 +108,11 @@ TRACE("aviReader::Sniff: this stream seems to be supported\n"); - fFile = new OpenDMLFile(pos_io_source); + fFile = new(std::nothrow) OpenDMLFile(pos_io_source); + if (!fFile) { + ERROR("aviReader::Sniff: out of memory\n"); + return B_NO_MEMORY; + } if (fFile->Init() < B_OK) { ERROR("aviReader::Sniff: can't setup OpenDMLFile\n"); return B_ERROR; @@ -135,7 +140,9 @@ status_t aviReader::AllocateCookie(int32 streamNumber, void **_cookie) { - avi_cookie *cookie = new avi_cookie; + avi_cookie *cookie = new(std::nothrow) avi_cookie; + if (!cookie) + return B_NO_MEMORY; *_cookie = cookie; cookie->stream = streamNumber; @@ -173,8 +180,7 @@ cookie->frames_per_sec_rate = fFile->StreamInfo(streamNumber)->frames_per_sec_rate; cookie->frames_per_sec_scale = fFile->StreamInfo(streamNumber)->frames_per_sec_scale; - TRACE("audio frame_count %Ld\n", cookie->frame_count); - TRACE("audio duration %.6f (%Ld)\n", cookie->duration / 1E6, cookie->duration); + TRACE("audio frame_count %Ld, duration %.6f\n", cookie->frame_count, cookie->duration / 1E6); if (audio_format->format_tag == 0x0001) { // a raw PCM format @@ -206,9 +212,12 @@ if (formats.GetFormatFor(description, format) < B_OK) format->type = B_MEDIA_ENCODED_AUDIO; format->u.encoded_audio.bit_rate = 8 * audio_format->avg_bytes_per_sec; - TRACE("bit_rate %.3f\n", format->u.encoded_audio.bit_rate); format->u.encoded_audio.output.frame_rate = audio_format->frames_per_sec; format->u.encoded_audio.output.channel_count = audio_format->channels; + TRACE("audio: bit_rate %.3f, frame_rate %.1f, channel_count %lu\n", + format->u.encoded_audio.bit_rate, + format->u.encoded_audio.output.frame_rate, + format->u.encoded_audio.output.channel_count); } // TODO: this doesn't seem to work (it's not even a fourcc) format->user_data_type = B_CODEC_TYPE_INFO; @@ -244,8 +253,7 @@ cookie->frames_per_sec_scale = fFile->StreamInfo(streamNumber)->frames_per_sec_scale; cookie->line_count = fFile->AviMainHeader()->height; - TRACE("video frame_count %Ld\n", cookie->frame_count); - TRACE("video duration %.6f (%Ld)\n", cookie->duration / 1E6, cookie->duration); + TRACE("video frame_count %Ld, duration %.6f\n", cookie->frame_count, cookie->duration / 1E6); description.family = B_AVI_FORMAT_FAMILY; if (stream_header->fourcc_handler == 'ekaf' || stream_header->fourcc_handler == 0) // 'fake' or 0 fourcc => used compression id @@ -347,14 +355,18 @@ return B_LAST_BUFFER_ERROR; if (size > 0x200000) { // 2 MB - ERROR("stream %d: frame too big: %u byte\n", size); + ERROR("stream %u: frame too big: %u byte\n", cookie->stream, size); return B_NO_MEMORY; } if (cookie->buffer_size < size) { delete [] cookie->buffer; cookie->buffer_size = (size + 15) & ~15; - cookie->buffer = new char [cookie->buffer_size]; + cookie->buffer = new(std::nothrow) char [cookie->buffer_size]; + if (!cookie->buffer) { + cookie->buffer_size = 0; + return B_NO_MEMORY; + } } mediaHeader->start_time = (cookie->frame_pos * 1000000 * cookie->frames_per_sec_scale) / cookie->frames_per_sec_rate; @@ -386,11 +398,11 @@ Reader * aviReaderPlugin::NewReader() { - return new aviReader; + return new(std::nothrow) aviReader; } MediaPlugin *instantiate_plugin() { - return new aviReaderPlugin; + return new(std::nothrow) aviReaderPlugin; } From marcusoverhagen at mail.berlios.de Sun Jun 24 01:36:48 2007 From: marcusoverhagen at mail.berlios.de (marcusoverhagen at BerliOS) Date: Sun, 24 Jun 2007 01:36:48 +0200 Subject: [Haiku-commits] r21499 - haiku/trunk/src/add-ons/media/plugins/avi_reader Message-ID: <200706232336.l5NNalNt021770@sheep.berlios.de> Author: marcusoverhagen Date: 2007-06-24 01:36:47 +0200 (Sun, 24 Jun 2007) New Revision: 21499 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21499&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp Log: disable the per frame debug output Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp 2007-06-23 23:35:26 UTC (rev 21498) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp 2007-06-23 23:36:47 UTC (rev 21499) @@ -385,9 +385,9 @@ return B_BAD_VALUE; } - TRACE("stream %d (%s): start_time %.6f, pos %.3f %%\n", - cookie->stream, cookie->is_audio ? "A" : cookie->is_video ? "V" : "?", - mediaHeader->start_time / 1000000.0, cookie->frame_pos * 100.0 / cookie->frame_count); +// TRACE("stream %d (%s): start_time %.6f, pos %.3f %%\n", +// cookie->stream, cookie->is_audio ? "A" : cookie->is_video ? "V" : "?", +// mediaHeader->start_time / 1000000.0, cookie->frame_pos * 100.0 / cookie->frame_count); *chunkBuffer = cookie->buffer; *chunkSize = size; From leavengood at mail.berlios.de Sun Jun 24 06:58:44 2007 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Sun, 24 Jun 2007 06:58:44 +0200 Subject: [Haiku-commits] r21500 - haiku/trunk/src/apps/mediaplayer Message-ID: <200706240458.l5O4wiqv007021@sheep.berlios.de> Author: leavengood Date: 2007-06-24 06:58:42 +0200 (Sun, 24 Jun 2007) New Revision: 21500 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21500&view=rev Modified: haiku/trunk/src/apps/mediaplayer/MainApp.cpp haiku/trunk/src/apps/mediaplayer/MainApp.h Log: Fixed bug #1281, which I logged. MediaPlayer was not behaving properly when being asked to quit. The default BApplication::QuitRequested was not playing well with the other quitting logic in MediaPlayer (like in the windows.) This simple "return true" QuitRequested seems to do the trick. Modified: haiku/trunk/src/apps/mediaplayer/MainApp.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainApp.cpp 2007-06-23 23:36:47 UTC (rev 21499) +++ haiku/trunk/src/apps/mediaplayer/MainApp.cpp 2007-06-24 04:58:42 UTC (rev 21500) @@ -129,6 +129,13 @@ } +bool +MainApp::QuitRequested() +{ + return true; +} + + int main() { Modified: haiku/trunk/src/apps/mediaplayer/MainApp.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainApp.h 2007-06-23 23:36:47 UTC (rev 21499) +++ haiku/trunk/src/apps/mediaplayer/MainApp.h 2007-06-24 04:58:42 UTC (rev 21500) @@ -41,6 +41,7 @@ void ArgvReceived(int32 argc, char **argv); void MessageReceived(BMessage *msg); void AboutRequested(); + bool QuitRequested(); private: BWindow * fFirstWindow; From superstippi at gmx.de Sun Jun 24 10:26:57 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 24 Jun 2007 10:26:57 +0200 Subject: [Haiku-commits] r21500 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <200706240458.l5O4wiqv007021@sheep.berlios.de> References: <200706240458.l5O4wiqv007021@sheep.berlios.de> Message-ID: <20070624102657.425.1@stippis.WG> Hi Ryan, leavengood at BerliOS wrote (2007-06-24, 06:58:44 [+0200]): > Author: leavengood > Date: 2007-06-24 06:58:42 +0200 (Sun, 24 Jun 2007) > New Revision: 21500 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21500&view=rev > > Modified: > haiku/trunk/src/apps/mediaplayer/MainApp.cpp > haiku/trunk/src/apps/mediaplayer/MainApp.h > Log: > Fixed bug #1281, which I logged. MediaPlayer was not behaving properly when > being asked to quit. > > The default BApplication::QuitRequested was not playing well with the other > quitting logic in > MediaPlayer (like in the windows.) > > This simple "return true" QuitRequested seems to do the trick. MediaPlayer worked fine on R5. I wonder if the real problem is elsewhere. Best regards, -Stephan From superstippi at gmx.de Sun Jun 24 11:35:45 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 24 Jun 2007 11:35:45 +0200 Subject: [Haiku-commits] r21500 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <20070624102657.425.1@stippis.WG> References: <200706240458.l5O4wiqv007021@sheep.berlios.de> <20070624102657.425.1@stippis.WG> Message-ID: <20070624113545.723.3@stippis.WG> Stephan Assmus wrote (2007-06-24, 10:26:57 [+0200]): > Hi Ryan, > > leavengood at BerliOS wrote (2007-06-24, 06:58:44 [+0200]): > > Author: leavengood > > Date: 2007-06-24 06:58:42 +0200 (Sun, 24 Jun 2007) > > New Revision: 21500 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21500&view=rev > > > > Modified: > > haiku/trunk/src/apps/mediaplayer/MainApp.cpp > > haiku/trunk/src/apps/mediaplayer/MainApp.h > > Log: > > Fixed bug #1281, which I logged. MediaPlayer was not behaving properly > > when > > being asked to quit. > > > > The default BApplication::QuitRequested was not playing well with the > > other > > quitting logic in > > MediaPlayer (like in the windows.) > > > > This simple "return true" QuitRequested seems to do the trick. > > MediaPlayer worked fine on R5. I wonder if the real problem is elsewhere. Ah, it dawned on me... this is what InfoWin (and PlaylistWindow) does: bool InfoWin::QuitRequested() { Hide(); return false; } This works perfectly fine on R5. Looking at our BApplication implementation however, I see why it doesn't quit. If it happens to ask the InfoWin or PlaylistWin befor the MainWin (which quits these window in it's destructor), then it would weasel out of the window quitting loop. But I think it should ignore hidden windows. I have checked and the QuitRequested hook is not called on hidden windows in R5. I really wonder how the code in BApplication::_WindowQuitLoop() is supposed to work correctly (even when those windows are showing). I thought it is perfectly fine behaviour to quit "sub" windows from the destructor of other windows. But it looks like the loop in _WindowQuitLoop() would still iterate over these windows or even skip windows when items are removed from the looper list while it is being iterated (like when quitting one looper causes another to quit along)? Best regards, -Stephan From superstippi at gmx.de Sun Jun 24 11:39:23 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 24 Jun 2007 11:39:23 +0200 Subject: [Haiku-commits] r21500 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <200706240458.l5O4wiqv007021@sheep.berlios.de> References: <200706240458.l5O4wiqv007021@sheep.berlios.de> Message-ID: <20070624113923.1209.4@stippis.WG> Hi again, leavengood at BerliOS wrote (2007-06-24, 06:58:44 [+0200]): > The default BApplication::QuitRequested was not playing well with the other > quitting logic in > MediaPlayer (like in the windows.) > > This simple "return true" QuitRequested seems to do the trick. > > +bool > +MainApp::QuitRequested() > +{ > + return true; > +} Found out one more thing. The BeBook says: "Augment this function as you will, but be sure to call the BApplication version in your implementation." So I really think we should fix this problem in BApplication. As a general rule, we should never fix something in our apps, that works fine in R5. We need to look for the error in our kits instead. Best regards, -Stephan From stippi at mail.berlios.de Sun Jun 24 13:43:49 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 24 Jun 2007 13:43:49 +0200 Subject: [Haiku-commits] r21501 - haiku/trunk/src/kits/app Message-ID: <200706241143.l5OBhnkM025122@sheep.berlios.de> Author: stippi Date: 2007-06-24 13:43:48 +0200 (Sun, 24 Jun 2007) New Revision: 21501 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21501&view=rev Modified: haiku/trunk/src/kits/app/Application.cpp Log: * do not ask hidden windows if they want to quit (not to be confused with minimized windows, those need to be asked of course) * added some comments about why this code is a little flawed but works anyways NOTE: I really wonder wether traversing the window list in reverse is correct Modified: haiku/trunk/src/kits/app/Application.cpp =================================================================== --- haiku/trunk/src/kits/app/Application.cpp 2007-06-24 04:58:42 UTC (rev 21500) +++ haiku/trunk/src/kits/app/Application.cpp 2007-06-24 11:43:48 UTC (rev 21501) @@ -1349,11 +1349,19 @@ BWindow *window = (BWindow*)looperList.ItemAt(i); // don't quit file panels if we haven't been asked for it + // NOTE: the window pointer will be NULL if the looper was not + // a BWindow or if the thread wasn't running, see above if (window == NULL || (!quitFilePanels && window->IsFilePanel())) continue; + // NOTE: the window pointer might be stale, in case the looper + // was already quit by quitting an earlier looper... but fortunately, + // we can still call Lock() on the invalid pointer, and it + // will return false... if (window->Lock()) { - if (!force && !window->QuitRequested() + // never ask hidden windows if they want to quit, ignore + // them if force == false, just quit them if force == true + if (!force && !window->IsHidden() && !window->QuitRequested() && !(quitFilePanels && window->IsFilePanel())) { // the window does not want to quit, so we don't either window->Unlock(); From stippi at mail.berlios.de Sun Jun 24 13:45:51 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 24 Jun 2007 13:45:51 +0200 Subject: [Haiku-commits] r21502 - haiku/trunk/src/apps/mediaplayer Message-ID: <200706241145.l5OBjpk5025311@sheep.berlios.de> Author: stippi Date: 2007-06-24 13:45:50 +0200 (Sun, 24 Jun 2007) New Revision: 21502 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21502&view=rev Modified: haiku/trunk/src/apps/mediaplayer/MainApp.cpp haiku/trunk/src/apps/mediaplayer/MainApp.h Log: * remove QuitRequested() implementation again, because the bug that MediaPlayer didn't quit was really in BApplication (the fix there also fixes other apps not quitting, like Icon-O-Matic and probably others) Modified: haiku/trunk/src/apps/mediaplayer/MainApp.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainApp.cpp 2007-06-24 11:43:48 UTC (rev 21501) +++ haiku/trunk/src/apps/mediaplayer/MainApp.cpp 2007-06-24 11:45:50 UTC (rev 21502) @@ -30,8 +30,8 @@ MainApp::MainApp() : BApplication("application/x-vnd.Haiku-MediaPlayer"), - fFirstWindow(NewWindow()), - fPlayerCount(1) + fPlayerCount(0), + fFirstWindow(NewWindow()) { } @@ -129,17 +129,11 @@ } -bool -MainApp::QuitRequested() -{ - return true; -} - - int main() { gMainApp = new MainApp; gMainApp->Run(); + delete gMainApp; return 0; } Modified: haiku/trunk/src/apps/mediaplayer/MainApp.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainApp.h 2007-06-24 11:43:48 UTC (rev 21501) +++ haiku/trunk/src/apps/mediaplayer/MainApp.h 2007-06-24 11:45:50 UTC (rev 21502) @@ -23,31 +23,28 @@ #include #include "MainWin.h" -enum -{ +enum { M_PLAYER_QUIT = 'plqt', }; -class MainApp : public BApplication -{ +class MainApp : public BApplication { public: - MainApp(); - ~MainApp(); + MainApp(); + virtual ~MainApp(); - BWindow * NewWindow(); + BWindow* NewWindow(); private: - void RefsReceived(BMessage *msg); - void ArgvReceived(int32 argc, char **argv); - void MessageReceived(BMessage *msg); - void AboutRequested(); - bool QuitRequested(); + virtual void RefsReceived(BMessage* message); + virtual void ArgvReceived(int32 argc, char** argv); + virtual void MessageReceived(BMessage* message); + virtual void AboutRequested(); private: - BWindow * fFirstWindow; - int32 fPlayerCount; + int32 fPlayerCount; + BWindow* fFirstWindow; }; -extern MainApp *gMainApp; +extern MainApp* gMainApp; #endif From leavengood at gmail.com Sun Jun 24 16:05:21 2007 From: leavengood at gmail.com (Ryan Leavengood) Date: Sun, 24 Jun 2007 10:05:21 -0400 Subject: [Haiku-commits] r21500 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <20070624113923.1209.4@stippis.WG> References: <200706240458.l5O4wiqv007021@sheep.berlios.de> <20070624113923.1209.4@stippis.WG> Message-ID: On 6/24/07, Stephan Assmus wrote: > > So I really think we should fix this problem in BApplication. As a general > rule, we should never fix something in our apps, that works fine in R5. We > need to look for the error in our kits instead. I agree. I didn't know this worked fine in R5. Do you think you have the right semantics for BApplication::QuitRequested worked out? I just removed my new QuitRequested() from MediaPlayer and fixed the BApplication::_WindowQuitLoop to check if a window is not hidden before calling QuitRequested on it. In testing this seems to work fine. I'll commit these changes soon so speak now if you have other ideas... Ryan From leavengood at gmail.com Sun Jun 24 16:08:22 2007 From: leavengood at gmail.com (Ryan Leavengood) Date: Sun, 24 Jun 2007 10:08:22 -0400 Subject: [Haiku-commits] r21500 - haiku/trunk/src/apps/mediaplayer In-Reply-To: References: <200706240458.l5O4wiqv007021@sheep.berlios.de> <20070624113923.1209.4@stippis.WG> Message-ID: On 6/24/07, Ryan Leavengood wrote: > > I'll commit these changes soon so speak now if you have other ideas... Never mind I see you already made those changes :) Ryan From axeld at pinc-software.de Mon Jun 25 01:48:32 2007 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 25 Jun 2007 01:48:32 +0200 CEST Subject: [Haiku-commits] r21500 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <20070624113545.723.3@stippis.WG> Message-ID: <2574968803-BeMail@zon> Stephan Assmus wrote: > But I > think it should ignore hidden windows. I have checked and the > QuitRequested > hook is not called on hidden windows in R5. Why should it ignore hidden windows? I don't know what you did, but QuitRequested() is definitely called on hidden windows over here (using Dano). > I really wonder how the code in > BApplication::_WindowQuitLoop() is supposed to work correctly (even > when > those windows are showing). I thought it is perfectly fine behaviour > to > quit "sub" windows from the destructor of other windows. But it looks > like > the loop in _WindowQuitLoop() would still iterate over these windows > or > even skip windows when items are removed from the looper list while > it is > being iterated (like when quitting one looper causes another to quit > along)? As you mentioned, the loop is "smart" enough to deal with the ugly details. I think our problems just stem from the fact that we're (still) reversing the quitting order. Bye, Axel. From superstippi at gmx.de Mon Jun 25 14:02:49 2007 From: superstippi at gmx.de (Stephan Assmus) Date: Mon, 25 Jun 2007 14:02:49 +0200 Subject: [Haiku-commits] r21500 - haiku/trunk/src/apps/mediaplayer In-Reply-To: <2574968803-BeMail@zon> References: <2574968803-BeMail@zon> Message-ID: <20070625140249.531.1@stippis.WG> Axel D?rfler wrote (2007-06-25, 01:48:32 [+0200]): > Stephan Assmus wrote: > > But I > > think it should ignore hidden windows. I have checked and the > > QuitRequested > > hook is not called on hidden windows in R5. > > Why should it ignore hidden windows? I don't know what you did, but > QuitRequested() is definitely called on hidden windows over here (using > Dano). > > > I really wonder how the code in > > BApplication::_WindowQuitLoop() is supposed to work correctly (even > > when > > those windows are showing). I thought it is perfectly fine behaviour > > to > > quit "sub" windows from the destructor of other windows. But it looks > > like > > the loop in _WindowQuitLoop() would still iterate over these windows > > or > > even skip windows when items are removed from the looper list while > > it is > > being iterated (like when quitting one looper causes another to quit > > along)? > > As you mentioned, the loop is "smart" enough to deal with the ugly > details. > I think our problems just stem from the fact that we're (still) > reversing the quitting order. I had tested on R5 with our MediaPlayer and QuitRequested was definitely not called, but that might very well be because the MainWindow is asked first and quits those windows. So why do we quit windows in reverse order? Best regards, -Stephan From mmlr at mail.berlios.de Mon Jun 25 21:51:13 2007 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Mon, 25 Jun 2007 21:51:13 +0200 Subject: [Haiku-commits] r21503 - in haiku/trunk: headers/os/drivers src/add-ons/kernel/bus_managers/usb src/add-ons/kernel/busses/usb Message-ID: <200706251951.l5PJpD6o014413@sheep.berlios.de> Author: mmlr Date: 2007-06-25 21:51:12 +0200 (Mon, 25 Jun 2007) New Revision: 21503 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21503&view=rev Modified: haiku/trunk/headers/os/drivers/USB3.h haiku/trunk/src/add-ons/kernel/bus_managers/usb/Pipe.cpp haiku/trunk/src/add-ons/kernel/bus_managers/usb/Transfer.cpp haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h haiku/trunk/src/add-ons/kernel/bus_managers/usb/usbspec_p.h haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h Log: Commiting patch by Salvatore Benedetto. This adds isochronous handling to the USB bus manager and enables inbound isochronous support in the UHCI driver. Thanks! Modified: haiku/trunk/headers/os/drivers/USB3.h =================================================================== --- haiku/trunk/headers/os/drivers/USB3.h 2007-06-24 11:45:50 UTC (rev 21502) +++ haiku/trunk/headers/os/drivers/USB3.h 2007-06-25 19:51:12 UTC (rev 21503) @@ -74,11 +74,14 @@ }; typedef struct { - int16 req_len; - int16 act_len; + int16 request_length; + int16 actual_length; status_t status; } usb_iso_packet_descriptor; +// Flags for queue_isochronous +#define USB_ISO_ASAP 0x01 + typedef void (*usb_callback_func)(void *cookie, status_t status, void *data, size_t actualLength); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Pipe.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/Pipe.cpp 2007-06-24 11:45:50 UTC (rev 21502) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/Pipe.cpp 2007-06-25 19:51:12 UTC (rev 21503) @@ -198,7 +198,32 @@ uint32 *startingFrameNumber, uint32 flags, usb_callback_func callback, void *callbackCookie) { - return B_ERROR; + // TODO: Check if values of input parameters are set correctely + usb_isochronous_data *isochronousData + = new(std::nothrow) usb_isochronous_data; + + if (!isochronousData) + return B_NO_MEMORY; + + isochronousData->packet_descriptors = packetDesc; + isochronousData->packet_count = packetCount; + isochronousData->starting_frame_number = startingFrameNumber; + isochronousData->flags = flags; + + Transfer *transfer = new(std::nothrow) Transfer(this); + if (!transfer) { + delete isochronousData; + return B_NO_MEMORY; + } + + transfer->SetData((uint8 *)data, dataLength); + transfer->SetCallback(callback, callbackCookie); + transfer->SetIsochronousData(isochronousData); + + status_t result = GetBusManager()->SubmitTransfer(transfer); + if (result < B_OK) + delete transfer; + return result; } @@ -259,7 +284,9 @@ uint16 index, uint16 length, void *data, size_t dataLength, size_t *actualLength) { - transfer_result_data *transferResult = (transfer_result_data *)malloc(sizeof(transfer_result_data)); + transfer_result_data *transferResult + = new(std::nothrow) transfer_result_data; + transferResult->notify_sem = create_sem(0, "usb send request notify"); if (transferResult->notify_sem < B_OK) return B_NO_MORE_SEMS; @@ -290,7 +317,7 @@ *actualLength = transferResult->actual_length; result = transferResult->status; - free(transferResult); + delete transferResult; return result; } @@ -304,7 +331,7 @@ transferResult->actual_length = actualLength; if (release_sem(transferResult->notify_sem) < B_OK) { // the request has timed out already - cleanup after us - free(transferResult); + delete transferResult; } } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Transfer.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/Transfer.cpp 2007-06-24 11:45:50 UTC (rev 21502) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/Transfer.cpp 2007-06-25 19:51:12 UTC (rev 21503) @@ -6,7 +6,6 @@ * Michael Lotz * Niels S. Reedijk */ - #include "usb_p.h" @@ -21,7 +20,9 @@ fClonedArea(-1), fCallback(NULL), fCallbackCookie(NULL), - fRequestData(NULL) + fRequestData(NULL), + fIsochronousData(NULL), + fBandwidth(0) { } @@ -48,6 +49,13 @@ void +Transfer::SetIsochronousData(usb_isochronous_data *data) +{ + fIsochronousData = data; +} + + +void Transfer::SetData(uint8 *data, size_t dataLength) { fBaseAddress = data; @@ -56,6 +64,12 @@ if (data && dataLength > 0) fVectorCount = 1; + + // Calculate the bandwidth (only if it is not a bulk transfer) + if (!(fPipe->Type() & USB_OBJECT_BULK_PIPE)) { + if (_CalculateBandwidth() < B_OK) + TRACE_ERROR(("USB Transfer: can't calculate bandwidth\n")); + } } @@ -187,3 +201,75 @@ fCallback(fCallbackCookie, status, fBaseAddress, fActualLength + actualLength); } + + +/* + * USB 2.0 Spec function, pag 64. + * This function sets fBandwidth in microsecond + * to the bandwidth needed to transfer fData.iov_len bytes. + * The calculation is based on + * 1. Speed of the transfer + * 2. Pipe direction + * 3. Type of pipe + * 4. Number of bytes to transfer + */ +status_t +Transfer::_CalculateBandwidth() +{ + uint16 bandwidthNS; + uint32 type = fPipe->Type(); + + switch (fPipe->Speed()) { + case USB_SPEED_HIGHSPEED: + { + // Direction doesn't matter for highspeed + if (type & USB_OBJECT_ISO_PIPE) + bandwidthNS = (uint16)((38 * 8 * 2.083) + + (2.083 * ((uint32)(3.167 * (1.1667 * 8 * fData.iov_len)))) + + USB_BW_HOST_DELAY); + else + bandwidthNS = (uint16)((55 * 8 * 2.083) + + (2.083 * ((uint32)(3.167 * (1.1667 * 8 * fData.iov_len)))) + + USB_BW_HOST_DELAY); + break; + } + case USB_SPEED_FULLSPEED: + { + // Direction does matter this time for isochronous + if (type & USB_OBJECT_ISO_PIPE) + bandwidthNS = (uint16) + (((fPipe->Direction() == Pipe::In) ? 7268 : 6265) + + (83.54 * ((uint32)(3.167 + (1.1667 * 8 * fData.iov_len)))) + + USB_BW_HOST_DELAY); + else + bandwidthNS = (uint16)(9107 + + (83.54 * ((uint32)(3.167 + (1.1667 * 8 * fData.iov_len)))) + + USB_BW_HOST_DELAY); + break; + } + case USB_SPEED_LOWSPEED: + { + if (fPipe->Direction() == Pipe::In) + bandwidthNS = (uint16) (64060 + (2 * USB_BW_SETUP_LOW_SPEED_PORT_DELAY) + + (676.67 * ((uint32)(3.167 + (1.1667 * 8 * fData.iov_len)))) + + USB_BW_HOST_DELAY); + else + bandwidthNS = (uint16)(64107 + (2 * USB_BW_SETUP_LOW_SPEED_PORT_DELAY) + + (667.0 * ((uint32)(3.167 + (1.1667 * 8 * fData.iov_len)))) + + USB_BW_HOST_DELAY); + break; + } + + default: + // We should never get here + TRACE(("USB Transfer: speed unknown")); + return B_ERROR; + } + + // Round up and set the value in microseconds + fBandwidth = (bandwidthNS + 500) / 1000; + + // For debugging purposes + TRACE(("USB Transfer: bandwidth neded %d\n", fBandwidth)); + return B_OK; +} Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h 2007-06-24 11:45:50 UTC (rev 21502) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h 2007-06-25 19:51:12 UTC (rev 21503) @@ -85,7 +85,6 @@ #define USB_OBJECT_DEVICE 0x00000040 #define USB_OBJECT_HUB 0x00000080 -#define USB_MAX_FRAGMENT_SIZE B_PAGE_SIZE * 96 class Stack { public: @@ -521,6 +520,9 @@ void SetRequestData(usb_request_data *data); usb_request_data *RequestData() { return fRequestData; }; + void SetIsochronousData(usb_isochronous_data *data); + usb_isochronous_data *IsochronousData() { return fIsochronousData; }; + void SetData(uint8 *buffer, size_t length); uint8 *Data() { return (uint8 *)fData.iov_base; }; size_t DataLength() { return fData.iov_len; }; @@ -530,6 +532,8 @@ size_t VectorCount() { return fVectorCount; }; size_t VectorLength(); + uint16 Bandwidth() { return fBandwidth; }; + bool IsFragmented() { return fFragmented; }; void AdvanceByFragment(size_t actualLength); @@ -542,6 +546,8 @@ void Finished(uint32 status, size_t actualLength); private: + status_t _CalculateBandwidth(); + // Data that is related to the transfer Pipe *fPipe; iovec fData; @@ -558,6 +564,15 @@ // For control transfers usb_request_data *fRequestData; + + // For isochronous transfers + usb_isochronous_data *fIsochronousData; + + // For bandwidth management. + // It contains the bandwidth necessary in microseconds + // for either isochronous, interrupt or control transfers. + // Not used for bulk transactions. + uint16 fBandwidth; }; #endif Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/usbspec_p.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/usbspec_p.h 2007-06-24 11:45:50 UTC (rev 21502) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/usbspec_p.h 2007-06-25 19:51:12 UTC (rev 21503) @@ -16,6 +16,7 @@ #include #define USB_MAX_AREAS 8 +#define USB_MAX_FRAGMENT_SIZE B_PAGE_SIZE * 96 #define USB_DELAY_BUS_RESET 100000 #define USB_DELAY_DEVICE_POWER_UP 300000 @@ -28,6 +29,11 @@ #define USB_DELAY_FIRST_EXPLORE 5000000 #define USB_DELAY_HUB_EXPLORE 1000000 +// For bandwidth calculation +#define USB_BW_HOST_DELAY 1000 +#define USB_BW_SETUP_LOW_SPEED_PORT_DELAY 333 + + /* Important data from the USB spec (not interesting for drivers) */ @@ -49,6 +55,14 @@ }; +struct usb_isochronous_data { + usb_iso_packet_descriptor *packet_descriptors; + uint32 packet_count; + uint32 *starting_frame_number; + uint32 flags; +}; + + struct usb_hub_descriptor { uint8 length; Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2007-06-24 11:45:50 UTC (rev 21502) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2007-06-25 19:51:12 UTC (rev 21503) @@ -5,6 +5,7 @@ * Authors: * Michael Lotz * Niels S. Reedijk + * Salvatore Benedetto */ #include @@ -296,11 +297,15 @@ fFrameArea(-1), fFrameList(NULL), fQueueCount(0), - fQueues(NULL), + fQueues(NULL), fFirstTransfer(NULL), fLastTransfer(NULL), fFinishThread(-1), fStopFinishThread(false), + fFirstIsochronousTransfer(NULL), + fLastIsochronousTransfer(NULL), + fFinishIsochronousThread(-1), + fStopFinishIsochronousThread(false), fRootHub(NULL), fRootHubAddress(0), fPortResetChange(0) @@ -391,7 +396,7 @@ fQueues[fQueueCount - 1]->TerminateByStrayDescriptor(); // Create the array that will keep bandwidth information - fFrameBandwidth = new(std::nothrow) int32[NUMBER_OF_FRAMES]; + fFrameBandwidth = new(std::nothrow) uint16[NUMBER_OF_FRAMES]; for (int32 i = 0; i < NUMBER_OF_FRAMES; i++) { fFrameList[i] = fQueues[UHCI_INTERRUPT_QUEUE]->PhysicalAddress() @@ -399,6 +404,10 @@ fFrameBandwidth[i] = MAX_AVAILABLE_BANDWIDTH; } + // create lists for managing isochronous transfer descriptors + fFirstIsochronousDescriptor = new(std::nothrow) uhci_td *[NUMBER_OF_FRAMES]; + fLastIsochronousDescriptor = new(std::nothrow) uhci_td *[NUMBER_OF_FRAMES]; + // create semaphore the finisher thread will wait for fFinishTransfersSem = create_sem(0, "UHCI Finish Transfers"); if (fFinishTransfersSem < B_OK) { @@ -411,6 +420,18 @@ "uhci finish thread", B_URGENT_DISPLAY_PRIORITY, (void *)this); resume_thread(fFinishThread); + // Create a lock for the isochronous transfer list + if (benaphore_init(&fIsochronousLock, "UHCI isochronous lock") < B_OK) { + TRACE_ERROR(("usb_uhci: failed to create isochronous lock\n")); + return; + } + + // Create the isochronous finisher service thread + fFinishIsochronousThread = spawn_kernel_thread(FinishIsochronousThread, + "uhci isochronous finish thread", B_URGENT_DISPLAY_PRIORITY, + (void *)this); + resume_thread(fFinishIsochronousThread); + // Install the interrupt handler TRACE(("usb_uhci: installing interrupt handler\n")); install_io_interrupt_handler(fPCIInfo->u.h0.interrupt_line, @@ -429,9 +450,20 @@ { int32 result = 0; fStopFinishThread = true; + fStopFinishIsochronousThread = true; delete_sem(fFinishTransfersSem); wait_for_thread(fFinishThread, &result); + wait_for_thread(fFinishIsochronousThread, &result); + LockIsochronous(); + isochronous_transfer_data *isoTransfer = fFirstIsochronousTransfer; + while (isoTransfer) { + isochronous_transfer_data *next = isoTransfer->link; + delete isoTransfer; + isoTransfer = next; + } + benaphore_destroy(&fIsochronousLock); + Lock(); transfer_data *transfer = fFirstTransfer; while (transfer) { @@ -445,6 +477,8 @@ delete [] fQueues; delete [] fFrameBandwidth; + delete [] fFirstIsochronousDescriptor; + delete [] fLastIsochronousDescriptor; delete fRootHub; delete_area(fFrameArea); @@ -551,6 +585,9 @@ status_t UHCI::CancelQueuedTransfers(Pipe *pipe) { + if (pipe->Type() & USB_OBJECT_ISO_PIPE) + return CancelQueuedIsochronousTransfers(pipe); + if (!Lock()) return B_ERROR; @@ -569,7 +606,7 @@ last->link = next; else fFirstTransfer = next; - + if (fLastTransfer == current) fLastTransfer = last; @@ -582,12 +619,37 @@ } Unlock(); - return B_OK; } status_t +UHCI::CancelQueuedIsochronousTransfers(Pipe *pipe) +{ + isochronous_transfer_data *current = fFirstIsochronousTransfer; + + while (current) { + if (current->transfer->TransferPipe() == pipe) { + int32 packetCount + = current->transfer->IsochronousData()->packet_count; + // Set the active bit off on every descriptor in order to prevent + // the controller from processing them. Then set off the is_active + // field of the transfer in order to make the finisher thread skip + // the transfer. The FinishIsochronousThread will do the rest. + for (int32 i = 0; i < packetCount; i++) + current->descriptors[i]->status &= ~TD_STATUS_ACTIVE; + current->is_active = false; + } + + current = current->link; + } + + TRACE_ERROR(("usb_uhci: no isochronous transfer found!\n")); + return B_ERROR; +} + + +status_t UHCI::SubmitRequest(Transfer *transfer) { Pipe *pipe = transfer->TransferPipe(); @@ -685,7 +747,6 @@ data->transfer_queue = transferQueue; data->first_descriptor = firstDescriptor; data->data_descriptor = dataDescriptor; - data->user_area = -1; data->incoming = directionIn; data->link = NULL; @@ -706,25 +767,217 @@ status_t +UHCI::AddPendingIsochronousTransfer(Transfer *transfer, uhci_td **isoRequest, + bool directionIn) +{ + if (!transfer || !isoRequest) + return B_BAD_VALUE; + + isochronous_transfer_data *data + = new(std::nothrow) isochronous_transfer_data; + if (!data) + return B_NO_MEMORY; + + status_t result = transfer->InitKernelAccess(); + if (result < B_OK) + return result; + + data->transfer = transfer; + data->descriptors = isoRequest; + data->last_to_process = transfer->IsochronousData()->packet_count - 1; + data->incoming = directionIn; + data->is_active = true; + + // Put in the isochronous transfer list + if (!LockIsochronous()) { + delete data; + return B_ERROR; + } + + if (fLastIsochronousTransfer) + fLastIsochronousTransfer->link = data; + if (!fFirstIsochronousTransfer) + fFirstIsochronousTransfer = data; + + fLastIsochronousTransfer = data; + UnlockIsochronous(); + return B_OK; +} + + +status_t UHCI::SubmitIsochronous(Transfer *transfer) { - /* - * This is the main isochronous method. - * Here we attach one Transfer Descriptor (TD) per frame by starting - * at the position specified by StartingFrameNumber. If there is - * not enought bandwidth at that entry number, we find the next - * available one. - * The TD is obviously appended to the latest existing isochronous - * TD (if any) in that frame. - * Everytime a TD is added, fFrameBandiwidth[i] is decremented by - * the TD bandwidth, while it is incremented once the TD has been - * processed by the controller - */ + Pipe *pipe = transfer->TransferPipe(); + bool directionIn = (pipe->Direction() == Pipe::In); + usb_isochronous_data *isochronousData = transfer->IsochronousData(); + size_t packetSize = transfer->DataLength(); + size_t restSize = packetSize % isochronousData->packet_count; + packetSize /= isochronousData->packet_count; + uint16 currentFrame; - return B_ERROR; + // Ignore the fact that the last descriptor might need less bandwidth. + // The overhead is not worthy. + uint16 bandwidth = transfer->Bandwidth() / isochronousData->packet_count; + + TRACE(("usb_uhci: isochronous transfer descriptor bandwdith = %d\n", + bandwidth)); + + // TODO: If direction is out set every descriptor data + if (!directionIn) + return B_ERROR; + + // The following holds the list of transfer descriptor of the + // isochronous request. It is used to quickly remove all the isochronous + // descriptors from the frame list, as descriptors are not link to each + // other in a queue like for every other transfer. + uhci_td **isoRequest + = new(std::nothrow) uhci_td *[isochronousData->packet_count]; + + // Create the list of transfer descriptors + for (uint32 i = 0; i < (isochronousData->packet_count - 1); i++) { + isoRequest[i] = CreateDescriptor(pipe, + directionIn ? TD_TOKEN_IN : TD_TOKEN_OUT, packetSize); + // Make sure data toggle is set to zero + isoRequest[i]->token &= ~TD_TOKEN_DATA1; + } + + // Create the last transfer descriptor which should be of smaller size + // and set the IOC bit + isoRequest[isochronousData->packet_count - 1] = CreateDescriptor(pipe, + directionIn ? TD_TOKEN_IN : TD_TOKEN_OUT, restSize); + isoRequest[isochronousData->packet_count - 1]->token &= ~TD_TOKEN_DATA1; + isoRequest[isochronousData->packet_count - 1]->status |= TD_CONTROL_IOC; + + TRACE(("usb_uhci: isochronous submitted size=%ld bytes, TDs=%ld, " + "packetSize=%ld, restSize=%ld\n", transfer->DataLength(), + isochronousData->packet_count, packetSize, restSize)); + + // Initialize the packet descriptors + for (uint32 i = 0; i < isochronousData->packet_count; i++) { + isochronousData->packet_descriptors[i].actual_length = 0; + isochronousData->packet_descriptors[i].status = B_NO_INIT; + } + + // Find the entry where to start inserting the first Isochronous descriptor + if (isochronousData->flags & USB_ISO_ASAP || + isochronousData->starting_frame_number == NULL) { + // find the first available frame with enough bandwidth. + // This should always be the case, as defining the starting frame + // number in the driver makes no sense for many reason, one of which + // is that frame numbers value are host controller specific, and the + // driver does not know which host controller is running. + currentFrame = ReadReg16(UHCI_FRNUM); + + // Make sure that: + // 1. We are at least 5ms ahead the controller + // 2. We stay in the range 0-1023 + // 3. There is enough bandwidth in the first entry + currentFrame = (currentFrame + 5) % NUMBER_OF_FRAMES; + } else { + // Find out if the frame number specified has enough bandwidth, + // otherwise find the first next available frame with enough bandwidth + currentFrame = *isochronousData->starting_frame_number; + } + + // Find the first entry with enough bandwidth + // TODO: should we also check the bandwidth of the following packet_count frames? + uint16 startSeekingFromFrame = currentFrame; + while (fFrameBandwidth[currentFrame] < bandwidth) { + currentFrame = (currentFrame + 1) % NUMBER_OF_FRAMES; + if (currentFrame == startSeekingFromFrame) { + TRACE_ERROR(("usb_uhci: Not enough bandwidth to queue the" + " isochronous request. Try again later!\n")); + return B_ERROR; + } + } + + if (isochronousData->starting_frame_number) + *isochronousData->starting_frame_number = currentFrame; + + // Add transfer to the list + status_t result = AddPendingIsochronousTransfer(transfer, isoRequest, + directionIn); + if (result < B_OK) { + TRACE_ERROR(("usb_uhci: failed to add pending isochronous transfer\n")); + for (uint32 i = 0; i < isochronousData->packet_count; i++) { + FreeDescriptor(isoRequest[i]); + delete [] isoRequest; + } + return result; + } + + TRACE(("usb_uhci: appended isochronous transfer by starting at frame" + " number %d\n", currentFrame)); + + // Insert the Transfer Descriptor by starting at + // the starting_frame_number entry + // TODO: We don't consider bInterval, and assume it's 1! + for (uint32 i = 0; i < isochronousData->packet_count; i++) { + LinkIsochronousDescriptor(isoRequest[i], currentFrame); + fFrameBandwidth[currentFrame] -= bandwidth; + currentFrame = (currentFrame + 1) % NUMBER_OF_FRAMES; + } + + return B_OK; } +isochronous_transfer_data * +UHCI::FindIsochronousTransfer(uhci_td *descriptor) +{ + // Simply check every last descriptor of the isochronous transfer list + LockIsochronous(); + isochronous_transfer_data *transfer = fFirstIsochronousTransfer; + while (transfer->descriptors[transfer->last_to_process] != descriptor) { + transfer = transfer->link; + if (!transfer) + break; + } + + UnlockIsochronous(); + return transfer; +} + + +void +UHCI::LinkIsochronousDescriptor(uhci_td *descriptor, uint16 frame) +{ + // The transfer descriptor is appended to the last + // existing isochronous transfer descriptor (if any) + // in that frame. + if (fFrameList[frame] & FRAMELIST_NEXT_IS_QH) { + // Insert the transfer descriptor in the first position + descriptor->link_phy = fFrameList[frame]; + // No need to set the link_log as it is already NULL + fFrameList[frame] = descriptor->this_phy & ~FRAMELIST_NEXT_IS_QH; + fFirstIsochronousDescriptor[frame] = descriptor; + fLastIsochronousDescriptor[frame] = descriptor; + } else { + // Append to the last transfer descriptor + descriptor->link_phy = fLastIsochronousDescriptor[frame]->link_phy; + fLastIsochronousDescriptor[frame]->link_log = descriptor; + fLastIsochronousDescriptor[frame]->link_phy + = descriptor->this_phy & ~TD_NEXT_IS_QH; + fLastIsochronousDescriptor[frame] = descriptor; + } +} + + +void +UHCI::UnlinkIsochronousDescriptor(uhci_td *descriptor, uint16 frame) +{ + // The pointer to the descriptor is in descriptors[frame] and it will be + // freed later. + fFrameList[frame] = descriptor->link_phy; + if (fFrameList[frame] & FRAMELIST_NEXT_IS_QH) { + fFirstIsochronousDescriptor[frame] = NULL; + fLastIsochronousDescriptor[frame] = NULL; + } else + fFirstIsochronousDescriptor[frame] = (uhci_td *)descriptor->link_log; +} + + int32 UHCI::FinishThread(void *data) { @@ -749,7 +1002,9 @@ if (!Lock()) continue; - TRACE(("usb_uhci: finishing transfers (first transfer: 0x%08lx; last transfer: 0x%08lx)\n", (uint32)fFirstTransfer, (uint32)fLastTransfer)); + TRACE(("usb_uhci: finishing transfers (first transfer: 0x%08lx; last" + " transfer: 0x%08lx)\n", (uint32)fFirstTransfer, + (uint32)fLastTransfer)); transfer_data *lastTransfer = NULL; transfer_data *transfer = fFirstTransfer; Unlock(); @@ -767,7 +1022,9 @@ } if (status & TD_ERROR_MASK) { - TRACE_ERROR(("usb_uhci: td (0x%08lx) error: status: 0x%08lx; token: 0x%08lx;\n", descriptor->this_phy, status, descriptor->token)); + TRACE_ERROR(("usb_uhci: td (0x%08lx) error: status: 0x%08lx;" + " token: 0x%08lx;\n", descriptor->this_phy, status, + descriptor->token)); // an error occured. we have to remove the // transfer from the queue and clean up @@ -903,7 +1160,93 @@ } +int32 +UHCI::FinishIsochronousThread(void *data) +{ + ((UHCI *)data)->FinishIsochronousTransfers(); + return B_OK; +} + + void +UHCI::FinishIsochronousTransfers() +{ + /* This thread stays one position behind the controller and processes every + * isochronous descriptor. Once it finds the last isochronous descriptor + * of a transfer, it processes the entire transfer. + */ + uint16 currentFrame = ReadReg16(UHCI_FRNUM); + + while (!fStopFinishIsochronousThread) { + // wait 1ms in order to be sure to be one position behind + // the controller + if (currentFrame == ReadReg16(UHCI_FRNUM)) + snooze(1000); + + // Process the frame till it has isochronous descriptors in it. + while (!(fFrameList[currentFrame] & FRAMELIST_NEXT_IS_QH)) { + uhci_td *current = fFirstIsochronousDescriptor[currentFrame]; + UnlinkIsochronousDescriptor(current, currentFrame); + + // Process the transfer if we found the last descriptor + if (current->status & TD_CONTROL_IOC) { + isochronous_transfer_data *transfer + = FindIsochronousTransfer(current); + + // The following should NEVER happen + if (!transfer) + TRACE_ERROR(("usb_uhci: Isochronous transfer not found in" + " the finisher thread!\n")); + + // Process the transfer only if it is still active and belongs + // to an INPUT transfer. If the transfer is not active, it + // means the request has been removed, so simply remove the + // descriptors. + else if (transfer->is_active && (current->status & TD_TOKEN_IN)) { + iovec *vector = transfer->transfer->Vector(); + transfer->transfer->PrepareKernelAccess(); + ReadIsochronousDescriptorChain(transfer, vector); + + // Remove the transfer + if (LockIsochronous()) { + if (transfer == fFirstIsochronousTransfer) + fFirstIsochronousTransfer = transfer->link; + else { + isochronous_transfer_data *temp + = fFirstIsochronousTransfer; + while (transfer != temp->link) + temp = temp->link; + + if (transfer == fLastIsochronousTransfer) + fLastIsochronousTransfer = temp; + temp->link = temp->link->link; + } + + UnlockIsochronous(); + } + + transfer->transfer->Finished(B_OK, 0); + } + + uint32 packetCount = + transfer->transfer->IsochronousData()->packet_count; + for (uint32 i = 0; i < packetCount; i++) + FreeDescriptor(transfer->descriptors[i]); + + delete [] transfer->descriptors; + delete transfer->transfer; + delete transfer; + } + } + + // Make sure to reset the frame bandwidth + fFrameBandwidth[currentFrame] = MAX_AVAILABLE_BANDWIDTH; + currentFrame = (currentFrame + 1) % NUMBER_OF_FRAMES; + } +} + + +void UHCI::GlobalReset() { uint8 sofValue = ReadReg8(UHCI_SOFMOD); @@ -1292,9 +1635,14 @@ } result->this_phy = (addr_t)physicalAddress; - result->status = TD_STATUS_ACTIVE | TD_CONTROL_3_ERRORS; - if (direction == TD_TOKEN_IN) - result->status |= TD_CONTROL_SPD; + result->status = TD_STATUS_ACTIVE; + if (pipe->Type() & USB_OBJECT_ISO_PIPE) + result->status |= TD_CONTROL_ISOCHRONOUS; + else { + result->status |= TD_CONTROL_3_ERRORS; + if (direction == TD_TOKEN_IN) + result->status |= TD_CONTROL_SPD; + } if (pipe->Speed() == USB_SPEED_LOWSPEED) result->status |= TD_CONTROL_LOWSPEED; @@ -1315,7 +1663,7 @@ return result; } - if (fStack->AllocateChunk(&result->buffer_log, &result->buffer_phy, + if (fStack->AllocateChunk(&result->buffer_log, (void **)&result->buffer_phy, bufferSize) < B_OK) { TRACE_ERROR(("usb_uhci: unable to allocate space for the buffer\n")); fStack->FreeChunk(result, (void *)result->this_phy, sizeof(uhci_td)); @@ -1422,7 +1770,9 @@ size_t length = min_c(current->buffer_size - bufferOffset, vector[vectorIndex].iov_len - vectorOffset); - TRACE(("usb_uhci: copying %ld bytes to bufferOffset %ld from vectorOffset %ld at index %ld of %ld\n", length, bufferOffset, vectorOffset, vectorIndex, vectorCount)); + TRACE(("usb_uhci: copying %ld bytes to bufferOffset %ld from" + " vectorOffset %ld at index %ld of %ld\n", length, bufferOffset, + vectorOffset, vectorIndex, vectorCount)); memcpy((uint8 *)current->buffer_log + bufferOffset, (uint8 *)vector[vectorIndex].iov_base + vectorOffset, length); @@ -1432,7 +1782,8 @@ if (vectorOffset >= vector[vectorIndex].iov_len) { if (++vectorIndex >= vectorCount) { - TRACE(("usb_uhci: wrote descriptor chain (%ld bytes, no more vectors)\n", actualLength)); + TRACE(("usb_uhci: wrote descriptor chain (%ld bytes, no" + " more vectors)\n", actualLength)); return actualLength; } @@ -1480,7 +1831,9 @@ size_t length = min_c(bufferSize - bufferOffset, vector[vectorIndex].iov_len - vectorOffset); - TRACE(("usb_uhci: copying %ld bytes to vectorOffset %ld from bufferOffset %ld at index %ld of %ld\n", length, vectorOffset, bufferOffset, vectorIndex, vectorCount)); + TRACE(("usb_uhci: copying %ld bytes to vectorOffset %ld from" + " bufferOffset %ld at index %ld of %ld\n", length, vectorOffset, + bufferOffset, vectorIndex, vectorCount)); memcpy((uint8 *)vector[vectorIndex].iov_base + vectorOffset, (uint8 *)current->buffer_log + bufferOffset, length); @@ -1548,6 +1901,52 @@ } +void +UHCI::ReadIsochronousDescriptorChain(isochronous_transfer_data *transfer, + iovec *vector) +{ + size_t vectorOffset = 0; + usb_isochronous_data *isochronousData + = transfer->transfer->IsochronousData(); + + for (uint32 i = 0; i < isochronousData->packet_count; i++) { + uhci_td *current = transfer->descriptors[i]; + + size_t bufferSize + = isochronousData->packet_descriptors[i].request_length; + int16 actualLength = (current->status & TD_STATUS_ACTLEN_MASK) + 1; + if (actualLength == TD_STATUS_ACTLEN_NULL + 1) + actualLength = 0; + + isochronousData->packet_descriptors[i].actual_length = actualLength; + + if (actualLength > 0) + isochronousData->packet_descriptors[i].status = B_OK; + else + isochronousData->packet_descriptors[i].status = B_ERROR; + + memcpy((uint8 *)vector->iov_base + vectorOffset, + (uint8 *)current->buffer_log, bufferSize); + + vectorOffset += bufferSize; + } +} + + +bool +UHCI::LockIsochronous() +{ + return (benaphore_lock(&fIsochronousLock) == B_OK); +} + + +void +UHCI::UnlockIsochronous() +{ + benaphore_unlock(&fIsochronousLock); +} + + inline void UHCI::WriteReg8(uint32 reg, uint8 value) { Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h 2007-06-24 11:45:50 UTC (rev 21502) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h 2007-06-25 19:51:12 UTC (rev 21503) @@ -5,6 +5,7 @@ * Authors: * Michael Lotz * Niels S. Reedijk + * Salvatore Benedetto */ #ifndef UHCI_H @@ -61,12 +62,27 @@ uhci_qh *transfer_queue; uhci_td *first_descriptor; uhci_td *data_descriptor; - area_id user_area; bool incoming; transfer_data_s *link; } transfer_data; +// This structure is used to create a list of +// descriptors per isochronous transfer +typedef struct isochronous_transfer_data_s { + Transfer *transfer; + // The next field is used to keep track + // of every isochronous descriptor as they are NOT + // linked to each other in a queue like in every other + // transfer type + uhci_td **descriptors; + uint16 last_to_process; + bool incoming; + bool is_active; + isochronous_transfer_data_s *link; +} isochronous_transfer_data; + + class UHCI : public BusManager { public: UHCI(pci_info *info, Stack *stack); @@ -75,6 +91,7 @@ status_t Start(); virtual status_t SubmitTransfer(Transfer *transfer); virtual status_t CancelQueuedTransfers(Pipe *pipe); + status_t CancelQueuedIsochronousTransfers(Pipe *pipe); status_t SubmitRequest(Transfer *transfer); status_t SubmitIsochronous(Transfer *transfer); @@ -103,6 +120,11 @@ uhci_td *firstDescriptor, uhci_td *dataDescriptor, bool directionIn); + status_t AddPendingIsochronousTransfer( + Transfer *transfer, + uhci_td **isoRequest, + bool directionIn); + static int32 FinishThread(void *data); void FinishTransfers(); @@ -110,10 +132,25 @@ [... truncated: 110 lines follow ...] From stippi at mail.berlios.de Mon Jun 25 23:11:57 2007 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 25 Jun 2007 23:11:57 +0200 Subject: [Haiku-commits] r21504 - in haiku/trunk/src/add-ons/media/plugins: . xvid_decoder Message-ID: <200706252111.l5PLBvxk020059@sheep.berlios.de> Author: stippi Date: 2007-06-25 23:11:55 +0200 (Mon, 25 Jun 2007) New Revision: 21504 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21504&view=rev Added: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/Jamfile haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.h haiku/trunk/src/add-ons/media/plugins/xvid_decoder/supported_codecs.cpp haiku/trunk/src/add-ons/media/plugins/xvid_decoder/supported_codecs.h haiku/trunk/src/add-ons/media/plugins/xvid_decoder/xvid.h Log: * implemented an xvid based decoder plugin -> It is currently disabled, because it won't link. I would need to add xvid to the tree, but that would add nasm as a build dependency. I need to talk this over with Ingo. However, it is quite easy to build xvid yourself and link the decoder, should you want to test it. It works fine under ZETA when compiled to use the undocumented R5 Decoder API. Added: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/Jamfile =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/Jamfile 2007-06-25 19:51:12 UTC (rev 21503) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/Jamfile 2007-06-25 21:11:55 UTC (rev 21504) @@ -0,0 +1,16 @@ +SubDir HAIKU_TOP src add-ons media plugins xvid_decoder ; + +UsePrivateHeaders media ; + +#SubDirHdrs [ FDirName $(SUBDIR) libxvid ] ; + +Addon xvid.decoder : + XvidDecoder.cpp + supported_codecs.cpp + : + libxvid.a + be + libmedia.so +; + +#SubInclude HAIKU_TOP src add-ons media plugins xvid_decoder libxvid ; Added: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp 2007-06-25 19:51:12 UTC (rev 21503) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp 2007-06-25 21:11:55 UTC (rev 21504) @@ -0,0 +1,718 @@ +/* + * XvidDecoder.cpp - XviD plugin for the Haiku Operating System + * + * Copyright (C) 2007 Stephan A?mus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#define DEBUG 0 + +#include "XvidDecoder.h" + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "supported_codecs.h" + + +using std::nothrow; + + +#if DEBUG +static const char* +media_type_name(int type) +{ + switch (type) { + case B_MEDIA_NO_TYPE: + return "B_MEDIA_NO_TYPE"; + case B_MEDIA_RAW_AUDIO: + return "B_MEDIA_RAW_AUDIO"; + case B_MEDIA_RAW_VIDEO: + return "B_MEDIA_RAW_VIDEO"; + case B_MEDIA_VBL: + return "B_MEDIA_VBL"; + case B_MEDIA_TIMECODE: + return "B_MEDIA_TIMECODE"; + case B_MEDIA_MIDI: + return "B_MEDIA_MIDI"; + case B_MEDIA_TEXT: + return "B_MEDIA_TEXT"; + case B_MEDIA_HTML: + return "B_MEDIA_HTML"; + case B_MEDIA_MULTISTREAM: + return "B_MEDIA_MULTISTREAM"; + case B_MEDIA_PARAMETERS: + return "B_MEDIA_PARAMETERS"; + case B_MEDIA_ENCODED_AUDIO: + return "B_MEDIA_ENCODED_AUDIO"; + case B_MEDIA_ENCODED_VIDEO: + return "B_MEDIA_ENCODED_VIDEO"; + + case B_MEDIA_UNKNOWN_TYPE: + default: + return "B_MEDIA_UNKNOWN_TYPE"; + } +} + +static char +make_printable_char(uchar c) +{ + if (c >= 0x20 && c < 0x7F) + return c; + return '.'; +} + +static void +print_hex(unsigned char* buff, int len) +{ + int i, j; + for(i=0; itype), mh->size_used, mh->start_time, + int((mh->start_time / 60000000) % 60), + int((mh->start_time / 1000000) % 60), + int((mh->start_time / 10000) % 100), + (long)mh->u.raw_video.field_sequence, + //&(mh->user_data_type), + (long)mh->file_pos, + (long)mh->orig_size, + mh->data_offset); +} + +static void +print_media_decode_info(media_decode_info *info) +{ + if (info) { + printf("media_decode_info {time_to_decode: %lld, " + "file_format_data_size: %ld, codec_data_size: %ld}\n", + info->time_to_decode, info->file_format_data_size, + info->codec_data_size); + } else + printf("media_decode_info (null)\n"); +} +#endif // DEBUG + + +// #pragma mark - + + +#define MIN_USEFUL_BYTES 1 + + +XvidDecoder::XvidDecoder() + : Decoder() + , fInputFormat() + , fOutputVideoFormat() + + , fXvidDecoderHandle(NULL) + , fXvidColorspace(0) + + , fFrame(0) + , fIndexInCodecTable(-1) + + , fChunkBuffer(NULL) + , fChunkBufferHandle(NULL) + , fChunkBufferSize(0) + , fLeftInChunkBuffer(0) + , fDiscontinuity(false) +{ +} + + +XvidDecoder::~XvidDecoder() +{ + _XvidUninit(); +} + + +void +XvidDecoder::GetCodecInfo(media_codec_info* mci) +{ + PRINT(("XvidDecoder::GetCodecInfo()\n")); + + if (mci == NULL) + return;// B_BAD_VALUE; + + if (fIndexInCodecTable < 0) + return;// B_NO_INIT; + + sprintf(mci->short_name, "xvid"); + sprintf(mci->pretty_name, "xvid - %s)", + gCodecTable[fIndexInCodecTable].prettyName); + + mci->id = 0; + mci->sub_id = 0; + + return;// B_OK; +} + + +status_t +XvidDecoder::Setup(media_format* inputFormat, const void* inInfo, + size_t inSize) +{ + if (inputFormat == NULL) + return B_BAD_VALUE; + + if (inputFormat->type != B_MEDIA_ENCODED_VIDEO) + return B_BAD_VALUE; + + PRINT(("XvidDecoder::Sniff()\n")); + +//#if DEBUG +// char buffer[1024]; +// string_for_format(*inputFormat, buffer, sizeof(buffer)); +// PRINT((" inputFormat=%s\n", buffer)); +// PRINT((" inSize=%d\n", inSize)); +// print_hex((uchar*)inInfo, inSize); +// PRINT((" user_data_type=%08lx\n", (int)inputFormat->user_data_type)); +// print_hex((uchar*)inputFormat->user_data, 48); +//#endif + + uint32 codecID = 0; + media_format_family familyID = B_ANY_FORMAT_FAMILY; + + // hacky... get the exact 4CC from there if it's in, to help xvid + // handle broken files +// if ((inputFormat->user_data_type == B_CODEC_TYPE_INFO) +// && !memcmp(inputFormat->user_data, "AVI ", 4)) { +// codecID = ((uint32*)inputFormat->user_data)[1]; +// familyID = B_AVI_FORMAT_FAMILY; +// PRINT(("XvidDecoder::Sniff() - AVI 4CC: %4s\n", +// inputFormat->user_data + 4)); +// } + + if (codecID == 0) { + BMediaFormats formats; + media_format_description descr; + if (formats.GetCodeFor(*inputFormat, B_QUICKTIME_FORMAT_FAMILY, + &descr) == B_OK) { + codecID = descr.u.quicktime.codec; + familyID = B_QUICKTIME_FORMAT_FAMILY; + + #if DEBUG + uint32 bigEndianID = B_HOST_TO_BENDIAN_INT32(codecID); + PRINT(("XvidDecoder::Sniff() - QT 4CC: %.4s\n", (const char*)&bigEndianID)); + #endif + } else if (formats.GetCodeFor(*inputFormat, B_AVI_FORMAT_FAMILY, + &descr) == B_OK) { + codecID = descr.u.avi.codec; + familyID = B_AVI_FORMAT_FAMILY; + + #if DEBUG + uint32 bigEndianID = B_HOST_TO_BENDIAN_INT32(codecID); + PRINT(("XvidDecoder::Sniff() - AVI 4CC: %.4s\n", (const char*)&codecID)); + #endif + } + } + + if (codecID == 0) + return B_ERROR; + + for (int32 i = 0; i < gSupportedCodecsCount; i++) { + if (gCodecTable[i].family == familyID + && gCodecTable[i].fourcc == codecID) { + PRINT(("XvidDecoder::Sniff() - found codec in the table at %ld.\n", i)); + fIndexInCodecTable = i; + fInputFormat = *inputFormat; + return B_OK; + } + } + + PRINT(("XvidDecoder::Sniff() - no matching codec found in the table.\n")); + + return B_ERROR; +} + + +status_t +XvidDecoder::NegotiateOutputFormat(media_format* _inoutFormat) +{ + PRINT((" XvidDecoder::NegotiateOutputFormat()\n")); + + if (_inoutFormat == NULL) + return B_BAD_VALUE; + +#if DEBUG + char buffer[1024]; + if (string_for_format(*_inoutFormat, buffer, sizeof(buffer)) == B_OK) + PRINT((" _inoutFormat = %s\n", buffer)); +#endif + + // init our own output format from the sniffed values + fOutputVideoFormat = fInputFormat.u.encoded_video.output; + + // suggest a default colorspace + color_space askedFormat = _inoutFormat->u.raw_video.display.format; + color_space supportedFormat; + uint32 bpr; + switch (askedFormat) { + case B_NO_COLOR_SPACE: + // suggest preferred format + case B_YCbCr422: + supportedFormat = B_YCbCr422; + fXvidColorspace = XVID_CSP_YUY2; + bpr = fOutputVideoFormat.display.line_width * 2; + break; + case B_YCbCr420: + supportedFormat = askedFormat; + fXvidColorspace = XVID_CSP_I420; + bpr = fOutputVideoFormat.display.line_width + + (fOutputVideoFormat.display.line_width + 1) / 2; + break; + case B_RGB32_BIG: + supportedFormat = askedFormat; + fXvidColorspace = XVID_CSP_RGBA; + bpr = fOutputVideoFormat.display.line_width * 4; + break; + case B_RGB24: + supportedFormat = askedFormat; + fXvidColorspace = XVID_CSP_BGR; + bpr = fOutputVideoFormat.display.line_width * 3; + break; + case B_RGB16: + supportedFormat = askedFormat; + fXvidColorspace = XVID_CSP_RGB565; + bpr = fOutputVideoFormat.display.line_width * 2; + break; + case B_RGB15: + supportedFormat = askedFormat; + fXvidColorspace = XVID_CSP_RGB555; + bpr = fOutputVideoFormat.display.line_width * 2; + break; + + default: + fprintf(stderr, "XvidDecoder::NegotiateOutputFormat() - Application " + "asked for unsupported colorspace, using fallback " + "of B_RGB32.\n"); + case B_RGB32: + supportedFormat = B_RGB32; + fXvidColorspace = XVID_CSP_BGRA; + bpr = fOutputVideoFormat.display.line_width * 4; + break; + } + + // enforce the colorspace we support + fOutputVideoFormat.display.format = supportedFormat; + _inoutFormat->u.raw_video.display.format = supportedFormat; + + // enforce supported bytes per row + bpr = max_c(_inoutFormat->u.raw_video.display.bytes_per_row, + ((bpr + 3) / 4) * 4); + fOutputVideoFormat.display.bytes_per_row = bpr; + _inoutFormat->u.raw_video.display.bytes_per_row = bpr; + + _inoutFormat->type = B_MEDIA_RAW_VIDEO; + _inoutFormat->u.raw_video = fOutputVideoFormat; + _inoutFormat->require_flags = 0; + _inoutFormat->deny_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS; + +#if DEBUG + string_for_format(*_inoutFormat, buffer, sizeof(buffer)); + PRINT(("XvidDecoder: out_format=%s\n", buffer)); +#endif + + return _XvidInit(true, 0) == 0 ? B_OK : B_ERROR; +} + + +status_t +XvidDecoder::Decode(void* outBuffer, int64 *outFrameCount, media_header *mh, + media_decode_info *info) +{ + if (outBuffer == NULL || outFrameCount == NULL || mh == NULL) + return B_BAD_VALUE; + + PRINT(("XvidDecoder::Decode()\n")); + + // are we in a hurry ? + bool hurryUp = (!info || (info->time_to_decode > 0)) ? false : true; + + mh->type = B_MEDIA_RAW_VIDEO; + mh->start_time = 0; + mh->size_used = 0; + mh->file_pos = 0; + mh->orig_size = 0; + mh->data_offset = 0; + mh->u.raw_video.field_gamma = 1.0; + mh->u.raw_video.field_sequence = 0; + mh->u.raw_video.field_number = 0; + mh->u.raw_video.pulldown_number = 0; + mh->u.raw_video.first_active_line = 1; + mh->u.raw_video.line_count = 0; + + #if DEBUG + int32 chunk = 0; + #endif + + status_t ret = B_OK; + + do { + if (fLeftInChunkBuffer <= MIN_USEFUL_BYTES) { + // read new data + ret = GetNextChunk(&fChunkBuffer, &fChunkBufferSize, mh); + if (ret >= B_OK) { + fLeftInChunkBuffer = fChunkBufferSize; + fChunkBufferHandle = (const char*)fChunkBuffer; + } else { + fChunkBufferSize = 0; + fChunkBuffer = NULL; + fChunkBufferHandle = NULL; + } + } + + // Check if there is a negative number of useful bytes left in buffer + // This means we went too far + if (!fChunkBufferHandle || fLeftInChunkBuffer < 0) { + break; + } + + xvid_dec_stats_t xvidDecoderStats; + + // This loop is needed to handle VOL/NVOP reading + do { + // Decode frame + int usedBytes = _XvidDecode((uchar*)fChunkBufferHandle, (uchar*)outBuffer, + fLeftInChunkBuffer, &xvidDecoderStats, hurryUp); + + // Resize image buffer if needed + if (xvidDecoderStats.type == XVID_TYPE_VOL) { + + // Check if old buffer is smaller + if ((int)(fOutputVideoFormat.display.line_width + * fOutputVideoFormat.display.line_count) + < xvidDecoderStats.data.vol.width + * xvidDecoderStats.data.vol.height) { + + PRINT(("XvidDecoder::Decode() - image size changed!\n", + xvidDecoderStats.data.vol.width, + xvidDecoderStats.data.vol.height)); + + return B_ERROR; + } + } + + // Update buffer pointers + if (usedBytes > 0) { + fChunkBufferHandle += usedBytes; + fLeftInChunkBuffer -= usedBytes; + } + + PRINT(("XvidDecoder::Decode() - chunk %d: %d bytes consumed, " + "%d bytes in buffer\n", chunk++, usedBytes, fLeftInChunkBuffer)); + + } while (xvidDecoderStats.type <= 0 + && fLeftInChunkBuffer > MIN_USEFUL_BYTES); + + if (xvidDecoderStats.type > XVID_TYPE_NOTHING) { + // got a full frame + mh->size_used = fOutputVideoFormat.display.line_count + * fOutputVideoFormat.display.bytes_per_row; + break; + } + + } while (fLeftInChunkBuffer > MIN_USEFUL_BYTES || ret >= B_OK); + + if (ret != B_OK) + return ret; + + fFrame++; + + mh->start_time = (bigtime_t) (1000000.0 * fFrame / fOutputVideoFormat.field_rate); + mh->u.raw_video.field_sequence = fFrame; + mh->u.raw_video.line_count = fOutputVideoFormat.display.line_count; +/**/ + PRINT(("XvidDecoder::Decode() - start_time=%02d:%02d.%02d field_sequence=%u\n", + int((mh->start_time / 60000000) % 60), + int((mh->start_time / 1000000) % 60), + int((mh->start_time / 10000) % 100), + mh->u.raw_video.field_sequence)); +/**/ + +#if DEBUG + print_media_header(mh); + print_media_decode_info(info); +#endif + + return B_OK; +} + + +status_t +XvidDecoder::Seek(uint32 inToWhat, int64 inRequiredFrame, int64 *_inOutFrame, + bigtime_t inRequiredTime, bigtime_t *_inOutTime) +{ + PRINT((" XvidDecoder::Seek(flags=%ld, inRequiredFrame=%lld, _inOutFrame=%lld, " + "inRequiredTime=%lld, _inOutTime=%lld)\n", inToWhat, inRequiredFrame, + *_inOutFrame, inRequiredTime, *_inOutTime)); + +// printf(" XvidDecoder::Reset(flags=%ld, inRequiredFrame=%lld, _inOutFrame=%lld, " +// "inRequiredTime=%lld, _inOutTime=%lld)\n", inToWhat, inRequiredFrame, +// *_inOutFrame, inRequiredTime, *_inOutTime); + +// status_t ret = B_OK; +// if (inToWhat & B_MEDIA_SEEK_TO_FRAME) { +// int64 wantedFrame = *_inOutFrame; +// ret = fTrack->FindKeyFrameForFrame(_inOutFrame, B_MEDIA_SEEK_CLOSEST_BACKWARD); +// if (ret == B_OK && *_inOutFrame != wantedFrame) { +// ret = fTrack->SeekToFrame(_inOutFrame, 0); +// // note, this might cause us to enter the function +// // again, but that's ok as long as we can seek to the frame +// } +// } else if (inToWhat & B_MEDIA_SEEK_TO_TIME) { +// bigtime_t wantedTime = *_inOutTime; +// ret = fTrack->FindKeyFrameForTime(_inOutTime, B_MEDIA_SEEK_CLOSEST_BACKWARD); +// if (ret == B_OK && *_inOutTime != wantedTime) { +// ret = fTrack->SeekToTime(_inOutTime, 0); +// // note, this might cause us to enter the function +// // again, but that's ok as long as we can seek to the frame +// *_inOutFrame = fTrack->CurrentFrame(); +// } +// } +// +// if (ret != B_OK) { +// fprintf(stderr, "XvidDecoder::Seek() - failed to seek\n"); +// return ret; +// } +// + // TODO: reset xvid decode info? + fFrame = *_inOutFrame; + + fChunkBuffer = NULL; + fChunkBufferHandle = NULL; + fChunkBufferSize = 0; + fLeftInChunkBuffer = 0; + + fDiscontinuity = true; + + return B_OK; +} + + +// #pragma mark - + + +// _XvidInit +int +XvidDecoder::_XvidInit(int useAssembler, int debugLevel) +{ + int ret = _XvidUninit(); + if (ret < 0) + return ret; + + xvid_gbl_init_t xvidGlobalInit; + xvid_dec_create_t xvidDecoderCreate; + + // reset the structure with zeros + memset(&xvidGlobalInit, 0, sizeof(xvid_gbl_init_t)); + memset(&xvidDecoderCreate, 0, sizeof(xvid_dec_create_t)); + + // XviD core initialization + + // version + xvidGlobalInit.version = XVID_VERSION; + + // assembly usage setting + if (useAssembler) + xvidGlobalInit.cpu_flags = 0; + else + xvidGlobalInit.cpu_flags = XVID_CPU_FORCE; + + xvidGlobalInit.debug = debugLevel; + + xvid_global(NULL, 0, &xvidGlobalInit, NULL); + + // XviD encoder initialization + + // version + xvidDecoderCreate.version = XVID_VERSION; + + // bitmap dimensions -- xvidcore will resize when needed + xvidDecoderCreate.width = 0; + xvidDecoderCreate.height = 0; + + ret = xvid_decore(NULL, XVID_DEC_CREATE, &xvidDecoderCreate, NULL); + + if (ret == 0) + fXvidDecoderHandle = xvidDecoderCreate.handle; + + return ret; +} + +// _XvidUninit +int +XvidDecoder::_XvidUninit() +{ + if (fXvidDecoderHandle == NULL) + return 0; + + int ret = xvid_decore(fXvidDecoderHandle, XVID_DEC_DESTROY, NULL, NULL); + if (ret == 0) { + fXvidDecoderHandle = NULL; + fXvidColorspace = 0; + } + return ret; +} + +// _XvidDecode +int +XvidDecoder::_XvidDecode(uchar *istream, uchar *ostream, int inStreamSize, + xvid_dec_stats_t* xvidDecoderStats, bool hurryUp) +{ + PRINT(("XvidDecoder::_XvidDecode(%p, %p, %d)\n", istream, ostream, + inStreamSize)); + + if (istream == NULL || inStreamSize == 0) + return -1; + + xvid_dec_frame_t xvid_dec_frame; + + // reset all structures + memset(&xvid_dec_frame, 0, sizeof(xvid_dec_frame_t)); + memset(xvidDecoderStats, 0, sizeof(xvid_dec_stats_t)); + + // set version + xvid_dec_frame.version = XVID_VERSION; + xvidDecoderStats->version = XVID_VERSION; + + // no general flags to set + xvid_dec_frame.general = 0; //XVID_DEBLOCKY | XVID_DEBLOCKUV; + if (hurryUp) + xvid_dec_frame.general |= XVID_LOWDELAY; + if (fDiscontinuity) { + xvid_dec_frame.general |= XVID_DISCONTINUITY; + fDiscontinuity = false; + } + + // input stream + xvid_dec_frame.bitstream = istream; + xvid_dec_frame.length = inStreamSize; + + // output frame structure + xvid_dec_frame.output.plane[0] = ostream; + xvid_dec_frame.output.stride[0] = ostream ? + fOutputVideoFormat.display.bytes_per_row : 0; + xvid_dec_frame.output.csp = fXvidColorspace; + + return xvid_decore(fXvidDecoderHandle, XVID_DEC_DECODE, &xvid_dec_frame, + xvidDecoderStats); +} + +// #pragma mark - + + +status_t +XvidPlugin::GetSupportedFormats(media_format** _mediaFormatArray, size_t *_count) +{ + PRINT(("XvidDecoder::register_decoder()\n")); + + static bool codecsRegistered = false; + if (codecsRegistered) + return B_OK; + codecsRegistered = true; + + PRINT(("XvidDecoder: registering %d codecs\n", gSupportedCodecsCount)); + + media_format_description descr[gSupportedCodecsCount]; + + for (int i = 0; i < gSupportedCodecsCount; i++) { + descr[i].family = gCodecTable[i].family; + switch(descr[i].family) { + case B_AVI_FORMAT_FAMILY: + descr[i].u.avi.codec = gCodecTable[i].fourcc; + break; + case B_MPEG_FORMAT_FAMILY: + descr[i].u.mpeg.id = gCodecTable[i].fourcc; + break; + case B_QUICKTIME_FORMAT_FAMILY: + descr[i].u.quicktime.codec = gCodecTable[i].fourcc; + break; + default: + break; + } + } + + BMediaFormats formats; + for (int i = 0; i < gSupportedCodecsCount; i++) { + media_format format; + format.type = B_MEDIA_ENCODED_VIDEO; + format.u.encoded_video = media_encoded_video_format::wildcard; + format.require_flags = 0; + format.deny_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS; + + status_t err = formats.MakeFormatFor(&descr[i], 1, &format); + + if (err < B_OK) { + fprintf(stderr, "XvidDecoder: BMediaFormats::MakeFormatFor: " + "error %s\n", strerror(err)); + return err; + } + + gXvidFormats[i] = format; + } + + *_mediaFormatArray = gXvidFormats; + *_count = gSupportedCodecsCount; + + return B_OK; +} + + +Decoder* +XvidPlugin::NewDecoder(uint index) +{ + return new (nothrow) XvidDecoder(); +} + + +MediaPlugin *instantiate_plugin() +{ + return new (nothrow) XvidPlugin; +} + + Added: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.h 2007-06-25 19:51:12 UTC (rev 21503) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.h 2007-06-25 21:11:55 UTC (rev 21504) @@ -0,0 +1,92 @@ +/* + * XvidDecoder.h - XviD plugin for the Haiku Operating System + * + * Copyright (C) 2007 Stephan A?mus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#ifndef XVID_DECODER_H +#define XVID_DECODER_H + + +#include +#include + +#include "DecoderPlugin.h" +#include "xvid.h" + + +class XvidDecoder : public Decoder { + public: + XvidDecoder(); + + virtual ~XvidDecoder(); + + virtual void GetCodecInfo(media_codec_info *mci); + + virtual status_t Setup(media_format* inputFormat, + const void* inInfo, size_t inSize); + + virtual status_t NegotiateOutputFormat( + media_format *outputFormat); + + virtual status_t Decode(void* outBuffer, int64* outFrameCount, + media_header* mh, media_decode_info* info); + + virtual status_t Seek(uint32 inToWhat, int64 inRequiredFrame, + int64* _inOutFrame, + bigtime_t inRequiredTime, + bigtime_t* _inOutTime); + + protected: + media_header fHeader; + media_decode_info fInfo; + + private: + int _XvidInit(int useAssembler, int debugLevel); + int _XvidUninit(); + + int _XvidDecode(uchar *istream, uchar *ostream, + int inStreamSize, + xvid_dec_stats_t* xvidDecoderStats, + bool hurryUp); + + media_format fInputFormat; + media_raw_video_format fOutputVideoFormat; + + void* fXvidDecoderHandle; + int fXvidColorspace; + + int64 fFrame; + int32 fIndexInCodecTable; + + const void* fChunkBuffer; + const char* fChunkBufferHandle; + size_t fChunkBufferSize; + int32 fLeftInChunkBuffer; + + bool fDiscontinuity; +}; + + +class XvidPlugin : public DecoderPlugin { + public: + Decoder* NewDecoder(uint index); + status_t GetSupportedFormats( + media_format** formats, size_t* count); +}; + + +#endif // XVID_DECODER_H Added: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/supported_codecs.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/supported_codecs.cpp 2007-06-25 19:51:12 UTC (rev 21503) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/supported_codecs.cpp 2007-06-25 21:11:55 UTC (rev 21504) @@ -0,0 +1,75 @@ +/* + * supported_codecs.cpp - XviD plugin for the Haiku Operating System + * + * Copyright (C) 2007 Stephan A?mus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#include + +#include "supported_codecs.h" + +const struct codec_table_entry gCodecTable[] = { + {B_QUICKTIME_FORMAT_FAMILY, '3IV1', "3ivx Delta v1"}, + {B_QUICKTIME_FORMAT_FAMILY, '3IV2', "3ivx v2"}, + + {B_QUICKTIME_FORMAT_FAMILY, 'DIVX', "MPEG4 Video"}, // OpenDivX + {B_QUICKTIME_FORMAT_FAMILY, 'divx', "MPEG4 Video"}, // OpenDivX + {B_QUICKTIME_FORMAT_FAMILY, 'mp4v', "MPEG4 Video"}, // OpenDivX + {B_QUICKTIME_FORMAT_FAMILY, 'XVID', "XVID"}, // OpenDivX + + {B_AVI_FORMAT_FAMILY, 'DIVX', "MPEG4 Video"}, // OpenDivX + {B_AVI_FORMAT_FAMILY, 'divx', "MPEG4 Video"}, // OpenDivX + {B_AVI_FORMAT_FAMILY, 'XVID', "XVID"}, // XVID + {B_AVI_FORMAT_FAMILY, 'xvid', "XVID"}, // XVID + {B_AVI_FORMAT_FAMILY, 'DX50', "DivX 5"}, // DivX 5.0 + {B_AVI_FORMAT_FAMILY, 'dx50', "DivX 5"}, // DivX 5.0 + + {B_AVI_FORMAT_FAMILY, 'MP4S', "MPEG4 Video"}, // from ffmpeg + {B_AVI_FORMAT_FAMILY, 'M2S2', "MPEG4 Video"}, // from ffmpeg + {B_AVI_FORMAT_FAMILY, 'M4S2', "MPEG4 Video"}, // from ffmpeg + + {B_AVI_FORMAT_FAMILY, 'DIV1', "MPEG4 Video"}, // from mplayer + {B_AVI_FORMAT_FAMILY, 'BLZ0', "MPEG4 Video"}, // from mplayer + {B_AVI_FORMAT_FAMILY, 'mp4v', "MPEG4 Video"}, // from mplayer -- OpenDivx + {B_AVI_FORMAT_FAMILY, 'UMP4', "MPEG4 Video"}, // from mplayer + + {B_AVI_FORMAT_FAMILY, 'FMP4', "FFMpeg MPEG4 Video"}, // ffmpeg's own version + + + {B_AVI_FORMAT_FAMILY, '\004\0\0\0', "MPEG4 Video"}, // some broken avi use this +// {B_AVI_FORMAT_FAMILY, 'DIV3', "DivX ;-)"}, // default signature when + // using MSMPEG4 +// {B_AVI_FORMAT_FAMILY, 'div3', "DivX ;-)"}, +// {B_AVI_FORMAT_FAMILY, 'DIV4', "DivX ;-)"}, +// {B_AVI_FORMAT_FAMILY, 'div4', "DivX ;-)"}, +// {B_AVI_FORMAT_FAMILY, 'DIV2', "DivX ;-)"}, +// {B_AVI_FORMAT_FAMILY, 'DIV5', "DivX ;-)"}, +// {B_AVI_FORMAT_FAMILY, 'DIV6', "DivX ;-)"}, +// {B_AVI_FORMAT_FAMILY, 'COL0', "DivX ;-)"}, +// {B_AVI_FORMAT_FAMILY, 'COL1', "DivX ;-)"}, + +// {B_AVI_FORMAT_FAMILY, 'MP41', "Microsoft MPEG4 v1"}, // microsoft mpeg4 v1 +// {B_AVI_FORMAT_FAMILY, 'MP42', "Microsoft MPEG4 v2"}, // seems to be broken +// {B_AVI_FORMAT_FAMILY, 'MP43', "Microsoft MPEG4 v3"}, // microsoft mpeg4 v3 +// {B_AVI_FORMAT_FAMILY, 'MPG3', "Microsoft MPEG4"}, +// {B_AVI_FORMAT_FAMILY, 'MPG4', "Microsoft MPEG4"}, +// {B_AVI_FORMAT_FAMILY, 'AP41', "Angel Potion MPEG4"}, // AngelPotion 1 +}; + +const int gSupportedCodecsCount = sizeof(gCodecTable) / sizeof(codec_table_entry); + +media_format gXvidFormats[gSupportedCodecsCount]; + Added: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/supported_codecs.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/supported_codecs.h 2007-06-25 19:51:12 UTC (rev 21503) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/supported_codecs.h 2007-06-25 21:11:55 UTC (rev 21504) @@ -0,0 +1,38 @@ +/* + * supported_codecs.h - XviD plugin for the Haiku Operating System + * + * Copyright (C) 2007 Stephan A?mus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#ifndef SUPPORTED_CODECS_H +#define SUPPORTED_CODECS_H + + +#include + + +struct codec_table_entry { + media_format_family family; + uint32 fourcc; + const char* prettyName; +}; + +extern const struct codec_table_entry gCodecTable[]; +extern const int gSupportedCodecsCount; +extern media_format gXvidFormats[]; + + +#endif // SUPPORTED_CODECS_H Added: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/xvid.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/xvid.h 2007-06-25 19:51:12 UTC (rev 21503) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/xvid.h 2007-06-25 21:11:55 UTC (rev 21504) @@ -0,0 +1,786 @@ +/***************************************************************************** + * + * XVID MPEG-4 VIDEO CODEC + * - XviD Main header file - + * + * Copyright(C) 2001-2004 Peter Ross + * + * This program is free software ; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation ; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY ; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program ; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id: xvid.h,v 1.51.2.4 2006/11/01 10:17:27 Isibaar Exp $ + * + ****************************************************************************/ + +#ifndef _XVID_H_ [... truncated: 761 lines follow ...] From axeld at mail.berlios.de Tue Jun 26 01:38:46 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 26 Jun 2007 01:38:46 +0200 Subject: [Haiku-commits] r21505 - in haiku/trunk: headers/os/app src/kits/app Message-ID: <200706252338.l5PNckV8013816@sheep.berlios.de> Author: axeld Date: 2007-06-26 01:38:45 +0200 (Tue, 26 Jun 2007) New Revision: 21505 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21505&view=rev Modified: haiku/trunk/headers/os/app/Application.h haiku/trunk/src/kits/app/Application.cpp Log: * Removed _GetWindowList() * _WindowAt() and _CountWindows() now have an individual version of that code which should be magnitudes faster. * _WindowQuitLoop() no longer handles hidden windows specially - instead, it now walks the window list in the correct direction which should fix the issues. * Also, it now uses WindowAt() and thus has an up-to-date view of the window list (it will no longer ignore new windows). * And finally, it will no longer dereference an unsafe pointer (for BWindow::IsFilePanel()). Modified: haiku/trunk/headers/os/app/Application.h =================================================================== --- haiku/trunk/headers/os/app/Application.h 2007-06-25 21:11:55 UTC (rev 21504) +++ haiku/trunk/headers/os/app/Application.h 2007-06-25 23:38:45 UTC (rev 21505) @@ -141,7 +141,6 @@ uint32 InitialWorkspace(); int32 _CountWindows(bool includeMenus) const; BWindow* _WindowAt(uint32 index, bool includeMenus) const; - status_t _GetWindowList(BList* list, bool includeMenus) const; static BResources* sAppResources; static BLocker sAppResourcesLock; Modified: haiku/trunk/src/kits/app/Application.cpp =================================================================== --- haiku/trunk/src/kits/app/Application.cpp 2007-06-25 21:11:55 UTC (rev 21504) +++ haiku/trunk/src/kits/app/Application.cpp 2007-06-25 23:38:45 UTC (rev 21505) @@ -1065,79 +1065,86 @@ } } else if (strcmp("Window", property) == 0) { switch (what) { - case B_INDEX_SPECIFIER: - case B_REVERSE_INDEX_SPECIFIER: { - int32 ind = -1; - err = specifier->FindInt32("index", &ind); - if (err != B_OK) + case B_INDEX_SPECIFIER: + case B_REVERSE_INDEX_SPECIFIER: + { + int32 index = -1; + err = specifier->FindInt32("index", &index); + if (err != B_OK) + break; + if (what == B_REVERSE_INDEX_SPECIFIER) + index = CountWindows() - index; + err = B_BAD_INDEX; + BWindow *win = WindowAt(index); + if (!win) + break; + BMessenger messenger(win); + err = reply.AddMessenger("result", messenger); break; - if (what == B_REVERSE_INDEX_SPECIFIER) - ind = CountWindows() - ind; - err = B_BAD_INDEX; - BWindow *win = WindowAt(ind); - if (!win) - break; - BMessenger messenger(win); - err = reply.AddMessenger("result", messenger); - break; - } - case B_NAME_SPECIFIER: { - const char *name; - err = specifier->FindString("name", &name); - if (err != B_OK) - break; - err = B_NAME_NOT_FOUND; - for (int32 i=0; iName() && strlen(win->Name()) == strlen(name) - && !strcmp(win->Name(), name)) { - BMessenger messenger(win); - err = reply.AddMessenger("result", messenger); + } + case B_NAME_SPECIFIER: + { + const char *name; + err = specifier->FindString("name", &name); + if (err != B_OK) break; + err = B_NAME_NOT_FOUND; + for (int32 i = 0; i < CountWindows(); i++) { + BWindow* window = WindowAt(i); + if (window && window->Name() != NULL + && !strcmp(window->Name(), name)) { + BMessenger messenger(window); + err = reply.AddMessenger("result", messenger); + break; + } } + break; } } - } } else if (strcmp("Looper", property) == 0) { switch (what) { - case B_INDEX_SPECIFIER: - case B_REVERSE_INDEX_SPECIFIER: { - int32 ind = -1; - err = specifier->FindInt32("index", &ind); - if (err != B_OK) + case B_INDEX_SPECIFIER: + case B_REVERSE_INDEX_SPECIFIER: + { + int32 index = -1; + err = specifier->FindInt32("index", &index); + if (err != B_OK) + break; + if (what == B_REVERSE_INDEX_SPECIFIER) + index = CountLoopers() - index; + err = B_BAD_INDEX; + BLooper *looper = LooperAt(index); + if (!looper) + break; + BMessenger messenger(looper); + err = reply.AddMessenger("result", messenger); break; - if (what == B_REVERSE_INDEX_SPECIFIER) - ind = CountLoopers() - ind; - err = B_BAD_INDEX; - BLooper *looper = LooperAt(ind); - if (!looper) - break; - BMessenger messenger(looper); - err = reply.AddMessenger("result", messenger); - break; - } - case B_NAME_SPECIFIER: { - const char *name; - err = specifier->FindString("name", &name); - if (err != B_OK) - break; - err = B_NAME_NOT_FOUND; - for (int32 i=0; iName() && strlen(looper->Name()) == strlen(name) - && !strcmp(looper->Name(), name)) { - BMessenger messenger(looper); - err = reply.AddMessenger("result", messenger); + } + case B_NAME_SPECIFIER: + { + const char *name; + err = specifier->FindString("name", &name); + if (err != B_OK) break; + err = B_NAME_NOT_FOUND; + for (int32 i = 0; i < CountLoopers(); i++) { + BLooper *looper = LooperAt(i); + if (looper && looper->Name() + && !strcmp(looper->Name(), name)) { + BMessenger messenger(looper); + err = reply.AddMessenger("result", messenger); + break; + } } + break; } - break; + case B_ID_SPECIFIER: + { + // TODO + debug_printf("Looper's ID specifier used but not implemented.\n"); + break; + } } - case B_ID_SPECIFIER: { - // TODO - break; - } - } } else if (strcmp("Name", property) == 0) { err = reply.AddString("result", Name()); } @@ -1150,13 +1157,13 @@ } break; } - if (err == B_BAD_SCRIPT_SYNTAX) { + if (err == B_BAD_SCRIPT_SYNTAX) return false; - } + if (err < B_OK) { - reply.what = B_MESSAGE_NOT_UNDERSTOOD; - reply.AddString("message", strerror(err)); - } + reply.what = B_MESSAGE_NOT_UNDERSTOOD; + reply.AddString("message", strerror(err)); + } reply.AddInt32("error", err); message->SendReply(&reply); return true; @@ -1322,58 +1329,42 @@ bool BApplication::_WindowQuitLoop(bool quitFilePanels, bool force) { - BList looperList; - { - AutoLocker listLock(gLooperList); - if (listLock.IsLocked()) { - gLooperList.GetLooperList(&looperList); + int32 index = 0; + while (true) { + BWindow *window = WindowAt(index); + if (window == NULL) + break; - // Filter the list: We replace the BLooper pointers by BWindow - // pointers (dynamic_cast<>() on unlocked loopers is only safe as - // long as the looper list is locked!). Furthermore we filter out - // windows, that have not been run yet -- those belong to their - // creator yet (which also has a lock) and we must not try to - // delete them. - int32 count = looperList.CountItems(); - for (int32 i = 0; i < count; i++) { - BWindow *window - = dynamic_cast((BLooper*)looperList.ItemAt(i)); - if (window && window->Thread() < 0) - window = NULL; - looperList.ReplaceItem(i, window); - } - } - } - - for (int32 i = looperList.CountItems(); i-- > 0; ) { - BWindow *window = (BWindow*)looperList.ItemAt(i); - - // don't quit file panels if we haven't been asked for it - // NOTE: the window pointer will be NULL if the looper was not - // a BWindow or if the thread wasn't running, see above - if (window == NULL || (!quitFilePanels && window->IsFilePanel())) - continue; - // NOTE: the window pointer might be stale, in case the looper // was already quit by quitting an earlier looper... but fortunately, // we can still call Lock() on the invalid pointer, and it // will return false... - if (window->Lock()) { - // never ask hidden windows if they want to quit, ignore - // them if force == false, just quit them if force == true - if (!force && !window->IsHidden() && !window->QuitRequested() - && !(quitFilePanels && window->IsFilePanel())) { - // the window does not want to quit, so we don't either - window->Unlock(); - return false; - } + if (!window->Lock()) + continue; - // Re-lock, just to make sure that the user hasn't done nasty - // things in QuitRequested(). Quit() unlocks fully, thus - // double-locking is harmless. - if (window->Lock()) - window->Quit(); + // don't quit file panels if we haven't been asked for it + if (!quitFilePanels && window->IsFilePanel()) { + window->Unlock(); + index++; + continue; } + + if (!force && !window->QuitRequested() + && !(quitFilePanels && window->IsFilePanel())) { + // the window does not want to quit, so we don't either + window->Unlock(); + return false; + } + + // Re-lock, just to make sure that the user hasn't done nasty + // things in QuitRequested(). Quit() unlocks fully, thus + // double-locking is harmless. + if (window->Lock()) + window->Quit(); + + index = 0; + // we need to continue at the start of the list again - it + // might have changed } return true; } @@ -1447,10 +1438,14 @@ int32 BApplication::_CountWindows(bool includeMenus) const { - int32 count = 0; - BList windowList; - if (_GetWindowList(&windowList, includeMenus) == B_OK) - count = windowList.CountItems(); + uint32 count = 0; + for (int32 i = 0; i < gLooperList.CountLoopers(); i++) { + BWindow* window = dynamic_cast(gLooperList.LooperAt(i)); + if (window == NULL || (!includeMenus + && dynamic_cast(window) == NULL)) { + count++; + } + } return count; } @@ -1459,38 +1454,24 @@ BWindow * BApplication::_WindowAt(uint32 index, bool includeMenus) const { - BList windowList; - BWindow *window = NULL; - if (_GetWindowList(&windowList, includeMenus) == B_OK) { - if ((int32)index < windowList.CountItems()) - window = static_cast(windowList.ItemAt(index)); - } - - return window; -} - - -status_t -BApplication::_GetWindowList(BList *list, bool includeMenus) const -{ - ASSERT(list); - - // Windows are BLoopers, so we can just check each BLooper to see if it's - // a BWindow (or BMenuWindow) AutoLocker listLock(gLooperList); if (!listLock.IsLocked()) - return B_ERROR; + return NULL; - BLooper *looper = NULL; - for (int32 i = 0; i < gLooperList.CountLoopers(); i++) { - looper = gLooperList.LooperAt(i); - if (dynamic_cast(looper)) { - if (includeMenus || dynamic_cast(looper) == NULL) - list->AddItem(looper); + uint32 count = gLooperList.CountLoopers(); + for (uint32 i = 0; i < count && index < count; i++) { + BWindow* window = dynamic_cast(gLooperList.LooperAt(i)); + if (window == NULL || (!includeMenus + && dynamic_cast(window) == NULL)) { + index++; + continue; } + + if (i == index) + return window; } - return B_OK; + return NULL; } From axeld at mail.berlios.de Tue Jun 26 01:48:49 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 26 Jun 2007 01:48:49 +0200 Subject: [Haiku-commits] r21506 - haiku/trunk/src/kits/app Message-ID: <200706252348.l5PNmnal014822@sheep.berlios.de> Author: axeld Date: 2007-06-26 01:48:47 +0200 (Tue, 26 Jun 2007) New Revision: 21506 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21506&view=rev Modified: haiku/trunk/src/kits/app/Application.cpp Log: Fixed copy&paste bug, thanks Stippi for noticing! Modified: haiku/trunk/src/kits/app/Application.cpp =================================================================== --- haiku/trunk/src/kits/app/Application.cpp 2007-06-25 23:38:45 UTC (rev 21505) +++ haiku/trunk/src/kits/app/Application.cpp 2007-06-25 23:48:47 UTC (rev 21506) @@ -1441,8 +1441,8 @@ uint32 count = 0; for (int32 i = 0; i < gLooperList.CountLoopers(); i++) { BWindow* window = dynamic_cast(gLooperList.LooperAt(i)); - if (window == NULL || (!includeMenus - && dynamic_cast(window) == NULL)) { + if (window != NULL && (includeMenus + || dynamic_cast(window) == NULL)) { count++; } } From axeld at mail.berlios.de Tue Jun 26 16:13:07 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 26 Jun 2007 16:13:07 +0200 Subject: [Haiku-commits] r21507 - haiku/trunk/src/apps/cdplayer Message-ID: <200706261413.l5QED7JE007067@sheep.berlios.de> Author: axeld Date: 2007-06-26 16:13:05 +0200 (Tue, 26 Jun 2007) New Revision: 21507 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21507&view=rev Modified: haiku/trunk/src/apps/cdplayer/PlayList.cpp haiku/trunk/src/apps/cdplayer/PlayList.h haiku/trunk/src/apps/cdplayer/TrackMenu.cpp haiku/trunk/src/apps/cdplayer/TrackMenu.h haiku/trunk/src/apps/cdplayer/TwoStateDrawButton.cpp haiku/trunk/src/apps/cdplayer/TwoStateDrawButton.h Log: Style changes courtesy of Vasilis Kaoutsis - thanks! Modified: haiku/trunk/src/apps/cdplayer/PlayList.cpp =================================================================== --- haiku/trunk/src/apps/cdplayer/PlayList.cpp 2007-06-25 23:48:47 UTC (rev 21506) +++ haiku/trunk/src/apps/cdplayer/PlayList.cpp 2007-06-26 14:13:05 UTC (rev 21507) @@ -1,5 +1,7 @@ #include "PlayList.h" + #include + #include #include @@ -12,34 +14,36 @@ #define STRACE(x) /* nothing */ #endif + PlayList::PlayList(int16 count, int16 start) - : fTrackCount(count), - fTrackIndex(0), - fStartingTrack(start), - fRandom(false), - fLoop(false) + : + fTrackCount(count), + fTrackIndex(0), + fStartingTrack(start), + fRandom(false), + fLoop(false) { STRACE(("PlayList(count=%d,start=%d)\n",count,start)); - + srand(real_time_clock_usecs()); - - if(fTrackCount < 0) + + if (fTrackCount < 0) fTrackCount = 0; - else - if(fTrackCount > 500) + else if (fTrackCount > 500) fTrackCount = 500; - - if(fStartingTrack >= fTrackCount) + + if (fStartingTrack >= fTrackCount) fStartingTrack = fTrackCount - 1; - - if(fStartingTrack < 1) + + if (fStartingTrack < 1) fStartingTrack = 1; - - memset(fTrackList,-1,500); - + + memset(fTrackList, -1, 500); + Unrandomize(); } + void PlayList::SetTrackCount(const int16 &count) { @@ -47,23 +51,22 @@ STRACE(("PlayList::SetTrackCount(%d)\n",count)); - if(count <= 0) - { + if (count <= 0) { fTrackCount = 0; fTrackIndex = 0; } - else - if(count > 500) + else if (count > 500) fTrackCount = 500; else fTrackCount = count; - - memset(fTrackList,-1,500); + + memset(fTrackList, -1, 500); SetShuffle(IsShuffled()); - + fLocker.Unlock(); } + void PlayList::SetStartingTrack(const int16 &start) { @@ -76,8 +79,9 @@ fLocker.Unlock(); } + void -PlayList::Rewind(void) +PlayList::Rewind() { STRACE(("PlayList::Rewind()\n")); fLocker.Lock(); @@ -87,13 +91,14 @@ fLocker.Unlock(); } + void PlayList::SetShuffle(const bool &random) { - STRACE(("PlayList::SetShuffle(%s)\n",random ? "random" : "sequential")); + STRACE(("PlayList::SetShuffle(%s)\n", random ? "random" : "sequential")); fLocker.Lock(); - - if(random) + + if (random) Randomize(); else Unrandomize(); @@ -103,69 +108,68 @@ fLocker.Unlock(); } + void PlayList::SetLoop(const bool &loop) { - STRACE(("PlayList::SetLoop(%s)\n",loop ? "loop" : "non-loop")); + STRACE(("PlayList::SetLoop(%s)\n", loop ? "loop" : "non-loop")); fLocker.Lock(); - + fLoop = loop; - + fLocker.Unlock(); } + void PlayList::SetCurrentTrack(const int16 &track) { STRACE(("PlayList::SetCurrentTrack(%d)\n",track)); - if(track < 0 || track > fTrackCount) + if (track < 0 || track > fTrackCount) return; + + fLocker.Lock(); - fLocker.Lock(); - - for(int16 i=0; i (fTrackCount - fStartingTrack)) - { - if(fLoop) + + if (fTrackIndex > (fTrackCount - fStartingTrack)) { + if (fLoop) fTrackIndex = 0; - else - { + else { fLocker.Unlock(); STRACE(("PlayList::GetNextTrack()=-1 (track index out of range)\n")); return -1; @@ -181,24 +185,22 @@ return value; } + int16 -PlayList::GetPreviousTrack(void) +PlayList::GetPreviousTrack() { fLocker.Lock(); - - if(fTrackCount < 1) - { + + if (fTrackCount < 1) { fLocker.Unlock(); STRACE(("PlayList::GetPreviousTrack()=-1 (no tracks)\n")); return -1; } - - if(fTrackIndex == 0) - { - if(fLoop) + + if (fTrackIndex == 0) { + if (fLoop) fTrackIndex = (fTrackCount - fStartingTrack); - else - { + else { fLocker.Unlock(); STRACE(("PlayList::GetPreviousTrack()=-1 (track index out of range)\n")); return -1; @@ -213,18 +215,18 @@ return value; } + int16 -PlayList::GetLastTrack(void) +PlayList::GetLastTrack() { fLocker.Lock(); - - if(fTrackCount < 1) - { + + if (fTrackCount < 1) { fLocker.Unlock(); STRACE(("PlayList::GetLastTrack()=-1 (no tracks)\n")); return -1; } - + fTrackIndex = fTrackCount - 1; int16 value = fTrackList[fTrackIndex]; STRACE(("PlayList::GetLastTrack()=%d\n",value)); @@ -232,13 +234,13 @@ return value; } + int16 -PlayList::GetFirstTrack(void) +PlayList::GetFirstTrack() { fLocker.Lock(); - if(fTrackCount < 1) - { + if (fTrackCount < 1) { fLocker.Unlock(); STRACE(("PlayList::GetFirstTrack()=-1 (no tracks)\n")); return -1; @@ -251,47 +253,47 @@ return value; } + void -PlayList::Randomize(void) +PlayList::Randomize() { STRACE(("PlayList::Randomize()\n")); // Reinitialize the count - for(int16 i=fStartingTrack; i<=fTrackCount; i++) + for (int16 i = fStartingTrack; i <= fTrackCount; i++) fTrackList[i - fStartingTrack] = i; // There are probably *much* better ways to do this, // but this is the only one I could think of. :( int32 listcount = (fTrackCount - fStartingTrack); - int32 swapcount = listcount* 2; + int32 swapcount = listcount * 2; int16 temp, first, second; - for(int32 i=0; i< swapcount; i++) - { + for (int32 i = 0; i < swapcount; i++) { // repeatedly pick two elements at random and swap them // This way we are sure to not have any duplicates and still have // all tracks eventually be played. - first = (int16)(listcount * ((float)rand()/RAND_MAX)); - second = (int16)(listcount * ((float)rand()/RAND_MAX)); - + first = (int16)(listcount * ((float)rand() / RAND_MAX)); + second = (int16)(listcount * ((float)rand() / RAND_MAX)); + temp = fTrackList[first]; fTrackList[first] = fTrackList[second]; fTrackList[second] = temp; } - + #ifdef DEBUG_PLAYLIST - for(int16 i=fStartingTrack; i<=fTrackCount; i++) - printf("\tSlot %d: track %d\n",i,fTrackList[i]); + for (int16 i = fStartingTrack; i <= fTrackCount; i++) + printf("\tSlot %d: track %d\n", i, fTrackList[i]); #endif } + void -PlayList::Unrandomize(void) +PlayList::Unrandomize() { STRACE(("PlayList::Unrandomize()\n")); - for(int16 i=fStartingTrack; i<=fTrackCount; i++) + for (int16 i = fStartingTrack; i <= fTrackCount; i++) fTrackList[i - fStartingTrack] = i; } - Modified: haiku/trunk/src/apps/cdplayer/PlayList.h =================================================================== --- haiku/trunk/src/apps/cdplayer/PlayList.h 2007-06-25 23:48:47 UTC (rev 21506) +++ haiku/trunk/src/apps/cdplayer/PlayList.h 2007-06-26 14:13:05 UTC (rev 21507) @@ -1,50 +1,49 @@ #ifndef PLAYLIST_H #define PLAYLIST_H -#include #include +#include -class PlayList -{ -public: - PlayList(int16 tracks = 0, int16 startingtrack = 1); - - void SetTrackCount(const int16 &count); - int16 TrackCount(void) const { return fTrackCount; } +class PlayList { + public: + PlayList(int16 tracks = 0, int16 startingtrack = 1); - void SetStartingTrack(const int16 &start); - int16 StartingTrack(void) const { return fStartingTrack; } + void SetTrackCount(const int16 &count); + int16 TrackCount() const { return fTrackCount; } + + void SetStartingTrack(const int16 &start); + int16 StartingTrack() const { return fStartingTrack; } + + void Rewind(); + + void SetShuffle(const bool &random); + bool IsShuffled() const { return fRandom; } + + void SetLoop(const bool &loop); + bool IsLoop() const { return fLoop; } - void Rewind(void); + void SetCurrentTrack(const int16 &track); + int16 GetCurrentTrack(); - void SetShuffle(const bool &random); - bool IsShuffled(void) const { return fRandom; } - - void SetLoop(const bool &loop); - bool IsLoop(void) const { return fLoop; } - - void SetCurrentTrack(const int16 &track); - int16 GetCurrentTrack(void); - - int16 GetNextTrack(void); - int16 GetPreviousTrack(void); - - int16 GetFirstTrack(void); - int16 GetLastTrack(void); - -private: - void Randomize(void); - void Unrandomize(void); - - int16 fTrackCount; - int16 fTrackIndex; - int16 fStartingTrack; - int16 fTrackList[500]; // This should be big enough. :) - - bool fRandom; - bool fLoop; - - BLocker fLocker; + int16 GetNextTrack(); + int16 GetPreviousTrack(); + + int16 GetFirstTrack(); + int16 GetLastTrack(); + + private: + void Randomize(); + void Unrandomize(); + + int16 fTrackCount; + int16 fTrackIndex; + int16 fStartingTrack; + int16 fTrackList[500]; // This should be big enough. :) + + bool fRandom; + bool fLoop; + + BLocker fLocker; }; -#endif +#endif // PLAYLIST_H Modified: haiku/trunk/src/apps/cdplayer/TrackMenu.cpp =================================================================== --- haiku/trunk/src/apps/cdplayer/TrackMenu.cpp 2007-06-25 23:48:47 UTC (rev 21506) +++ haiku/trunk/src/apps/cdplayer/TrackMenu.cpp 2007-06-26 14:13:05 UTC (rev 21507) @@ -1,22 +1,24 @@ +#include "TrackMenu.h" + +#include #include #include -#include #include -#include -#include "TrackMenu.h" +#include + #include + TrackMenu::TrackMenu(const BRect &frame, const char *name, BMessage *msg, - const int32 &resize, const int32 &flags) - : BView(frame,name,resize,flags), - BInvoker(msg,NULL), + const int32 &resize, const int32 &flags) + : BView(frame, name, resize, flags), BInvoker(msg, NULL), fCurrentItem(-1), fCount(0), fIsTracking(false) { - SetViewColor(20,20,20); + SetViewColor(20, 20, 20); - fItemRect.Set(1,1,1 + StringWidth("00") + 3, Bounds().bottom - 1); + fItemRect.Set(1, 1, 1 + StringWidth("00") + 3, Bounds().bottom - 1); BFont font; font.SetSize(11); @@ -29,254 +31,241 @@ fFontHeight = fh.ascent + fh.descent + fh.leading; } -TrackMenu::~TrackMenu(void) + +TrackMenu::~TrackMenu() { } + void -TrackMenu::AttachedToWindow(void) +TrackMenu::AttachedToWindow() { if (!Messenger().IsValid()) SetTarget(Window()); BView::AttachedToWindow(); } + void TrackMenu::MessageReceived(BMessage *msg) { - switch(msg->what) - { + switch (msg->what) { default: - { BView::MessageReceived(msg); break; - } } } + void TrackMenu::SetItemCount(const int32 &count) { - if(count < 0) - { + if (count < 0) { fCount = 0; fCurrentItem = -1; Invalidate(); return; } - + fCount = count; - - if(fCurrentItem > fCount - 1) + + if (fCurrentItem > fCount - 1) fCurrentItem = fCount - 1; - else - if(fCurrentItem < 0) + else if(fCurrentItem < 0) fCurrentItem = 0; - + Invalidate(); } + void TrackMenu::SetValue(const int32 &value) { - if(value < 0 || value > fCount) + if (value < 0 || value > fCount) return; - - if(value != Value()) - { + + if (value != Value()) { fCurrentItem = value; Invalidate(); } } + int32 TrackMenu::ItemAt(const BPoint &pt) { // TODO: Optimize. This is simple, but costly in performance BRect r(fItemRect); - for(int32 i=0; i= 0) - { + + if (item >= 0) { fCurrentItem = item; Invalidate(); - + // Shamelessly stolen from BButton. :D - if (Window()->Flags() & B_ASYNCHRONOUS_CONTROLS) - { + if (Window()->Flags() & B_ASYNCHRONOUS_CONTROLS) { SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); fIsTracking = true; - } else - { + } else { uint32 buttons; - - do - { + + do { Window()->UpdateIfNeeded(); - + snooze(40000); - + GetMouse(&pt, &buttons, true); - + int32 mouseitem = ItemAt(pt); - if(mouseitem > -1) - { + if (mouseitem > -1) { fCurrentItem = mouseitem; Draw(Bounds()); } - + } while (buttons != 0); - - if(fCurrentItem != saveditem) + + if (fCurrentItem != saveditem) Invoke(); } } } + void TrackMenu::MouseUp(BPoint pt) { - if(!fIsTracking) + if (!fIsTracking) return; int32 item = ItemAt(pt); - - if(item >= 0) + + if (item >= 0) Invoke(); - + fIsTracking = false; } + void TrackMenu::MouseMoved(BPoint pt, uint32 transit, const BMessage *msg) { - if(!fIsTracking) + if (!fIsTracking) return; int32 item = ItemAt(pt); - - if(item >= 0) - { + + if (item >= 0) { fCurrentItem = item; Invalidate(); } } + void TrackMenu::Draw(BRect update) { - rgb_color dark = {20,20,20,255}; - rgb_color light = {200,200,200,255}; - BPoint pt1,pt2; - + rgb_color dark = {20, 20, 20, 255}; + rgb_color light = {200, 200, 200, 255}; + BPoint pt1, pt2; + // Draw the frame SetHighColor(dark); - pt1.Set(0,0); + pt1.Set(0, 0); pt2 = Bounds().RightTop(); - StrokeLine(pt1,pt2); - - pt2.Set(0,Bounds().bottom); - StrokeLine(pt1,pt2); - + StrokeLine(pt1, pt2); + + pt2.Set(0, Bounds().bottom); + StrokeLine(pt1, pt2); + SetHighColor(255,255,255); pt1 = Bounds().RightBottom(); pt2.Set(Bounds().right, 1); - StrokeLine(pt1,pt2); - + StrokeLine(pt1, pt2); + pt2.Set(1,Bounds().bottom); - StrokeLine(pt1,pt2); - + StrokeLine(pt1, pt2); + // Draw the items BRect r(fItemRect); - - for(int32 i=0; i Bounds().right - 2) - { + r.OffsetBy(r.Width() + 1, 0); + + if (r.left > Bounds().right - 2) { ConstrainClippingRegion(NULL); break; } - - if(r.right > Bounds().right - 2) - { + + if (r.right > Bounds().right - 2) { r.right = Bounds().right - 2; BRegion reg(r); ConstrainClippingRegion(®); Modified: haiku/trunk/src/apps/cdplayer/TrackMenu.h =================================================================== --- haiku/trunk/src/apps/cdplayer/TrackMenu.h 2007-06-25 23:48:47 UTC (rev 21506) +++ haiku/trunk/src/apps/cdplayer/TrackMenu.h 2007-06-26 14:13:05 UTC (rev 21507) @@ -1,40 +1,39 @@ #ifndef TRACKMENU_H #define TRACKMENU_H -#include #include +#include -class TrackMenu : public BView, public BInvoker -{ -public: - TrackMenu(const BRect &frame, const char *name, BMessage *msg, - const int32 &resize = B_FOLLOW_LEFT | B_FOLLOW_TOP, - const int32 &flags = B_WILL_DRAW); - ~TrackMenu(void); +class TrackMenu : public BView, public BInvoker { + public: + TrackMenu(const BRect &frame, const char *name, BMessage *msg, + const int32 &resize = B_FOLLOW_LEFT | B_FOLLOW_TOP, + const int32 &flags = B_WILL_DRAW); + ~TrackMenu(); - void AttachedToWindow(void); - void MessageReceived(BMessage *msg); - void Draw(BRect update); - void MouseDown(BPoint pt); - void MouseUp(BPoint pt); - void MouseMoved(BPoint pt, uint32 transit, const BMessage *msg); - - int32 CountItems(void) const { return fCount; } - void SetItemCount(const int32 &count); - - int32 Value(void) const { return fCurrentItem; } - void SetValue(const int32 &value); - -private: - int32 ItemAt(const BPoint &pt); - - int32 fCurrentItem; - int32 fCount; - BRect fItemRect; - - bool fIsTracking; - - float fFontHeight; + void AttachedToWindow(); + void MessageReceived(BMessage *msg); + void Draw(BRect update); + void MouseDown(BPoint pt); + void MouseUp(BPoint pt); + void MouseMoved(BPoint pt, uint32 transit, const BMessage *msg); + + int32 CountItems() const { return fCount; } + void SetItemCount(const int32 &count); + + int32 Value() const { return fCurrentItem; } + void SetValue(const int32 &value); + + private: + int32 ItemAt(const BPoint &pt); + + int32 fCurrentItem; + int32 fCount; + BRect fItemRect; + + bool fIsTracking; + + float fFontHeight; }; -#endif +#endif // TRACKMENU_H Modified: haiku/trunk/src/apps/cdplayer/TwoStateDrawButton.cpp =================================================================== --- haiku/trunk/src/apps/cdplayer/TwoStateDrawButton.cpp 2007-06-25 23:48:47 UTC (rev 21506) +++ haiku/trunk/src/apps/cdplayer/TwoStateDrawButton.cpp 2007-06-26 14:13:05 UTC (rev 21507) @@ -3,15 +3,17 @@ * Distributed under the terms of the MIT license. * * Author: - * DarkWyrm + * DarkWyrm, bpmagic at columbus.rr.com */ + + #include "TwoStateDrawButton.h" + TwoStateDrawButton::TwoStateDrawButton(BRect frame, const char *name, BBitmap *upone, - BBitmap *downone, BBitmap *uptwo, - BBitmap *downtwo, BMessage *msg, - const int32 &resize, const int32 &flags) - : BButton(frame, name, "", msg, resize, flags), + BBitmap *downone, BBitmap *uptwo, BBitmap *downtwo, BMessage *msg, + const int32 &resize, const int32 &flags) + : BButton(frame, name, "", msg, resize, flags), fUpOne(upone), fDownOne(downone), fUpTwo(uptwo), @@ -25,7 +27,7 @@ } -TwoStateDrawButton::~TwoStateDrawButton(void) +TwoStateDrawButton::~TwoStateDrawButton() { delete fUpOne; delete fDownOne; @@ -37,37 +39,32 @@ void -TwoStateDrawButton::ResizeToPreferred(void) +TwoStateDrawButton::ResizeToPreferred() { - if(fUpOne) - ResizeTo(fUpOne->Bounds().Width(),fUpOne->Bounds().Height()); - else - if(fDownOne) - ResizeTo(fDownOne->Bounds().Width(),fDownOne->Bounds().Height()); - else - if(fUpTwo) + if (fUpOne) + ResizeTo(fUpOne->Bounds().Width(), fUpOne->Bounds().Height()); + else if (fDownOne) + ResizeTo(fDownOne->Bounds().Width(), fDownOne->Bounds().Height()); + else if (fUpTwo) ResizeTo(fUpTwo->Bounds().Width(),fUpTwo->Bounds().Height()); - else - if(fDownTwo) - ResizeTo(fDownTwo->Bounds().Width(),fDownTwo->Bounds().Height()); - else - if(fDisabledOne) - ResizeTo(fDisabledOne->Bounds().Width(),fDisabledOne->Bounds().Height()); - else - if(fDisabledTwo) - ResizeTo(fDisabledTwo->Bounds().Width(),fDisabledTwo->Bounds().Height()); + else if (fDownTwo) + ResizeTo(fDownTwo->Bounds().Width(), fDownTwo->Bounds().Height()); + else if (fDisabledOne) + ResizeTo(fDisabledOne->Bounds().Width(), fDisabledOne->Bounds().Height()); + else if(fDisabledTwo) + ResizeTo(fDisabledTwo->Bounds().Width(), fDisabledTwo->Bounds().Height()); } void TwoStateDrawButton::SetBitmaps(BBitmap *upone, BBitmap *downone, BBitmap *uptwo, - BBitmap *downtwo) + BBitmap *downtwo) { delete fUpOne; delete fDownOne; delete fUpTwo; delete fDownTwo; [... truncated: 157 lines follow ...] From axeld at mail.berlios.de Tue Jun 26 18:09:09 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 26 Jun 2007 18:09:09 +0200 Subject: [Haiku-commits] r21508 - haiku/trunk/src/apps/diskprobe Message-ID: <200706261609.l5QG99fB021992@sheep.berlios.de> Author: axeld Date: 2007-06-26 18:09:08 +0200 (Tue, 26 Jun 2007) New Revision: 21508 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21508&view=rev Modified: haiku/trunk/src/apps/diskprobe/DiskProbe.cpp Log: DiskProbe now also allows you to open directories; even though you can't access their stream, you can still see and change their attributes (same for symlinks which were already allowed before). Modified: haiku/trunk/src/apps/diskprobe/DiskProbe.cpp =================================================================== --- haiku/trunk/src/apps/diskprobe/DiskProbe.cpp 2007-06-26 14:13:05 UTC (rev 21507) +++ haiku/trunk/src/apps/diskprobe/DiskProbe.cpp 2007-06-26 16:09:08 UTC (rev 21508) @@ -298,7 +298,6 @@ DiskProbe::RefsReceived(BMessage *message) { bool traverseLinks = (modifiers() & B_SHIFT_KEY) == 0; - int32 directories = 0; int32 index = 0; entry_ref ref; @@ -310,15 +309,6 @@ BEntry entry; status_t status = entry.SetTo(&ref, traverseLinks); - // If it's a directory, we won't handle it, but we would accept a volume - if (status == B_OK && traverseLinks && entry.IsDirectory()) { - BDirectory directory(&entry); - if (directory.InitCheck() != B_OK || !directory.IsRootDirectory()) { - directories++; - continue; - } - } - if (status == B_OK) status = Probe(entry, attribute); @@ -334,12 +324,6 @@ B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); } } - - if (directories > 0) { - (new BAlert("DiskProbe request", - "Sorry, only regular files and volumes can be opened.\n", "Ok", NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); - } } From axeld at mail.berlios.de Tue Jun 26 19:43:56 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 26 Jun 2007 19:43:56 +0200 Subject: [Haiku-commits] r21509 - haiku/trunk/src/kits/tracker Message-ID: <200706261743.l5QHhuK0013520@sheep.berlios.de> Author: axeld Date: 2007-06-26 19:43:55 +0200 (Tue, 26 Jun 2007) New Revision: 21509 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21509&view=rev Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp haiku/trunk/src/kits/tracker/ContainerWindow.h haiku/trunk/src/kits/tracker/PoseView.cpp haiku/trunk/src/kits/tracker/PoseView.h haiku/trunk/src/kits/tracker/Utilities.cpp haiku/trunk/src/kits/tracker/ViewState.cpp haiku/trunk/src/kits/tracker/ViewState.h Log: * StringFromStream() did not work correctly for empty strings (messed up the stream position). * StringFromStream() called BString::LockBuffer() with "length", but touched "length + 1" bytes. * Prepared for the new "display as" FileTypes feature. * The "DefaultQueryTemplate" folder now adds the MIME type of the folder to the attribute menu for simplified editing (before, you had to move a file with a matching file type into that folder to be able to add the attributes you likely wanted to see). Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp =================================================================== --- haiku/trunk/src/kits/tracker/ContainerWindow.cpp 2007-06-26 16:09:08 UTC (rev 21508) +++ haiku/trunk/src/kits/tracker/ContainerWindow.cpp 2007-06-26 17:43:55 UTC (rev 21509) @@ -78,6 +78,7 @@ #include "Navigator.h" #include "NavMenu.h" #include "PoseView.h" +#include "QueryContainerWindow.h" #include "SelectionWindow.h" #include "TitleView.h" #include "Tracker.h" @@ -2966,18 +2967,30 @@ } -BMenuItem * -BContainerWindow::NewAttributeMenuItem(const char *label, const char *attrName, - int32 attrType, float attrWidth, int32 attrAlign, bool attrEditable, bool attrStatField) +BMenuItem * +BContainerWindow::NewAttributeMenuItem(const char *label, const char *name, + int32 type, float width, int32 align, bool editable, bool statField) { + return NewAttributeMenuItem(label, name, type, NULL, width, align, + editable, statField); +} + + +BMenuItem * +BContainerWindow::NewAttributeMenuItem(const char *label, const char *name, + int32 type, const char* displayAs, float width, int32 align, + bool editable, bool statField) +{ BMessage *message = new BMessage(kAttributeItem); - message->AddString("attr_name", attrName); - message->AddInt32("attr_type", attrType); - message->AddInt32("attr_hash", (int32)AttrHashString(attrName, (uint32)attrType)); - message->AddFloat("attr_width", attrWidth); - message->AddInt32("attr_align", attrAlign); - message->AddBool("attr_editable", attrEditable); - message->AddBool("attr_statfield", attrStatField); + message->AddString("attr_name", name); + message->AddInt32("attr_type", type); + message->AddInt32("attr_hash", (int32)AttrHashString(name, (uint32)type)); + message->AddFloat("attr_width", width); + message->AddInt32("attr_align", align); + if (displayAs != NULL) + message->AddString("attr_display_as", displayAs); + message->AddBool("attr_editable", editable); + message->AddBool("attr_statfield", statField); BMenuItem *menuItem = new BMenuItem(label, message); menuItem->SetTarget(PoseView()); @@ -3110,21 +3123,33 @@ break; } - // Remove old mime menu: - int32 removeIndex = count - 1; - while (menu->ItemAt(removeIndex)->Submenu() != NULL) { + // Remove old mime menu: + int32 removeIndex = count - 1; + while (menu->ItemAt(removeIndex)->Submenu() != NULL) { delete menu->RemoveItem(removeIndex); - removeIndex--; - } - - // Add a separator item if there is none yet - if (dynamic_cast(menu->ItemAt(removeIndex)) == NULL) + removeIndex--; + } + + // Add a separator item if there is none yet + if (dynamic_cast(menu->ItemAt(removeIndex)) == NULL) menu->AddSeparatorItem(); + // Add MIME type in case we're a default query type window + BPath path; + if (TargetModel() != NULL) { + TargetModel()->GetPath(&path); + if (strstr(path.Path(), "/" kQueryTemplates "/") != NULL) { + // demangle MIME type name + BString name(TargetModel()->Name()); + name.ReplaceFirst('_', '/'); + + PoseView()->AddMimeType(name.String()); + } + } + int32 typeCount = PoseView()->CountMimeTypes(); for (int32 index = 0; index < typeCount; index++) { - bool shouldAdd = true; const char *signature = PoseView()->MimeTypeAt(index); @@ -3144,8 +3169,8 @@ } if (shouldAdd) { - BMessage attr_msg; - char desc[B_MIME_TYPE_LENGTH]; + BMessage attrInfo; + char description[B_MIME_TYPE_LENGTH]; const char *nameToAdd = signature; BMimeType mimetype(signature); @@ -3154,44 +3179,40 @@ continue; // only add things to menu which have "user-visible" data - if (mimetype.GetAttrInfo(&attr_msg) != B_OK) + if (mimetype.GetAttrInfo(&attrInfo) != B_OK) continue; - if (mimetype.GetShortDescription(desc) == B_OK && desc[0]) - nameToAdd = desc; + if (mimetype.GetShortDescription(description) == B_OK + && description[0]) + nameToAdd = description; - // go through each field in meta mime and add it to a menu + // go through each field in meta mime and add it to a menu BMenu *localMenu = 0; int32 index = -1; const char *str; - while (attr_msg.FindString("attr:public_name", ++index, &str) == B_OK) { - if (!attr_msg.FindBool("attr:viewable", index)) + while (attrInfo.FindString("attr:public_name", ++index, &str) == B_OK) { + if (!attrInfo.FindBool("attr:viewable", index)) { // don't add if attribute not viewable continue; - + } + int32 type; int32 align; int32 width; bool editable; - const char *attrName; - - if (attr_msg.FindString("attr:name", index, &attrName) != B_OK) - continue; - if (attr_msg.FindInt32("attr:type", index, &type) != B_OK) + if (attrInfo.FindString("attr:name", index, &attrName) != B_OK + || attrInfo.FindInt32("attr:type", index, &type) != B_OK + || attrInfo.FindBool("attr:editable", index, &editable) != B_OK + || attrInfo.FindInt32("attr:width", index, &width) != B_OK + || attrInfo.FindInt32("attr:alignment", index, &align) != B_OK) continue; - if (attr_msg.FindBool("attr:editable", index, &editable) != B_OK) - continue; + BString displayAs; + attrInfo.FindString("attr:display_as", index, &displayAs); - if (attr_msg.FindInt32("attr:width", index, &width) != B_OK) - continue; - - if (attr_msg.FindInt32("attr:alignment", index, &align) != B_OK) - continue; - if (!localMenu) { // do a lazy allocation of the menu localMenu = new BMenu(nameToAdd); @@ -3199,8 +3220,8 @@ menu->GetFont(&font); localMenu->SetFont(&font); } - localMenu->AddItem(NewAttributeMenuItem (str, attrName, type, - width, align, editable, false)); + localMenu->AddItem(NewAttributeMenuItem(str, attrName, type, + displayAs.String(), width, align, editable, false)); } if (localMenu) { BMessage *message = new BMessage(kMIMETypeItem); @@ -3279,7 +3300,6 @@ BPath path(settingsPath); path.Append(name); if (!BEntry(path.Path()).Exists()) { - if (!createNew) return false; @@ -3289,22 +3309,20 @@ const char *nextSlash = strchr(name, '/'); if (!nextSlash) break; - + BString tmp; tmp.SetTo(name, nextSlash - name); tmpPath.Append(tmp.String()); + mkdir(tmpPath.Path(), 0777); - mkdir(tmpPath.Path(), 0777); - name = nextSlash + 1; if (!name[0]) { // can't deal with a slash at end - return false; } } - + if (createFolder) { if (mkdir(path.Path(), 0777) < 0) return false; @@ -3314,7 +3332,7 @@ return false; } } - + // PRINT(("using default state from %s\n", path.Path())); result->SetTo(path.Path()); return result->InitCheck() == B_OK; Modified: haiku/trunk/src/kits/tracker/ContainerWindow.h =================================================================== --- haiku/trunk/src/kits/tracker/ContainerWindow.h 2007-06-26 16:09:08 UTC (rev 21508) +++ haiku/trunk/src/kits/tracker/ContainerWindow.h 2007-06-26 17:43:55 UTC (rev 21509) @@ -150,8 +150,11 @@ void AddMimeTypesToMenu(); virtual void MarkAttributeMenu(BMenu *); void MarkAttributeMenu(); - BMenuItem *NewAttributeMenuItem (const char *label, const char *attrName, int32 attrType, - float attrWidth, int32 attrAlign, bool attrEditable, bool attrStatField); + BMenuItem *NewAttributeMenuItem(const char *label, const char *name, + int32 type, float width, int32 align, bool editable, bool statField); + BMenuItem *NewAttributeMenuItem(const char *label, const char *name, + int32 type, const char* displayAs, float width, int32 align, + bool editable, bool statField); virtual void NewAttributeMenu(BMenu *); void HideAttributeMenu(); Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2007-06-26 16:09:08 UTC (rev 21508) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2007-06-26 17:43:55 UTC (rev 21509) @@ -1808,7 +1808,7 @@ if (pose->TargetModel()) AddMimeType(pose->TargetModel()->MimeType()); } -} +} void @@ -2505,8 +2505,11 @@ if (message->FindBool("attr_statfield", &isStatfield) != B_OK) return; + const char* displayAs; + message->FindString("attr_display_as", &displayAs); + column = new BColumn(item->Label(), 0, attrWidth, attrAlign, - attrName, attrType, isStatfield, isEditable); + attrName, attrType, displayAs, isStatfield, isEditable); AddColumn(column); if (item->Menu()->Supermenu() == NULL) delete item->Menu(); Modified: haiku/trunk/src/kits/tracker/PoseView.h =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.h 2007-06-26 16:09:08 UTC (rev 21508) +++ haiku/trunk/src/kits/tracker/PoseView.h 2007-06-26 17:43:55 UTC (rev 21509) @@ -315,7 +315,8 @@ BRefFilter *RefFilter() const; // access for mime types represented in the pose view - const char *MimeTypeAt(int32); + void AddMimeType(const char* mimeType); + const char *MimeTypeAt(int32 index); int32 CountMimeTypes(); void RefreshMimeTypeList(); @@ -553,7 +554,6 @@ virtual void EditQueries(); virtual void AddCountView(); - void AddMimeType(const char *); void HandleAttrMenuItemSelected(BMessage *); void TryUpdatingBrokenLinks(); // ran a little after a volume gets mounted Modified: haiku/trunk/src/kits/tracker/Utilities.cpp =================================================================== --- haiku/trunk/src/kits/tracker/Utilities.cpp 2007-06-26 16:09:08 UTC (rev 21508) +++ haiku/trunk/src/kits/tracker/Utilities.cpp 2007-06-26 17:43:55 UTC (rev 21509) @@ -127,14 +127,14 @@ bool ValidateStream(BMallocIO *stream, uint32 key, int32 version) { - uint32 test_key; - int32 test_version; + uint32 testKey; + int32 testVersion; - if (stream->Read(&test_key, sizeof(uint32)) <= 0 - || stream->Read(&test_version, sizeof(int32)) <=0) + if (stream->Read(&testKey, sizeof(uint32)) <= 0 + || stream->Read(&testVersion, sizeof(int32)) <=0) return false; - return test_key == key && test_version == version; + return testKey == key && testVersion == version; } @@ -1075,14 +1075,13 @@ if (endianSwap) length = SwapInt32(length); - if (length <= 0 || length > 10000) { - // ToDo: - // should fail here + if (length < 0 || length > 10000) { + // TODO: should fail here PRINT(("problems instatiating a string, length probably wrong %d\n", length)); return; - } + } - char *buffer = string->LockBuffer(length); + char *buffer = string->LockBuffer(length + 1); stream->Read(buffer, (size_t)length + 1); string->UnlockBuffer(length); } Modified: haiku/trunk/src/kits/tracker/ViewState.cpp =================================================================== --- haiku/trunk/src/kits/tracker/ViewState.cpp 2007-06-26 16:09:08 UTC (rev 21508) +++ haiku/trunk/src/kits/tracker/ViewState.cpp 2007-06-26 17:43:55 UTC (rev 21509) @@ -55,6 +55,7 @@ const char *kColumnAttrName = "BColumn:fAttrName"; const char *kColumnAttrHashName = "BColumn:fAttrHash"; const char *kColumnAttrTypeName = "BColumn:fAttrType"; +const char *kColumnDisplayAsName = "BColumn:fDisplayAs"; const char *kColumnStatFieldName = "BColumn:fStatField"; const char *kColumnEditableName = "BColumn:fEditable"; @@ -71,29 +72,34 @@ const char *kViewStateIconSizeName = "ViewState:fIconSize"; -BColumn::BColumn(const char *title, float offset, float width, alignment align, - const char *attributeName, uint32 attrType, bool statField, - bool editable) - : - fTitle(title), - fAttrName(attributeName) +static const int32 kColumnStateMinArchiveVersion = 21; + // bump version when layout changes + + +BColumn::BColumn(const char *title, float offset, float width, + alignment align, const char *attributeName, uint32 attrType, + const char* displayAs, bool statField, bool editable) { - fOffset = offset; - fWidth = width; - fAlignment = align; - fAttrHash = AttrHashString(attributeName, attrType); - fAttrType = attrType; - fStatField = statField; - fEditable = editable; + _Init(title, offset, width, align, attributeName, attrType, displayAs, + statField, editable); } +BColumn::BColumn(const char *title, float offset, float width, + alignment align, const char *attributeName, uint32 attrType, + bool statField, bool editable) +{ + _Init(title, offset, width, align, attributeName, attrType, NULL, + statField, editable); +} + + BColumn::~BColumn() { } -BColumn::BColumn(BMallocIO *stream, bool endianSwap) +BColumn::BColumn(BMallocIO *stream, int32 version, bool endianSwap) { StringFromStream(&fTitle, stream, endianSwap); stream->Read(&fOffset, sizeof(float)); @@ -104,7 +110,9 @@ stream->Read(&fAttrType, sizeof(uint32)); stream->Read(&fStatField, sizeof(bool)); stream->Read(&fEditable, sizeof(bool)); - + if (version == kColumnStateArchiveVersion) + StringFromStream(&fDisplayAs, stream, endianSwap); + if (endianSwap) { PRINT(("endian swapping column\n")); fOffset = B_SWAP_FLOAT(fOffset); @@ -126,29 +134,53 @@ message.FindString(kColumnAttrName, index, &fAttrName); message.FindInt32(kColumnAttrHashName, index, (int32 *)&fAttrHash); message.FindInt32(kColumnAttrTypeName, index, (int32 *)&fAttrType); + message.FindString(kColumnDisplayAsName, index, &fDisplayAs); message.FindBool(kColumnStatFieldName, index, &fStatField); message.FindBool(kColumnEditableName, index, &fEditable); } +void +BColumn::_Init(const char *title, float offset, float width, + alignment align, const char *attributeName, uint32 attrType, + const char* displayAs, bool statField, bool editable) +{ + fTitle = title; + fAttrName = attributeName; + fDisplayAs = displayAs; + fOffset = offset; + fWidth = width; + fAlignment = align; + fAttrHash = AttrHashString(attributeName, attrType); + fAttrType = attrType; + fStatField = statField; + fEditable = editable; +} + + BColumn * BColumn::InstantiateFromStream(BMallocIO *stream, bool endianSwap) { // compare stream header in canonical form - uint32 key = AttrHashString("BColumn", B_OBJECT_TYPE); - int32 version = kColumnStateArchiveVersion; + // we can't use ValidateStream(), as we preserve backwards compatibility + int32 version; + uint32 key; + if (stream->Read(&key, sizeof(uint32)) <= 0 + || stream->Read(&version, sizeof(int32)) <=0) + return 0; + if (endianSwap) { key = SwapUInt32(key); version = SwapInt32(version); } -// PRINT(("validating key %x, version %d\n", key, version)); - if (!ValidateStream(stream, key, version)) + if (key != AttrHashString("BColumn", B_OBJECT_TYPE) + || version < kColumnStateMinArchiveVersion) return 0; // PRINT(("instantiating column, %s\n", endianSwap ? "endian swapping," : "")); - return _Sanitize(new (std::nothrow) BColumn(stream, endianSwap)); + return _Sanitize(new (std::nothrow) BColumn(stream, version, endianSwap)); } @@ -188,6 +220,7 @@ stream->Write(&fAttrType, sizeof(uint32)); stream->Write(&fStatField, sizeof(bool)); stream->Write(&fEditable, sizeof(bool)); + StringToStream(&fDisplayAs, stream); } @@ -203,6 +236,8 @@ message.AddString(kColumnAttrName, fAttrName); message.AddInt32(kColumnAttrHashName, static_cast(fAttrHash)); message.AddInt32(kColumnAttrTypeName, static_cast(fAttrType)); + if (fDisplayAs.Length() > 0) + message.AddString(kColumnDisplayAsName, fDisplayAs.String()); message.AddBool(kColumnStatFieldName, fStatField); message.AddBool(kColumnEditableName, fEditable); } Modified: haiku/trunk/src/kits/tracker/ViewState.h =================================================================== --- haiku/trunk/src/kits/tracker/ViewState.h 2007-06-26 16:09:08 UTC (rev 21508) +++ haiku/trunk/src/kits/tracker/ViewState.h 2007-06-26 17:43:55 UTC (rev 21509) @@ -41,17 +41,20 @@ namespace BPrivate { -const int32 kColumnStateArchiveVersion = 21; +const int32 kColumnStateArchiveVersion = 22; // bump version when layout or size changes class BColumn { public: BColumn(const char *title, float offset, float width, alignment align, const char *attributeName, uint32 attrType, + const char* displayAs, bool statField, bool editable); + BColumn(const char *title, float offset, float width, + alignment align, const char *attributeName, uint32 attrType, bool statField, bool editable); ~BColumn(); - BColumn(BMallocIO *stream, bool endianSwap = false); + BColumn(BMallocIO *stream, int32 version, bool endianSwap = false); BColumn(const BMessage &, int32 index = 0); static BColumn *InstantiateFromStream(BMallocIO *stream, bool endianSwap = false); @@ -60,12 +63,13 @@ void ArchiveToStream(BMallocIO *stream) const; void ArchiveToMessage(BMessage &) const; - const char *Title() const; + const char* Title() const; float Offset() const; float Width() const; alignment Alignment() const; - const char *AttrName() const; + const char* AttrName() const; uint32 AttrType() const; + const char* DisplayAs() const; uint32 AttrHash() const; bool StatField() const; bool Editable() const; @@ -74,13 +78,17 @@ void SetWidth(float); private: - static BColumn *_Sanitize(BColumn *column); + void _Init(const char *title, float offset, float width, + alignment align, const char *attributeName, uint32 attrType, + const char* displayAs, bool statField, bool editable); + static BColumn* _Sanitize(BColumn* column); BString fTitle; float fOffset; float fWidth; alignment fAlignment; BString fAttrName; + BString fDisplayAs; uint32 fAttrHash; uint32 fAttrType; bool fStatField; @@ -186,6 +194,12 @@ return fAttrType; } +inline const char * +BColumn::DisplayAs() const +{ + return fDisplayAs.String(); +} + inline bool BColumn::StatField() const { From axeld at mail.berlios.de Wed Jun 27 01:20:45 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 27 Jun 2007 01:20:45 +0200 Subject: [Haiku-commits] r21510 - haiku/trunk/src/kits/interface Message-ID: <200706262320.l5QNKjZv022311@sheep.berlios.de> Author: axeld Date: 2007-06-27 01:20:44 +0200 (Wed, 27 Jun 2007) New Revision: 21510 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21510&view=rev Modified: haiku/trunk/src/kits/interface/Bitmap.cpp Log: * LockBits() now returns B_OK for non-overlay bitmaps, as that makes much more sense. * Added TODO about the possible use of the state parameter (would be nice to be compatible with R5 here, of course). Modified: haiku/trunk/src/kits/interface/Bitmap.cpp =================================================================== --- haiku/trunk/src/kits/interface/Bitmap.cpp 2007-06-26 17:43:55 UTC (rev 21509) +++ haiku/trunk/src/kits/interface/Bitmap.cpp 2007-06-26 23:20:44 UTC (rev 21510) @@ -409,6 +409,9 @@ status_t BBitmap::LockBits(uint32 *state) { + // TODO: how do we fill the "state"? + // It would be more or less useful to report what kind of bitmap + // we got (ie. overlay, placeholder, or non-overlay) if (fFlags & B_BITMAP_WILL_OVERLAY) { overlay_client_data* data = (overlay_client_data*)fBasePointer; @@ -424,7 +427,7 @@ // drawing the bitmap yet? // axeld: you mean for non overlays? - return B_ERROR; + return B_OK; } @@ -442,7 +445,7 @@ release_sem(data->lock); } -// Area + /*! \brief Returns the ID of the area the bitmap data reside in. \return The ID of the area the bitmap data reside in. */ From jackburton at mail.berlios.de Wed Jun 27 12:43:50 2007 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Wed, 27 Jun 2007 12:43:50 +0200 Subject: [Haiku-commits] r21511 - haiku/trunk/src/kits/interface Message-ID: <200706271043.l5RAhorb015500@sheep.berlios.de> Author: jackburton Date: 2007-06-27 12:43:48 +0200 (Wed, 27 Jun 2007) New Revision: 21511 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21511&view=rev Modified: haiku/trunk/src/kits/interface/TextView.cpp Log: Avoid scrolling vertically if scrolling area is outside the text rect. Pin parameters in Select() before doing other checks on them (reported by Marc Flerackers) Modified: haiku/trunk/src/kits/interface/TextView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextView.cpp 2007-06-26 23:20:44 UTC (rev 21510) +++ haiku/trunk/src/kits/interface/TextView.cpp 2007-06-27 10:43:48 UTC (rev 21511) @@ -1368,18 +1368,21 @@ // a negative selection? if (startOffset > endOffset) return; - + + // pin offsets at reasonable values + if (startOffset < 0) + startOffset = 0; + if (endOffset < 0) + endOffset = 0; + else if (endOffset > fText->Length()) + endOffset = fText->Length(); + // is the new selection any different from the current selection? if (startOffset == fSelStart && endOffset == fSelEnd) return; fStyles->InvalidateNullStyle(); - // pin offsets at reasonable values - startOffset = (startOffset < 0) ? 0 : startOffset; - endOffset = (endOffset < 0) ? 0 : endOffset; - endOffset = (endOffset > fText->Length()) ? fText->Length() : endOffset; - // hide the caret if (fCaretVisible) InvertCaret(); @@ -4030,6 +4033,11 @@ // TODO: Refine this, I can't even remember how beos works here scrollBy.y = lineHeight > 0 ? lineHeight * (int32)(floorf(vertDiff) / lineHeight) : 0; + if (bounds.bottom + scrollBy.y > fTextRect.Height()) + scrollBy.y = fTextRect.Height() - bounds.bottom; + else if (bounds.top + scrollBy.y < 0) + scrollBy.y = -bounds.top; + if (scrollBy != B_ORIGIN) ScrollBy(scrollBy.x, scrollBy.y); } From axeld at mail.berlios.de Wed Jun 27 13:29:21 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 27 Jun 2007 13:29:21 +0200 Subject: [Haiku-commits] r21512 - in haiku/trunk/src/servers/app: . drawing Message-ID: <200706271129.l5RBTLTO012700@sheep.berlios.de> Author: axeld Date: 2007-06-27 13:29:20 +0200 (Wed, 27 Jun 2007) New Revision: 21512 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21512&view=rev Modified: haiku/trunk/src/servers/app/BitmapManager.cpp haiku/trunk/src/servers/app/BitmapManager.h haiku/trunk/src/servers/app/ServerApp.cpp haiku/trunk/src/servers/app/ServerBitmap.cpp haiku/trunk/src/servers/app/ServerBitmap.h haiku/trunk/src/servers/app/ServerScreen.cpp haiku/trunk/src/servers/app/drawing/Overlay.cpp haiku/trunk/src/servers/app/drawing/Overlay.h Log: * Implemented the overlay suspend/resume protocol on mode changes; not really tested yet. Also, BBitmap::LockBits() should probably fail when the Bits() are NULL. * The downside is that many more classes now know of each other. * Cleaned up the work divided between the BitmapManager and the Overlay class. * Fixed a memory leak in AS_CREATE_BITMAP in case the bitmap could not be added to the ServerApp's bitmap list. Modified: haiku/trunk/src/servers/app/BitmapManager.cpp =================================================================== --- haiku/trunk/src/servers/app/BitmapManager.cpp 2007-06-27 10:43:48 UTC (rev 21511) +++ haiku/trunk/src/servers/app/BitmapManager.cpp 2007-06-27 11:29:20 UTC (rev 21512) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -19,15 +19,19 @@ #include "ClientMemoryAllocator.h" #include "HWInterface.h" #include "Overlay.h" +#include "ServerApp.h" #include "ServerBitmap.h" #include "ServerProtocol.h" #include "ServerTokenSpace.h" #include +#include #include +#include #include #include +#include #include #include @@ -36,13 +40,20 @@ using std::nothrow; -//! The bitmap allocator for the server. Memory is allocated/freed by the AppServer class +//! The one and only bitmap manager for the server, created by the AppServer BitmapManager *gBitmapManager = NULL; -//! Number of bytes to allocate to each area used for bitmap storage -#define BITMAP_AREA_SIZE B_PAGE_SIZE * 16 +int +compare_app_pointer(const ServerApp* a, const ServerApp* b) +{ + return (addr_t)b - (addr_t)b; +} + +// #pragma mark - + + //! Sets up stuff to be ready to allocate space for bitmaps BitmapManager::BitmapManager() : @@ -77,9 +88,9 @@ \return A new ServerBitmap or NULL if unable to allocate one. */ ServerBitmap* -BitmapManager::CreateBitmap(ClientMemoryAllocator* allocator, HWInterface& hwInterface, - BRect bounds, color_space space, int32 flags, int32 bytesPerRow, screen_id screen, - uint8* _allocationFlags) +BitmapManager::CreateBitmap(ClientMemoryAllocator* allocator, + HWInterface& hwInterface, BRect bounds, color_space space, int32 flags, + int32 bytesPerRow, screen_id screen, uint8* _allocationFlags) { BAutolock locker(fLock); @@ -100,7 +111,8 @@ } } - ServerBitmap* bitmap = new(nothrow) ServerBitmap(bounds, space, flags, bytesPerRow); + ServerBitmap* bitmap = new(nothrow) ServerBitmap(bounds, space, flags, + bytesPerRow); if (bitmap == NULL) { if (overlayToken != NULL) hwInterface.ReleaseOverlayChannel(overlayToken); @@ -112,7 +124,8 @@ uint8* buffer = NULL; if (flags & B_BITMAP_WILL_OVERLAY) { - Overlay* overlay = new (std::nothrow) Overlay(hwInterface); + Overlay* overlay = new (std::nothrow) Overlay(hwInterface, bitmap, + overlayToken); const overlay_buffer* overlayBuffer = NULL; overlay_client_data* clientData = NULL; @@ -123,25 +136,20 @@ // and buffer location to the BBitmap cookie = allocator->Allocate(sizeof(overlay_client_data), (void**)&clientData, newArea); - if (cookie != NULL) { - overlayBuffer = hwInterface.AllocateOverlayBuffer(bitmap->Width(), - bitmap->Height(), space); - } } - if (overlayBuffer != NULL) { - overlay->SetOverlayData(overlayBuffer, overlayToken, clientData); + if (cookie != NULL) { + overlay->SetClientData(clientData); bitmap->fAllocator = allocator; bitmap->fAllocationCookie = cookie; bitmap->SetOverlay(overlay); bitmap->fBytesPerRow = overlayBuffer->bytes_per_row; - buffer = (uint8*)overlayBuffer->buffer; + buffer = (uint8*)overlay->OverlayBuffer()->buffer; if (_allocationFlags) *_allocationFlags = kFramebuffer | (newArea ? kNewAllocatorArea : 0); } else { - hwInterface.ReleaseOverlayChannel(overlayToken); delete overlay; allocator->Free(cookie); } @@ -168,7 +176,17 @@ } } - if (buffer && fBitmapList.AddItem(bitmap)) { + bool success = false; + if (buffer != NULL) { + success = fBitmapList.AddItem(bitmap); + if (success && bitmap->Overlay() != NULL) { + success = fOverlays.AddItem(bitmap); + if (!success) + fBitmapList.RemoveItem(bitmap); + } + } + + if (success) { bitmap->fBuffer = buffer; bitmap->fToken = gTokenSpace.NewToken(kBitmapToken, bitmap); @@ -207,6 +225,68 @@ if (!locker.IsLocked()) return; + if (bitmap->Overlay() != NULL) + fOverlays.AddItem(bitmap); + if (fBitmapList.RemoveItem(bitmap)) delete bitmap; } + + +void +BitmapManager::SuspendOverlays() +{ + BAutolock locker(fLock); + if (!locker.IsLocked()) + return; + + // first, tell all applications owning an overlay to release their locks + + BObjectList apps; + for (int32 i = 0; i < fOverlays.CountItems(); i++) { + ServerBitmap* bitmap = (ServerBitmap*)fOverlays.ItemAt(i); + apps.BinaryInsert(bitmap->Owner(), &compare_app_pointer); + } + for (int32 i = 0; i < apps.CountItems(); i++) { + BMessage notify(B_RELEASE_OVERLAY_LOCK); + apps.ItemAt(i)->SendMessageToClient(¬ify); + } + + // suspend overlays + + for (int32 i = 0; i < fOverlays.CountItems(); i++) { + ServerBitmap* bitmap = (ServerBitmap*)fOverlays.ItemAt(i); + bitmap->Overlay()->Suspend(bitmap, false); + } +} + + +void +BitmapManager::ResumeOverlays() +{ + BAutolock locker(fLock); + if (!locker.IsLocked()) + return; + + // first, tell all applications owning an overlay that + // they can reacquire their locks + + BObjectList apps; + for (int32 i = 0; i < fOverlays.CountItems(); i++) { + ServerBitmap* bitmap = (ServerBitmap*)fOverlays.ItemAt(i); + apps.BinaryInsert(bitmap->Owner(), &compare_app_pointer); + } + for (int32 i = 0; i < apps.CountItems(); i++) { + BMessage notify(B_RELEASE_OVERLAY_LOCK); + apps.ItemAt(i)->SendMessageToClient(¬ify); + } + + // resume overlays + + for (int32 i = 0; i < fOverlays.CountItems(); i++) { + ServerBitmap* bitmap = (ServerBitmap*)fOverlays.ItemAt(i); + + bitmap->Overlay()->Resume(bitmap); + } +} + Modified: haiku/trunk/src/servers/app/BitmapManager.h =================================================================== --- haiku/trunk/src/servers/app/BitmapManager.h 2007-06-27 10:43:48 UTC (rev 21511) +++ haiku/trunk/src/servers/app/BitmapManager.h 2007-06-27 11:29:20 UTC (rev 21512) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -31,8 +31,12 @@ uint8* _allocationFlags = NULL); void DeleteBitmap(ServerBitmap* bitmap); + void SuspendOverlays(); + void ResumeOverlays(); + protected: BList fBitmapList; + BList fOverlays; BLocker fLock; }; Modified: haiku/trunk/src/servers/app/ServerApp.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerApp.cpp 2007-06-27 10:43:48 UTC (rev 21511) +++ haiku/trunk/src/servers/app/ServerApp.cpp 2007-06-27 11:29:20 UTC (rev 21512) @@ -624,6 +624,8 @@ Signature(), frame.Width() + 1, frame.Height() + 1)); if (bitmap != NULL && fBitmapList.AddItem(bitmap)) { + bitmap->SetOwner(this); + fLink.StartMessage(B_OK); fLink.Attach(bitmap->Token()); fLink.Attach(allocationFlags); @@ -633,8 +635,12 @@ if (allocationFlags & kFramebuffer) fLink.Attach(bitmap->BytesPerRow()); - } else + } else { + if (bitmap != NULL) + gBitmapManager->DeleteBitmap(bitmap); + fLink.StartMessage(B_NO_MEMORY); + } fLink.Flush(); break; Modified: haiku/trunk/src/servers/app/ServerBitmap.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerBitmap.cpp 2007-06-27 10:43:48 UTC (rev 21511) +++ haiku/trunk/src/servers/app/ServerBitmap.cpp 2007-06-27 11:29:20 UTC (rev 21512) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -68,7 +68,8 @@ fBytesPerRow(0), fSpace(space), fFlags(flags), - fBitsPerPixel(0) + fBitsPerPixel(0), + fOwner(NULL) // fToken is initialized (if used) by the BitmapManager { _HandleSpace(space, bytesPerRow); @@ -76,7 +77,7 @@ //! Copy constructor does not copy the buffer. -ServerBitmap::ServerBitmap(const ServerBitmap* bmp) +ServerBitmap::ServerBitmap(const ServerBitmap* bitmap) : fAllocator(NULL), fAllocationCookie(NULL), @@ -84,13 +85,14 @@ fBuffer(NULL), fReferenceCount(1) { - if (bmp) { - fWidth = bmp->fWidth; - fHeight = bmp->fHeight; - fBytesPerRow = bmp->fBytesPerRow; - fSpace = bmp->fSpace; - fFlags = bmp->fFlags; - fBitsPerPixel = bmp->fBitsPerPixel; + if (bitmap) { + fWidth = bitmap->fWidth; + fHeight = bitmap->fHeight; + fBytesPerRow = bitmap->fBytesPerRow; + fSpace = bitmap->fSpace; + fFlags = bitmap->fFlags; + fBitsPerPixel = bitmap->fBitsPerPixel; + fOwner = bitmap->fOwner; } else { fWidth = 0; fHeight = 0; @@ -98,6 +100,7 @@ fSpace = B_NO_COLOR_SPACE; fFlags = 0; fBitsPerPixel = 0; + fOwner = NULL; } } @@ -305,9 +308,9 @@ void -ServerBitmap::SetOverlay(::Overlay* cookie) +ServerBitmap::SetOverlay(::Overlay* overlay) { - fOverlay = cookie; + fOverlay = overlay; } @@ -319,6 +322,20 @@ void +ServerBitmap::SetOwner(ServerApp* owner) +{ + fOwner = owner; +} + + +ServerApp* +ServerBitmap::Owner() const +{ + return fOwner; +} + + +void ServerBitmap::PrintToStream() { printf("Bitmap@%p: (%ld:%ld), space %ld, bpr %ld, buffer %p\n", Modified: haiku/trunk/src/servers/app/ServerBitmap.h =================================================================== --- haiku/trunk/src/servers/app/ServerBitmap.h 2007-06-27 10:43:48 UTC (rev 21511) +++ haiku/trunk/src/servers/app/ServerBitmap.h 2007-06-27 11:29:20 UTC (rev 21512) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2007, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -20,6 +20,7 @@ class ClientMemoryAllocator; class HWInterface; class Overlay; +class ServerApp; /*! @@ -66,9 +67,12 @@ area_id Area() const; uint32 AreaOffset() const; - void SetOverlay(::Overlay* cookie); + void SetOverlay(::Overlay* overlay); ::Overlay* Overlay() const; + void SetOwner(ServerApp* owner); + ServerApp* Owner() const; + //! Does a shallow copy of the bitmap passed to it inline void ShallowCopy(const ServerBitmap *from); @@ -116,6 +120,8 @@ color_space fSpace; int32 fFlags; int fBitsPerPixel; + + ServerApp* fOwner; int32 fToken; }; Modified: haiku/trunk/src/servers/app/ServerScreen.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerScreen.cpp 2007-06-27 10:43:48 UTC (rev 21511) +++ haiku/trunk/src/servers/app/ServerScreen.cpp 2007-06-27 11:29:20 UTC (rev 21512) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2006, Haiku, Inc. + * Copyright (c) 2001-2007, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -9,6 +9,12 @@ */ +#include "ServerScreen.h" + +#include "BitmapManager.h" +#include "DrawingEngine.h" +#include "HWInterface.h" + #include #include #include @@ -16,12 +22,7 @@ #include #include -#include "DrawingEngine.h" -#include "HWInterface.h" -#include "ServerScreen.h" - - static float get_mode_frequency(const display_mode& mode) { @@ -87,9 +88,13 @@ status_t Screen::SetMode(display_mode mode, bool makeDefault) { + gBitmapManager->SuspendOverlays(); + status_t status = fHWInterface->SetMode(mode); // any attached DrawingEngines will be notified + gBitmapManager->ResumeOverlays(); + if (status >= B_OK) fIsDefault = makeDefault; Modified: haiku/trunk/src/servers/app/drawing/Overlay.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/Overlay.cpp 2007-06-27 10:43:48 UTC (rev 21511) +++ haiku/trunk/src/servers/app/drawing/Overlay.cpp 2007-06-27 11:29:20 UTC (rev 21512) @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku, Inc. + * Copyright 2006-2007, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -7,15 +7,54 @@ */ -#include "HWInterface.h" #include "Overlay.h" +#include "HWInterface.h" +#include "ServerBitmap.h" + #include #include -Overlay::Overlay(HWInterface& interface) +const static bigtime_t kOverlayTimeout = 1000000LL; + // after 1 second, the team holding the lock will be killed + +class SemaphoreLocker { + public: + SemaphoreLocker(sem_id semaphore, + bigtime_t timeout = B_INFINITE_TIMEOUT) + : fSemaphore(semaphore) + { + do { + fStatus = acquire_sem_etc(fSemaphore, 1, B_RELATIVE_TIMEOUT, + timeout); + } while (fStatus == B_INTERRUPTED); + } + + ~SemaphoreLocker() + { + if (fStatus == B_OK) + release_sem_etc(fSemaphore, 1, B_DO_NOT_RESCHEDULE); + } + + status_t + LockStatus() + { + return fStatus; + } + + private: + sem_id fSemaphore; + status_t fStatus; +}; + + +// #pragma mark - + + +Overlay::Overlay(HWInterface& interface, ServerBitmap* bitmap, + overlay_token token) : fHWInterface(interface), fOverlayBuffer(NULL), @@ -32,13 +71,15 @@ fWindow.offset_bottom = 0; fWindow.flags = B_OVERLAY_COLOR_KEY; + + _AllocateBuffer(bitmap); } Overlay::~Overlay() { fHWInterface.ReleaseOverlayChannel(fOverlayToken); - fHWInterface.FreeOverlayBuffer(fOverlayBuffer); + _FreeBuffer(); delete_sem(fSemaphore); } @@ -47,17 +88,71 @@ status_t Overlay::InitCheck() const { - return fSemaphore >= B_OK ? B_OK : fSemaphore; + if (fSemaphore < B_OK) + return fSemaphore; + + if (fOverlayBuffer == NULL) + return B_NO_MEMORY; + + return B_OK; } +status_t +Overlay::Resume(ServerBitmap* bitmap) +{ + SemaphoreLocker locker(fSemaphore, kOverlayTimeout); + if (locker.LockStatus() == B_TIMED_OUT) { + // TODO: kill app! + } + + status_t status = _AllocateBuffer(bitmap); + if (status < B_OK) + return status; + + fClientData->buffer = (uint8*)fOverlayBuffer->buffer; + return B_OK; +} + + +status_t +Overlay::Suspend(ServerBitmap* bitmap, bool needTemporary) +{ + SemaphoreLocker locker(fSemaphore, kOverlayTimeout); + if (locker.LockStatus() == B_TIMED_OUT) { + // TODO: kill app! + } + + _FreeBuffer(); + fClientData->buffer = NULL; + + return B_OK; +} + + void -Overlay::SetOverlayData(const overlay_buffer* overlayBuffer, - overlay_token token, overlay_client_data* clientData) +Overlay::_FreeBuffer() { - fOverlayBuffer = overlayBuffer; - fOverlayToken = token; + fHWInterface.FreeOverlayBuffer(fOverlayBuffer); + fOverlayBuffer = NULL; +} + +status_t +Overlay::_AllocateBuffer(ServerBitmap* bitmap) +{ + fOverlayBuffer = fHWInterface.AllocateOverlayBuffer(bitmap->Width(), + bitmap->Height(), bitmap->ColorSpace()); + if (fOverlayBuffer == NULL) + return B_NO_MEMORY; + + return B_OK; +} + + +void +Overlay::SetClientData(overlay_client_data* clientData) +{ fClientData = clientData; fClientData->lock = fSemaphore; fClientData->buffer = (uint8*)fOverlayBuffer->buffer; Modified: haiku/trunk/src/servers/app/drawing/Overlay.h =================================================================== --- haiku/trunk/src/servers/app/drawing/Overlay.h 2007-06-27 10:43:48 UTC (rev 21511) +++ haiku/trunk/src/servers/app/drawing/Overlay.h 2007-06-27 11:29:20 UTC (rev 21512) @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku, Inc. + * Copyright 2006-2007, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -15,18 +15,22 @@ class HWInterface; +class ServerBitmap; struct overlay_client_data; class Overlay { public: - Overlay(HWInterface& interface); + Overlay(HWInterface& interface, ServerBitmap* bitmap, + overlay_token token); ~Overlay(); status_t InitCheck() const; - void SetOverlayData(const overlay_buffer* overlayBuffer, - overlay_token token, overlay_client_data* clientData); + status_t Suspend(ServerBitmap* bitmap, bool needTemporary); + status_t Resume(ServerBitmap* bitmap); + + void SetClientData(overlay_client_data* clientData); void SetFlags(uint32 flags); void TakeOverToken(Overlay* other); @@ -51,6 +55,9 @@ void Hide(); private: + void _FreeBuffer(); + status_t _AllocateBuffer(ServerBitmap* bitmap); + HWInterface& fHWInterface; const overlay_buffer* fOverlayBuffer; overlay_client_data* fClientData; From axeld at mail.berlios.de Wed Jun 27 14:10:47 2007 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 27 Jun 2007 14:10:47 +0200 Subject: [Haiku-commits] r21513 - haiku/trunk/src/kits/interface Message-ID: <200706271210.l5RCAljP015975@sheep.berlios.de> Author: axeld Date: 2007-06-27 14:10:46 +0200 (Wed, 27 Jun 2007) New Revision: 21513 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21513&view=rev Modified: haiku/trunk/src/kits/interface/Bitmap.cpp Log: * no longer reschedule after releasing the bits lock. * LockBits() now fails with B_BUSY in case the current buffer is NULL. Modified: haiku/trunk/src/kits/interface/Bitmap.cpp =================================================================== --- haiku/trunk/src/kits/interface/Bitmap.cpp 2007-06-27 11:29:20 UTC (rev 21512) +++ haiku/trunk/src/kits/interface/Bitmap.cpp 2007-06-27 12:10:46 UTC (rev 21513) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku Inc. + * Copyright 2001-2007, Haiku Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -420,6 +420,12 @@ status = acquire_sem(data->lock); } while (status == B_INTERRUPTED); + if (data->buffer == NULL) { + // the app_server does not grant us access to the frame buffer + // right now - let's release the lock and fail + release_sem_etc(data->lock, 1, B_DO_NOT_RESCHEDULE); + return B_BUSY; + } return status; } @@ -442,7 +448,7 @@ return; overlay_client_data* data = (overlay_client_data*)fBasePointer; - release_sem(data->lock); + release_sem_etc(data->lock, 1, B_DO_NOT_RESCHEDULE); } From mmlr at mail.berlios.de Wed Jun 27 22:22:54 2007 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Wed, 27 Jun 2007 22:22:54 +0200 Subject: [Haiku-commits] r21514 - in haiku/trunk: headers/private/app headers/private/kernel/util src/kits/app Message-ID: <200706272022.l5RKMsAB032637@sheep.berlios.de> Author: mmlr Date: 2007-06-27 22:22:53 +0200 (Wed, 27 Jun 2007) New Revision: 21514 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21514&view=rev Added: haiku/trunk/headers/private/app/MessageAdapter.h haiku/trunk/src/kits/app/MessageAdapter.cpp Removed: haiku/trunk/src/kits/app/dano_message.cpp haiku/trunk/src/kits/app/dano_message.h haiku/trunk/src/kits/app/r5_message.cpp haiku/trunk/src/kits/app/r5_message.h Modified: haiku/trunk/headers/private/kernel/util/KMessage.h haiku/trunk/src/kits/app/Jamfile haiku/trunk/src/kits/app/Message.cpp Log: * Unified handling of different BMessage formats into MessageAdapter.cpp * Removed r5_message.cpp and dano_message.cpp accordingly * Also moved out KMessage handling from Message.cpp to MessageAdapter.cpp * Fixed some minor style issues in Message.cpp Added: haiku/trunk/headers/private/app/MessageAdapter.h =================================================================== --- haiku/trunk/headers/private/app/MessageAdapter.h 2007-06-27 12:10:46 UTC (rev 21513) +++ haiku/trunk/headers/private/app/MessageAdapter.h 2007-06-27 20:22:53 UTC (rev 21514) @@ -0,0 +1,54 @@ +/* + * Copyright 2007, Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Lotz + */ +#ifndef _MESSAGE_ADAPTER_H_ +#define _MESSAGE_ADAPTER_H_ + +#include +#include + +// message formats +#define MESSAGE_FORMAT_R5 'FOB1' +#define MESSAGE_FORMAT_R5_SWAPPED '1BOF' +#define MESSAGE_FORMAT_DANO 'FOB2' +#define MESSAGE_FORMAT_DANO_SWAPPED '2BOF' +#define MESSAGE_FORMAT_HAIKU '1FMH' +#define MESSAGE_FORMAT_HAIKU_SWAPPED 'HMF1' + +namespace BPrivate { + +class MessageAdapter { +public: +static ssize_t FlattenedSize(uint32 format, const BMessage *from); + +static status_t Flatten(uint32 format, const BMessage *from, + char *buffer, ssize_t *size); +static status_t Flatten(uint32 format, const BMessage *from, + BDataIO *stream, ssize_t *size); + +static status_t Unflatten(uint32 format, BMessage *into, + const char *buffer); +static status_t Unflatten(uint32 format, BMessage *into, + BDataIO *stream); + +private: +static status_t _ConvertKMessage(const KMessage *from, BMessage *to); + +static ssize_t _R5FlattenedSize(const BMessage *from); + +static status_t _FlattenR5Message(uint32 format, const BMessage *from, + char *buffer, ssize_t *size); + +static status_t _UnflattenR5Message(uint32 format, BMessage *into, + BDataIO *stream); +static status_t _UnflattenDanoMessage(uint32 format, BMessage *into, + BDataIO *stream); +}; + +} // namespace BPrivate + +#endif // _MESSAGE_ADAPTER_H_ Modified: haiku/trunk/headers/private/kernel/util/KMessage.h =================================================================== --- haiku/trunk/headers/private/kernel/util/KMessage.h 2007-06-27 12:10:46 UTC (rev 21513) +++ haiku/trunk/headers/private/kernel/util/KMessage.h 2007-06-27 20:22:53 UTC (rev 21514) @@ -16,6 +16,7 @@ namespace BPrivate { class KMessageField; +class MessageAdapter; // KMessage class KMessage { @@ -102,6 +103,7 @@ private: friend class KMessageField; + friend class MessageAdapter; friend class ::BMessage; // not so nice, but makes things easier struct Header { Modified: haiku/trunk/src/kits/app/Jamfile =================================================================== --- haiku/trunk/src/kits/app/Jamfile 2007-06-27 12:10:46 UTC (rev 21513) +++ haiku/trunk/src/kits/app/Jamfile 2007-06-27 20:22:53 UTC (rev 21514) @@ -30,7 +30,6 @@ AreaLink.cpp Cursor.cpp Clipboard.cpp - dano_message.cpp DesktopLink.cpp DirectMessageTarget.cpp Handler.cpp @@ -41,6 +40,7 @@ Looper.cpp LooperList.cpp Message.cpp + MessageAdapter.cpp MessageFilter.cpp MessageQueue.cpp MessageRunner.cpp @@ -48,7 +48,6 @@ MessageUtils.cpp PropertyInfo.cpp PortLink.cpp - r5_message.cpp RegistrarDefs.cpp RegistrarThread.cpp RegistrarThreadManager.cpp Modified: haiku/trunk/src/kits/app/Message.cpp =================================================================== --- haiku/trunk/src/kits/app/Message.cpp 2007-06-27 12:10:46 UTC (rev 21513) +++ haiku/trunk/src/kits/app/Message.cpp 2007-06-27 20:22:53 UTC (rev 21514) @@ -5,12 +5,8 @@ * Authors: * Michael Lotz */ - - -#include "dano_message.h" -#include "r5_message.h" - #include +#include #include #include @@ -41,14 +37,6 @@ #define DEBUG_FUNCTION_ENTER2 //debug_printf("thread: 0x%x; line: %04ld: func: %s\n", find_thread(NULL), __LINE__, __PRETTY_FUNCTION__); -static const uint32 kMessageMagicR5 = 'FOB1'; -static const uint32 kMessageMagicR5Swapped = '1BOF'; -static const uint32 kMessageMagicDano = 'FOB2'; -static const uint32 kMessageMagicDanoSwapped = '2BOF'; -static const uint32 kMessageMagicHaiku = '1FMH'; -static const uint32 kMessageMagicHaikuSwapped = 'HMF1'; - - const char *B_SPECIFIER_ENTRY = "specifiers"; const char *B_PROPERTY_ENTRY = "property"; const char *B_PROPERTY_NAME_ENTRY = "name"; @@ -56,8 +44,6 @@ static status_t handle_reply(port_id replyPort, int32 *pCode, bigtime_t timeout, BMessage *reply); -static status_t convert_message(const KMessage *fromMessage, - BMessage *toMessage); extern "C" { // private os function to set the owning team of an area @@ -77,6 +63,7 @@ _InitCommon(); } + BMessage::BMessage(BMessage *other) { DEBUG_FUNCTION_ENTER; @@ -84,6 +71,7 @@ *this = *other; } + BMessage::BMessage(uint32 _what) { DEBUG_FUNCTION_ENTER; @@ -195,7 +183,7 @@ fHeader = (message_header *)malloc(sizeof(message_header)); memset(fHeader, 0, sizeof(message_header) - sizeof(fHeader->hash_table)); - fHeader->format = kMessageMagicHaiku; + fHeader->format = MESSAGE_FORMAT_HAIKU; fHeader->flags = MESSAGE_FLAG_VALID; fHeader->what = what; fHeader->current_specifier = -1; @@ -379,10 +367,10 @@ } -template static uint8 * +template static uint8 * print_to_stream_type(uint8* pointer) { - Type *item = (Type *)pointer; + Type *item = (Type *)pointer; item->PrintToStream(); return (uint8 *)(item+1); } @@ -417,7 +405,7 @@ } else printf("0x%lx", what); printf(") {\n"); - + field_header *field = fFields; for (int32 i = 0; i < fHeader->field_count; i++, field++) { value = B_BENDIAN_TO_HOST_INT32(field->type); @@ -473,7 +461,7 @@ printf("bool(%s)\n", *((bool *)pointer)!= 0 ? "true" : "false"); pointer += sizeof(bool); break; - + case B_FLOAT_TYPE: pointer = print_type("float(%.4f)\n", pointer); break; @@ -481,27 +469,27 @@ case B_DOUBLE_TYPE: pointer = print_type("double(%.8f)\n", pointer); break; - + case B_REF_TYPE: { ssize_t size = *(ssize_t *)pointer; pointer += sizeof(ssize_t); entry_ref ref; BPrivate::entry_ref_unflatten(&ref, (char *)pointer, size); - + printf("entry_ref(device=%ld, directory=%lld, name=\"%s\", ", ref.device, ref.directory, ref.name); - + BPath path(&ref); printf("path=\"%s\")\n", path.Path()); pointer += size; break; } - + case B_MESSAGE_TYPE: { char buffer[1024]; sprintf(buffer, "%s ", indent); - + BMessage message; const ssize_t size = *(const ssize_t *)pointer; pointer += sizeof(ssize_t); @@ -514,7 +502,7 @@ pointer += size; break; } - + default: { printf("(type = '%.4s')(size = %ld)\n", (char *)&value, size); } @@ -761,7 +749,7 @@ BMessage::FlattenedSize() const { DEBUG_FUNCTION_ENTER; - return BPrivate::r5_message_flattened_size(this); + return BPrivate::MessageAdapter::FlattenedSize(MESSAGE_FORMAT_R5, this); } @@ -769,7 +757,8 @@ BMessage::Flatten(char *buffer, ssize_t size) const { DEBUG_FUNCTION_ENTER; - return BPrivate::flatten_r5_message(this, buffer, size); + return BPrivate::MessageAdapter::Flatten(MESSAGE_FORMAT_R5, this, buffer, + &size); } @@ -777,7 +766,8 @@ BMessage::Flatten(BDataIO *stream, ssize_t *size) const { DEBUG_FUNCTION_ENTER; - return BPrivate::flatten_r5_message(this, stream, size); + return BPrivate::MessageAdapter::Flatten(MESSAGE_FORMAT_R5, this, stream, + size); } @@ -801,8 +791,6 @@ /* we have to sync the what code as it is a public member */ fHeader->what = what; - //fHeader->fields_checksum = BPrivate::CalculateChecksum((uint8 *)fFields, fHeader->fields_size); - //fHeader->data_checksum = BPrivate::CalculateChecksum((uint8 *)fData, fHeader->data_size); memcpy(buffer, fHeader, min_c(sizeof(message_header), (size_t)size)); buffer += sizeof(message_header); @@ -832,8 +820,6 @@ /* we have to sync the what code as it is a public member */ fHeader->what = what; - //fHeader->fields_checksum = BPrivate::CalculateChecksum((uint8 *)fFields, fHeader->fields_size); - //fHeader->data_checksum = BPrivate::CalculateChecksum((uint8 *)fData, fHeader->data_size); ssize_t result1 = stream->Write(fHeader, sizeof(message_header)); if (result1 != sizeof(message_header)) @@ -962,6 +948,15 @@ fFields = (field_header *)address; address += fHeader->fields_size; fData = address; + + if (fHeader->fields_checksum != BPrivate::CalculateChecksum((uint8 *)fFields, fHeader->fields_size) + || fHeader->data_checksum != BPrivate::CalculateChecksum((uint8 *)fData, fHeader->data_size)) { + debug_printf("checksum mismatch\n"); + _Clear(); + _InitHeader(); + return B_BAD_VALUE; + } + return B_OK; } @@ -1017,34 +1012,9 @@ return B_BAD_VALUE; uint32 format = *(uint32 *)flatBuffer; - if (format != kMessageMagicHaiku) { - if (format == KMessage::kMessageHeaderMagic) { - KMessage message; - status_t result = message.SetTo(flatBuffer, - ((KMessage::Header*)flatBuffer)->size); - if (result != B_OK) - return result; + if (format != MESSAGE_FORMAT_HAIKU) + return BPrivate::MessageAdapter::Unflatten(format, this, flatBuffer); - return convert_message(&message, this); - } - - try { - if (format == kMessageMagicR5 || format == kMessageMagicR5Swapped) - return BPrivate::unflatten_r5_message(format, this, flatBuffer); - - if (format == kMessageMagicDano || format == kMessageMagicDanoSwapped) { - BMemoryIO stream(flatBuffer + sizeof(uint32), - BPrivate::dano_message_flattened_size(flatBuffer)); - return BPrivate::unflatten_dano_message(format, stream, *this); - } - } catch (status_t error) { - MakeEmpty(); - return error; - } - - return B_NOT_A_MESSAGE; - } - // native message unflattening _Clear(); @@ -1056,7 +1026,7 @@ memcpy(fHeader, flatBuffer, sizeof(message_header)); flatBuffer += sizeof(message_header); - if (fHeader->format != kMessageMagicHaiku + if (fHeader->format != MESSAGE_FORMAT_HAIKU || !(fHeader->flags & MESSAGE_FLAG_VALID)) { free(fHeader); fHeader = NULL; @@ -1093,14 +1063,6 @@ } } - /*if (fHeader->fields_checksum != BPrivate::CalculateChecksum((uint8 *)fFields, fHeader->fields_size) - || fHeader->data_checksum != BPrivate::CalculateChecksum((uint8 *)fData, fHeader->data_size)) { - debug_printf("checksum mismatch 1\n"); - _Clear(); - _InitHeader(); - return B_BAD_VALUE; - }*/ - return B_OK; } @@ -1114,21 +1076,9 @@ uint32 format = 0; stream->Read(&format, sizeof(uint32)); - if (format != kMessageMagicHaiku) { - try { - if (format == kMessageMagicR5 || format == kMessageMagicR5Swapped) - return BPrivate::unflatten_r5_message(format, this, stream); + if (format != MESSAGE_FORMAT_HAIKU) + return BPrivate::MessageAdapter::Unflatten(format, this, stream); - if (format == kMessageMagicDano || format == kMessageMagicDanoSwapped) - return BPrivate::unflatten_dano_message(format, *stream, *this); - } catch (status_t error) { - MakeEmpty(); - return error; - } - - return B_NOT_A_MESSAGE; - } - // native message unflattening _Clear(); @@ -1143,7 +1093,7 @@ sizeof(message_header) - sizeof(uint32)); result -= sizeof(message_header) - sizeof(uint32); - if (result != B_OK || fHeader->format != kMessageMagicHaiku + if (result != B_OK || fHeader->format != MESSAGE_FORMAT_HAIKU || !(fHeader->flags & MESSAGE_FLAG_VALID)) { free(fHeader); fHeader = NULL; @@ -1184,14 +1134,6 @@ return B_BAD_VALUE; } - /*if (fHeader->fields_checksum != BPrivate::CalculateChecksum((uint8 *)fFields, fHeader->fields_size) - || fHeader->data_checksum != BPrivate::CalculateChecksum((uint8 *)fData, fHeader->data_size)) { - debug_printf("checksum mismatch 2\n"); - _Clear(); - _InitHeader(); - return B_BAD_VALUE; - }*/ - return B_OK; } @@ -1329,7 +1271,7 @@ } } - return B_OK; + return B_OK; } @@ -1887,7 +1829,7 @@ port_info info; get_port_info(port, &info); void *address = NULL; - _kern_transfer_area(header->shared_area, &address, B_ANY_ADDRESS, + _kern_transfer_area(header->shared_area, &address, B_ANY_ADDRESS, info.team); #endif } else { @@ -2075,11 +2017,11 @@ uint32 magic = *(uint32 *)data; - if (magic == kMessageMagicHaiku || magic == kMessageMagicHaikuSwapped) { + if (magic == MESSAGE_FORMAT_HAIKU || magic == MESSAGE_FORMAT_HAIKU_SWAPPED) { message_header *header = (message_header *)data; header->target = token; header->flags |= MESSAGE_FLAG_WAS_DELIVERED; - } else if (magic == kMessageMagicR5) { + } else if (magic == MESSAGE_FORMAT_R5) { uint8 *header = (uint8 *)data; header += sizeof(uint32) /* magic */ + sizeof(uint32) /* checksum */ + sizeof(ssize_t) /* flattenedSize */ + sizeof(int32) /* what */ @@ -2134,63 +2076,6 @@ } -static status_t -convert_message(const KMessage *fromMessage, BMessage *toMessage) -{ - DEBUG_FUNCTION_ENTER2; - if (!fromMessage || !toMessage) - return B_BAD_VALUE; - - // make empty and init what of the target message - toMessage->MakeEmpty(); - toMessage->what = fromMessage->What(); - - BMessage::Private toPrivate(toMessage); - toPrivate.SetTarget(fromMessage->TargetToken()); - toPrivate.SetReply(B_SYSTEM_TEAM, fromMessage->ReplyPort(), - fromMessage->ReplyToken()); - - // iterate through the fields and import them in the target message - KMessageField field; - while (fromMessage->GetNextField(&field) == B_OK) { - int32 elementCount = field.CountElements(); - if (elementCount > 0) { - for (int32 i = 0; i < elementCount; i++) { - int32 size; - const void *data = field.ElementAt(i, &size); - status_t result; - - if (field.TypeCode() == B_MESSAGE_TYPE) { - // message type: if it's a KMessage, convert it - KMessage message; - if (message.SetTo(data, size) == B_OK) { - BMessage bMessage; - result = convert_message(&message, &bMessage); - if (result < B_OK) - return result; - - result = toMessage->AddMessage(field.Name(), &bMessage); - } else { - // just add it - result = toMessage->AddData(field.Name(), - field.TypeCode(), data, size, - field.HasFixedElementSize(), 1); - } - } else { - result = toMessage->AddData(field.Name(), field.TypeCode(), - data, size, field.HasFixedElementSize(), 1); - } - - if (result < B_OK) - return result; - } - } - } - - return B_OK; -} - - void BMessage::_ReservedMessage1(void) {}; void BMessage::_ReservedMessage2(void) {}; void BMessage::_ReservedMessage3(void) {}; Added: haiku/trunk/src/kits/app/MessageAdapter.cpp =================================================================== --- haiku/trunk/src/kits/app/MessageAdapter.cpp 2007-06-27 12:10:46 UTC (rev 21513) +++ haiku/trunk/src/kits/app/MessageAdapter.cpp 2007-06-27 20:22:53 UTC (rev 21514) @@ -0,0 +1,772 @@ +/* + * Copyright 2005-2007, Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel D?rfler, axeld at pinc-software.de + * Michael Lotz + */ +#include +#include +#include + +namespace BPrivate { + +#define R5_MESSAGE_FLAG_VALID 0x01 +#define R5_MESSAGE_FLAG_INCLUDE_TARGET 0x02 +#define R5_MESSAGE_FLAG_INCLUDE_REPLY 0x04 +#define R5_MESSAGE_FLAG_SCRIPT_MESSAGE 0x08 + +#define R5_FIELD_FLAG_VALID 0x01 +#define R5_FIELD_FLAG_MINI_DATA 0x02 +#define R5_FIELD_FLAG_FIXED_SIZE 0x04 +#define R5_FIELD_FLAG_SINGLE_ITEM 0x08 + + +enum { + SECTION_MESSAGE_HEADER = 'FOB2', + SECTION_OFFSET_TABLE = 'STof', + SECTION_TARGET_INFORMATION = 'ENwh', + SECTION_SINGLE_ITEM_DATA = 'SGDa', + SECTION_FIXED_SIZE_ARRAY_DATA = 'FADa', + SECTION_VARIABLE_SIZE_ARRAY_DATA = 'VADa', + SECTION_SORTED_INDEX_TABLE = 'DXIn', + SECTION_END_OF_DATA = 'DDEn' +}; + + +struct r5_message_header { + uint32 magic; + uint32 checksum; + ssize_t flattened_size; + int32 what; + uint8 flags; +} _PACKED; + +struct dano_section_header { + uint32 code; + ssize_t size; + uint8 data[0]; +} _PACKED; + +struct dano_message_header { + int32 what; + int32 padding; +} _PACKED; + +typedef struct offset_table_s { + int32 indexTable; + int32 endOfData; + int64 padding; +} OffsetTable; + +struct dano_single_item { + type_code type; + ssize_t item_size; + uint8 name_length; + char name[0]; +} _PACKED; + +struct dano_fixed_size_array { + type_code type; + ssize_t size_per_item; + uint8 name_length; + char name[0]; +} _PACKED; + + +struct dano_variable_size_array { + type_code type; + int32 padding; + uint8 name_length; + char name[0]; +} _PACKED; + + +inline int32 +pad_to_8(int32 value) +{ + return (value + 7) & ~7; +} + + +ssize_t +MessageAdapter::FlattenedSize(uint32 format, const BMessage *from) +{ + switch (format) { + case MESSAGE_FORMAT_R5: + case MESSAGE_FORMAT_R5_SWAPPED: + return _R5FlattenedSize(from); + } + + return -1; +} + + +status_t +MessageAdapter::Flatten(uint32 format, const BMessage *from, char *buffer, + ssize_t *size) +{ + switch (format) { + case MESSAGE_FORMAT_R5: + case MESSAGE_FORMAT_R5_SWAPPED: + return _FlattenR5Message(format, from, buffer, size); + } + + return B_ERROR; +} + + +status_t +MessageAdapter::Flatten(uint32 format, const BMessage *from, BDataIO *stream, + ssize_t *size) +{ + switch (format) { + case MESSAGE_FORMAT_R5: + case MESSAGE_FORMAT_R5_SWAPPED: + { + ssize_t flattenedSize = _R5FlattenedSize(from); + char *buffer = (char *)malloc(flattenedSize); + if (!buffer) + return B_NO_MEMORY; + + status_t result = _FlattenR5Message(format, from, buffer, + &flattenedSize); + if (result < B_OK) { + free(buffer); + return result; + } + + ssize_t written = stream->Write(buffer, flattenedSize); + if (written != flattenedSize) { + free(buffer); + return (written >= 0 ? B_ERROR : written); + } + + if (size) + *size = flattenedSize; + + free(buffer); + return B_OK; + } + } + + return B_ERROR; +} + + +status_t +MessageAdapter::Unflatten(uint32 format, BMessage *into, const char *buffer) +{ + if (format == KMessage::kMessageHeaderMagic) { + KMessage message; + status_t result = message.SetTo(buffer, + ((KMessage::Header *)buffer)->size); + if (result != B_OK) + return result; + + return _ConvertKMessage(&message, into); + } + + try { + switch (format) { + case MESSAGE_FORMAT_R5: + case MESSAGE_FORMAT_R5_SWAPPED: + { + r5_message_header *header = (r5_message_header *)buffer; + BMemoryIO stream(buffer + sizeof(uint32), + header->flattened_size - sizeof(uint32)); + return _UnflattenR5Message(format, into, &stream); + } + + case MESSAGE_FORMAT_DANO: + case MESSAGE_FORMAT_DANO_SWAPPED: + { + dano_section_header *header = (dano_section_header *)buffer; + ssize_t size = header->size; + if (header->code == MESSAGE_FORMAT_DANO_SWAPPED) + size = __swap_int32(size); + + BMemoryIO stream(buffer + sizeof(uint32), size - sizeof(uint32)); + return _UnflattenDanoMessage(format, into, &stream); + } + } + } catch (status_t error) { + into->MakeEmpty(); + return error; + } + + return B_NOT_A_MESSAGE; +} + + +status_t +MessageAdapter::Unflatten(uint32 format, BMessage *into, BDataIO *stream) +{ + try { + switch (format) { + case MESSAGE_FORMAT_R5: + case MESSAGE_FORMAT_R5_SWAPPED: + return _UnflattenR5Message(format, into, stream); + + case MESSAGE_FORMAT_DANO: + case MESSAGE_FORMAT_DANO_SWAPPED: + return _UnflattenDanoMessage(format, into, stream); + } + } catch (status_t error) { + into->MakeEmpty(); + return error; + } + + return B_NOT_A_MESSAGE; +} + + +status_t +MessageAdapter::_ConvertKMessage(const KMessage *fromMessage, + BMessage *toMessage) +{ + if (!fromMessage || !toMessage) + return B_BAD_VALUE; + + // make empty and init what of the target message + toMessage->MakeEmpty(); + toMessage->what = fromMessage->What(); + + BMessage::Private toPrivate(toMessage); + toPrivate.SetTarget(fromMessage->TargetToken()); + toPrivate.SetReply(B_SYSTEM_TEAM, fromMessage->ReplyPort(), + fromMessage->ReplyToken()); + + // iterate through the fields and import them in the target message + KMessageField field; + while (fromMessage->GetNextField(&field) == B_OK) { + int32 elementCount = field.CountElements(); + if (elementCount > 0) { + for (int32 i = 0; i < elementCount; i++) { + int32 size; + const void *data = field.ElementAt(i, &size); + status_t result; + + if (field.TypeCode() == B_MESSAGE_TYPE) { + // message type: if it's a KMessage, convert it + KMessage message; + if (message.SetTo(data, size) == B_OK) { + BMessage bMessage; + result = _ConvertKMessage(&message, &bMessage); + if (result < B_OK) + return result; + + result = toMessage->AddMessage(field.Name(), &bMessage); + } else { + // just add it + result = toMessage->AddData(field.Name(), + field.TypeCode(), data, size, + field.HasFixedElementSize(), 1); + } + } else { + result = toMessage->AddData(field.Name(), field.TypeCode(), + data, size, field.HasFixedElementSize(), 1); + } + + if (result < B_OK) + return result; + } + } + } + + return B_OK; +} + + +ssize_t +MessageAdapter::_R5FlattenedSize(const BMessage *from) +{ + BMessage::Private messagePrivate((BMessage *)from); + BMessage::message_header* header = messagePrivate.GetMessageHeader(); + + // header size (variable, depending on the flags) + + ssize_t flattenedSize = sizeof(r5_message_header); + + if (header->target != B_NULL_TOKEN) + flattenedSize += sizeof(int32); + + if (header->reply_port >= 0 && header->reply_target != B_NULL_TOKEN + && header->reply_team >= 0) { + // reply info + big flags + flattenedSize += sizeof(port_id) + sizeof(int32) + sizeof(team_id) + 4; + } + + // field size + + uint8 *data = messagePrivate.GetMessageData(); + BMessage::field_header *field = messagePrivate.GetMessageFields(); + for (int32 i = 0; i < header->field_count; i++, field++) { + // flags and type + flattenedSize += 1 + sizeof(type_code); + +#if 0 + bool miniData = field->dataSize <= 255 && field->count <= 255; +#else + // ToDo: we don't know the R5 dataSize yet (padding) + bool miniData = false; +#endif + + // item count + if (field->count > 1) + flattenedSize += (miniData ? sizeof(uint8) : sizeof(uint32)); + + // data size + flattenedSize += (miniData ? sizeof(uint8) : sizeof(size_t)); + + // name length and name + flattenedSize += 1 + min_c(field->name_length - 1, 255); + + // data + if (field->flags & FIELD_FLAG_FIXED_SIZE) + flattenedSize += field->data_size; + else { + uint8 *source = data + field->offset + field->name_length; + + for (int32 i = 0; i < field->count; i++) { + ssize_t itemSize = *(ssize_t *)source + sizeof(ssize_t); + flattenedSize += pad_to_8(itemSize); + source += itemSize; + } + } + } + + // pseudo field with flags 0 + return flattenedSize + 1; +} + + +status_t +MessageAdapter::_FlattenR5Message(uint32 format, const BMessage *from, + char *buffer, ssize_t *size) +{ + BMessage::Private messagePrivate((BMessage *)from); + BMessage::message_header *header = messagePrivate.GetMessageHeader(); + uint8 *data = messagePrivate.GetMessageData(); + + r5_message_header *r5header = (r5_message_header *)buffer; + uint8 *pointer = (uint8 *)buffer + sizeof(r5_message_header); + + r5header->magic = MESSAGE_FORMAT_R5; + r5header->what = from->what; + r5header->checksum = 0; + + uint8 flags = R5_MESSAGE_FLAG_VALID; + if (header->target != B_NULL_TOKEN) { + *(int32 *)pointer = header->target; + pointer += sizeof(int32); + flags |= R5_MESSAGE_FLAG_INCLUDE_TARGET; + } + + if (header->reply_port >= 0 && header->reply_target != B_NULL_TOKEN + && header->reply_team >= 0) { + // reply info + *(port_id *)pointer = header->reply_port; + pointer += sizeof(port_id); + *(int32 *)pointer = header->reply_target; + pointer += sizeof(int32); + *(team_id *)pointer = header->reply_team; + pointer += sizeof(team_id); + + // big flags + *pointer = (header->reply_target == B_PREFERRED_TOKEN ? 1 : 0); + pointer++; + + *pointer = (header->flags & MESSAGE_FLAG_REPLY_REQUIRED ? 1 : 0); + pointer++; + + *pointer = (header->flags & MESSAGE_FLAG_REPLY_DONE ? 1 : 0); + pointer++; + + *pointer = (header->flags & MESSAGE_FLAG_IS_REPLY ? 1 : 0); + pointer++; + + flags |= R5_MESSAGE_FLAG_INCLUDE_REPLY; + } + + if (header->flags & MESSAGE_FLAG_HAS_SPECIFIERS) + flags |= R5_MESSAGE_FLAG_SCRIPT_MESSAGE; + + r5header->flags = flags; + + // store the header size - used for the checksum later + ssize_t headerSize = (uint32)pointer - (uint32)buffer; + + // collect and add the data + BMessage::field_header *field = messagePrivate.GetMessageFields(); + for (int32 i = 0; i < header->field_count; i++, field++) { + flags = R5_FIELD_FLAG_VALID; + + if (field->count == 1) + flags |= R5_FIELD_FLAG_SINGLE_ITEM; + // ToDo: we don't really know the data size now (padding missing) + if (field->data_size <= 255 && field->count <= 255) + ;//flags |= R5_FIELD_FLAG_MINI_DATA; + if (field->flags & FIELD_FLAG_FIXED_SIZE) + flags |= R5_FIELD_FLAG_FIXED_SIZE; + + *pointer = flags; + pointer++; + + *(type_code *)pointer = field->type; + pointer += sizeof(type_code); + + if (!(flags & R5_FIELD_FLAG_SINGLE_ITEM)) { + if (flags & R5_FIELD_FLAG_MINI_DATA) { + *pointer = (uint8)field->count; + pointer++; + } else { + *(int32 *)pointer = field->count; + pointer += sizeof(int32); + } + } + + // we may have to adjust this to account for padding later + uint8 *fieldSize = pointer; + if (flags & R5_FIELD_FLAG_MINI_DATA) { + *pointer = (uint8)field->data_size; + pointer++; + } else { + *(ssize_t *)pointer = field->data_size; + pointer += sizeof(ssize_t); + } + + // name + int32 nameLength = min_c(field->name_length - 1, 255); + *pointer = (uint8)nameLength; + pointer++; + + strncpy((char *)pointer, (char *)data + field->offset, nameLength); + pointer += nameLength; + + // data + uint8 *source = data + field->offset + field->name_length; + if (flags & R5_FIELD_FLAG_FIXED_SIZE) { + memcpy(pointer, source, field->data_size); + pointer += field->data_size; + } else { + uint8 *previous = pointer; + for (int32 i = 0; i < field->count; i++) { + ssize_t itemSize = *(ssize_t *)source + sizeof(ssize_t); + memcpy(pointer, source, itemSize); + pointer += pad_to_8(itemSize); + source += itemSize; + } + + // adjust the field size to the padded value + if (flags & R5_FIELD_FLAG_MINI_DATA) + *fieldSize = (uint8)(pointer - previous); + else + *(ssize_t *)fieldSize = (pointer - previous); + } + } + + // terminate the fields with a pseudo field with flags 0 (not valid) + *pointer = 0; + pointer++; + + // calculate the flattened size from the pointers + r5header->flattened_size = (uint32)pointer - (uint32)buffer; + r5header->checksum = CalculateChecksum((uint8 *)(buffer + 8), [... truncated: 305 lines follow ...] From mmlr at mail.berlios.de Wed Jun 27 22:33:52 2007 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Wed, 27 Jun 2007 22:33:52 +0200 Subject: [Haiku-commits] r21515 - in haiku/trunk: headers/build/os/app headers/build/private/app src/build/libbe/app Message-ID: <200706272033.l5RKXqKJ000542@sheep.berlios.de> Author: mmlr Date: 2007-06-27 22:33:51 +0200 (Wed, 27 Jun 2007) New Revision: 21515 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=21515&view=rev Added: haiku/trunk/headers/build/private/app/MessageAdapter.h haiku/trunk/src/build/libbe/app/MessageA