Merge branch 'master' into sam460ex

This commit is contained in:
François Revol
2013-04-02 03:29:47 +02:00
63 changed files with 1162 additions and 555 deletions
+4 -4
View File
@@ -2349,13 +2349,13 @@ if [ IsOptionalHaikuImagePackageAdded wpa_supplicant ] {
Echo "No optional package wpa_supplicant available for $(TARGET_ARCH)" ; Echo "No optional package wpa_supplicant available for $(TARGET_ARCH)" ;
} else if $(HAIKU_GCC_VERSION[1]) >= 4 { } else if $(HAIKU_GCC_VERSION[1]) >= 4 {
InstallOptionalHaikuImagePackage InstallOptionalHaikuImagePackage
wpa_supplicant-0.7.3-x86-gcc4-2012-04-03.zip wpa_supplicant-2.0-x86-gcc4-2013-03-31.zip
: $(baseURL)/wpa_supplicant-0.7.3-x86-gcc4-2012-04-03.zip : $(baseURL)/wpa_supplicant-2.0-x86-gcc4-2013-03-31.zip
: : : false ; : : : false ;
} else { } else {
InstallOptionalHaikuImagePackage InstallOptionalHaikuImagePackage
wpa_supplicant-0.7.3-x86-gcc2-2012-04-03.zip wpa_supplicant-2.0-x86-gcc2-2013-03-31.zip
: $(baseURL)/wpa_supplicant-0.7.3-x86-gcc2-2012-04-03.zip : $(baseURL)/wpa_supplicant-2.0-x86-gcc2-2013-03-31.zip
: : : false ; : : : false ;
} }
} }
@@ -1,4 +1,4 @@
1 russian x-vnd.Haiku-hmulti_audio.media_addon 1236066687 1 russian x-vnd.Haiku-hmulti_audio.media_addon 451057402
Master MultiAudio Главный Master MultiAudio Главный
SPDIF MultiAudio SPDIF SPDIF MultiAudio SPDIF
Gain MultiAudio Громкость Gain MultiAudio Громкость
@@ -18,3 +18,17 @@ Output treble MultiAudio Выход высоких
Mono mix MultiAudio Моно микширование Mono mix MultiAudio Моно микширование
General MultiAudio Общие General MultiAudio Общие
Input & Output MultiAudio Вход и Выход Input & Output MultiAudio Вход и Выход
Enhanced Setup MultiAudio Расщиренные настройки
Stereo mix MultiAudio Стерео микширование
Output 3D depth MultiAudio Выход 3D глубины
Volume MultiAudio Громкость
Output MultiAudio Выход
Video MultiAudio Видео
Line MultiAudio Линия
Mic MultiAudio Микрофон
frequency: MultiAudio частота:
Enable MultiAudio Включить
Mute MultiAudio Приглушить
Wave MultiAudio Волна
Setup MultiAudio Настройки
Level MultiAudio Уровень
+5 -1
View File
@@ -1,16 +1,19 @@
1 hungarian x-vnd.Be-TSKB 1042823442 1 hungarian x-vnd.Be-TSKB 2335730970
Power off DeskbarMenu Kikapcsolás Power off DeskbarMenu Kikapcsolás
Sort applications by name PreferencesWindow Rendezés a program neve szerint
Suspend DeskbarMenu Felfüggesztés Suspend DeskbarMenu Felfüggesztés
Hide clock TimeView Óra elrejtése Hide clock TimeView Óra elrejtése
Applications PreferencesWindow Programok Applications PreferencesWindow Programok
Time preferences… TimeView Idő beállítása… Time preferences… TimeView Idő beállítása…
About Haiku DeskbarMenu Haiku névjegye About Haiku DeskbarMenu Haiku névjegye
Edit in Tracker… PreferencesWindow Szerkesztés a Nyomkövetőben…
Recent documents: PreferencesWindow Legutóbb használt fájlok: Recent documents: PreferencesWindow Legutóbb használt fájlok:
Recent applications DeskbarMenu Legutóbbi programok Recent applications DeskbarMenu Legutóbbi programok
Applications B_USER_DESKBAR_DIRECTORY/Applications Programok Applications B_USER_DESKBAR_DIRECTORY/Applications Programok
Find… DeskbarMenu Keresés… Find… DeskbarMenu Keresés…
Show clock Tray Óra megjelenítése Show clock Tray Óra megjelenítése
Window PreferencesWindow Ablak Window PreferencesWindow Ablak
Defaults PreferencesWindow Eredeti
Menu PreferencesWindow Menü Menu PreferencesWindow Menü
Recent documents DeskbarMenu Legutóbb használt fájlok Recent documents DeskbarMenu Legutóbb használt fájlok
Auto-hide PreferencesWindow Automatikus elrejtés Auto-hide PreferencesWindow Automatikus elrejtés
@@ -28,6 +31,7 @@ Restart Tracker DeskbarMenu Nyomkövető újraindítása
Close all WindowMenu Összes bezárása Close all WindowMenu Összes bezárása
Deskbar preferences PreferencesWindow Asztalsáv-beállítások Deskbar preferences PreferencesWindow Asztalsáv-beállítások
Mount DeskbarMenu Csatolás Mount DeskbarMenu Csatolás
Revert PreferencesWindow Visszaállítás
Small PreferencesWindow Kicsi Small PreferencesWindow Kicsi
Recent applications: PreferencesWindow Legutóbbi programok: Recent applications: PreferencesWindow Legutóbbi programok:
Shutdown… DeskbarMenu Leállítás… Shutdown… DeskbarMenu Leállítás…
+6 -1
View File
@@ -1,15 +1,19 @@
1 japanese x-vnd.Be-TSKB 1398106986 1 japanese x-vnd.Be-TSKB 2335730970
Power off DeskbarMenu 電源を切る Power off DeskbarMenu 電源を切る
Sort applications by name PreferencesWindow アプリケーションを名前順に並び替える
Suspend DeskbarMenu サスペンド Suspend DeskbarMenu サスペンド
Hide clock TimeView 時計を隠す Hide clock TimeView 時計を隠す
Applications PreferencesWindow アプリケーション
Time preferences… TimeView 日付と時刻の設定… Time preferences… TimeView 日付と時刻の設定…
About Haiku DeskbarMenu Haiku について About Haiku DeskbarMenu Haiku について
Edit in Tracker… PreferencesWindow Tracker 中で編集…
Recent documents: PreferencesWindow 最近使ったドキュメント Recent documents: PreferencesWindow 最近使ったドキュメント
Recent applications DeskbarMenu 最近使ったアプリケーション Recent applications DeskbarMenu 最近使ったアプリケーション
Applications B_USER_DESKBAR_DIRECTORY/Applications アプリケーション Applications B_USER_DESKBAR_DIRECTORY/Applications アプリケーション
Find… DeskbarMenu 検索… Find… DeskbarMenu 検索…
Show clock Tray 時計を表示 Show clock Tray 時計を表示
Window PreferencesWindow ウィンドウ Window PreferencesWindow ウィンドウ
Defaults PreferencesWindow デフォルト値
Menu PreferencesWindow メニュー Menu PreferencesWindow メニュー
Recent documents DeskbarMenu 最近使ったドキュメント Recent documents DeskbarMenu 最近使ったドキュメント
Auto-hide PreferencesWindow 自動的に隠す Auto-hide PreferencesWindow 自動的に隠す
@@ -27,6 +31,7 @@ Restart Tracker DeskbarMenu Tracker を再起動
Close all WindowMenu すべて閉じる Close all WindowMenu すべて閉じる
Deskbar preferences PreferencesWindow Deskbar の設定 Deskbar preferences PreferencesWindow Deskbar の設定
Mount DeskbarMenu マウント Mount DeskbarMenu マウント
Revert PreferencesWindow 取り消し
Small PreferencesWindow 小 Small PreferencesWindow 小
Recent applications: PreferencesWindow 最近使ったアプリケーション Recent applications: PreferencesWindow 最近使ったアプリケーション
Shutdown… DeskbarMenu シャットダウン… Shutdown… DeskbarMenu シャットダウン…
+5 -1
View File
@@ -1,16 +1,19 @@
1 russian x-vnd.Be-TSKB 1042823442 1 russian x-vnd.Be-TSKB 2335730970
Power off DeskbarMenu Выключить компьютер Power off DeskbarMenu Выключить компьютер
Sort applications by name PreferencesWindow Сортировать приложения по имени
Suspend DeskbarMenu Приостановить Suspend DeskbarMenu Приостановить
Hide clock TimeView Скрыть часы Hide clock TimeView Скрыть часы
Applications PreferencesWindow Приложения Applications PreferencesWindow Приложения
Time preferences… TimeView Настроить часы… Time preferences… TimeView Настроить часы…
About Haiku DeskbarMenu О системе Haiku About Haiku DeskbarMenu О системе Haiku
Edit in Tracker… PreferencesWindow Изменить меню…
Recent documents: PreferencesWindow Недавние документы: Recent documents: PreferencesWindow Недавние документы:
Recent applications DeskbarMenu Недавние приложения Recent applications DeskbarMenu Недавние приложения
Applications B_USER_DESKBAR_DIRECTORY/Applications Приложения Applications B_USER_DESKBAR_DIRECTORY/Applications Приложения
Find… DeskbarMenu Найти… Find… DeskbarMenu Найти…
Show clock Tray Показать часы Show clock Tray Показать часы
Window PreferencesWindow Окно Window PreferencesWindow Окно
Defaults PreferencesWindow По умолчанию
Menu PreferencesWindow Меню Menu PreferencesWindow Меню
Recent documents DeskbarMenu Недавние документы Recent documents DeskbarMenu Недавние документы
Auto-hide PreferencesWindow Скрывать автоматически Auto-hide PreferencesWindow Скрывать автоматически
@@ -28,6 +31,7 @@ Restart Tracker DeskbarMenu Перезапустить Tracker
Close all WindowMenu Закрыть все Close all WindowMenu Закрыть все
Deskbar preferences PreferencesWindow Настройки Deskbar Deskbar preferences PreferencesWindow Настройки Deskbar
Mount DeskbarMenu Подключить Mount DeskbarMenu Подключить
Revert PreferencesWindow Вернуть
Small PreferencesWindow Маленькие Small PreferencesWindow Маленькие
Recent applications: PreferencesWindow Недавние приложения: Recent applications: PreferencesWindow Недавние приложения:
Shutdown… DeskbarMenu Завершение работы… Shutdown… DeskbarMenu Завершение работы…
+6 -1
View File
@@ -1,15 +1,19 @@
1 swedish x-vnd.Be-TSKB 1398106986 1 swedish x-vnd.Be-TSKB 2335730970
Power off DeskbarMenu Stäng av Power off DeskbarMenu Stäng av
Sort applications by name PreferencesWindow Sortera program efter namn
Suspend DeskbarMenu Vänteläge Suspend DeskbarMenu Vänteläge
Hide clock TimeView Dölj klockan Hide clock TimeView Dölj klockan
Applications PreferencesWindow Program
Time preferences… TimeView Tidspreferenser Time preferences… TimeView Tidspreferenser
About Haiku DeskbarMenu Om Haiku About Haiku DeskbarMenu Om Haiku
Edit in Tracker… PreferencesWindow Editera i Tracker…
Recent documents: PreferencesWindow Senaste dokument: Recent documents: PreferencesWindow Senaste dokument:
Recent applications DeskbarMenu Senaste program Recent applications DeskbarMenu Senaste program
Applications B_USER_DESKBAR_DIRECTORY/Applications Program Applications B_USER_DESKBAR_DIRECTORY/Applications Program
Find… DeskbarMenu Sök... Find… DeskbarMenu Sök...
Show clock Tray Visa klockan Show clock Tray Visa klockan
Window PreferencesWindow Fönster Window PreferencesWindow Fönster
Defaults PreferencesWindow Standardvärden
Menu PreferencesWindow Meny Menu PreferencesWindow Meny
Recent documents DeskbarMenu Senaste dokument Recent documents DeskbarMenu Senaste dokument
Auto-hide PreferencesWindow Dölj automatiskt Auto-hide PreferencesWindow Dölj automatiskt
@@ -27,6 +31,7 @@ Restart Tracker DeskbarMenu Starta om Tracker
Close all WindowMenu Stäng alla Close all WindowMenu Stäng alla
Deskbar preferences PreferencesWindow Deskbar inställningar Deskbar preferences PreferencesWindow Deskbar inställningar
Mount DeskbarMenu Montera Mount DeskbarMenu Montera
Revert PreferencesWindow Återgå
Small PreferencesWindow Liten Small PreferencesWindow Liten
Recent applications: PreferencesWindow Senaste program: Recent applications: PreferencesWindow Senaste program:
Shutdown… DeskbarMenu Stäng av… Shutdown… DeskbarMenu Stäng av…
+2 -1
View File
@@ -1,4 +1,4 @@
1 russian x-vnd.Haiku-DriveSetup 4139684894 1 russian x-vnd.Haiku-DriveSetup 2015202924
DriveSetup System name Разметка диска DriveSetup System name Разметка диска
Cancel AbstractParametersPanel Отмена Cancel AbstractParametersPanel Отмена
Delete MainWindow Удалить Delete MainWindow Удалить
@@ -49,6 +49,7 @@ Failed to format the partition %s!\n MainWindow Не удалось иници
Mount MainWindow Подключить Mount MainWindow Подключить
Partition type PartitionList Тип раздела Partition type PartitionList Тип раздела
Are you sure you want to format a raw disk? (most people initialize the disk with a partitioning system first) You will be asked again before changes are written to the disk. MainWindow Вы уверены, что хотите инициализировать весь диск? (обычно на диске создают систему разделов)\nПовторный запрос будет выдан непосредственно перед записью изменений на диск. Are you sure you want to format a raw disk? (most people initialize the disk with a partitioning system first) You will be asked again before changes are written to the disk. MainWindow Вы уверены, что хотите инициализировать весь диск? (обычно на диске создают систему разделов)\nПовторный запрос будет выдан непосредственно перед записью изменений на диск.
Change parameters… MainWindow Изменить параметры…
Device PartitionList Устройство Device PartitionList Устройство
Disk MainWindow Диск Disk MainWindow Диск
Are you sure you want to initialize the selected disk? All data will be lost. You will be asked again before changes are written to the disk.\n MainWindow Вы уверены, что хотите инициализировать выбранный диск? Все данные на этом диске будут потеряны.\nПовторный запрос будет выдан непосредственно перед записью изменений на диск.\n Are you sure you want to initialize the selected disk? All data will be lost. You will be asked again before changes are written to the disk.\n MainWindow Вы уверены, что хотите инициализировать выбранный диск? Все данные на этом диске будут потеряны.\nПовторный запрос будет выдан непосредственно перед записью изменений на диск.\n
+11 -1
View File
@@ -1,21 +1,29 @@
1 russian x-vnd.Haiku-libbe 864109244 1 russian x-vnd.Haiku-libbe 672385853
gamma AboutWindow гамма
beta AboutWindow бета
%3.2f GiB StringForSize %3.2f ГБ %3.2f GiB StringForSize %3.2f ГБ
Written by: AboutWindow Разработан: Written by: AboutWindow Разработан:
About %app% AboutMenuItem О программе… About %app% AboutMenuItem О программе…
Cut TextView Вырезать Cut TextView Вырезать
Version AboutWindow Версия
Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Невозможно удалить репликант \"%description\".\n%error Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Невозможно удалить репликант \"%description\".\n%error
About AboutWindow О программе
Copy TextView Копировать Copy TextView Копировать
%3.2f KiB StringForSize %3.2f КБ %3.2f KiB StringForSize %3.2f КБ
%d bytes StringForSize %d байт %d bytes StringForSize %d байт
alpha AboutWindow альфа
Error PrintJob Ошибка Error PrintJob Ошибка
No Pages to print! PrintJob Нет страниц для печати No Pages to print! PrintJob Нет страниц для печати
All Rights Reserved. AboutWindow Все права защищены.
OK Dragger ОК OK Dragger ОК
OK PrintJob ОК OK PrintJob ОК
Green: ColorControl Зеленый: Green: ColorControl Зеленый:
Version history: AboutWindow История версий:
Remove replicant Dragger Удалить репликант Remove replicant Dragger Удалить репликант
OK ZombieReplicantView ОК OK ZombieReplicantView ОК
Print Server is not responding. PrintJob Сервер печати не отвечает. Print Server is not responding. PrintJob Сервер печати не отвечает.
Paste TextView Вставить Paste TextView Вставить
Special Thanks: AboutWindow Особые благодарности:
%.2f TiB StringForSize %.2f ТБ %.2f TiB StringForSize %.2f ТБ
Cannot locate the application for the replicant. No application signature supplied.\n%error ZombieReplicantView Не удалось найти приложение этого репликанта. Не указана сигнатура приложения.\n%error Cannot locate the application for the replicant. No application signature supplied.\n%error ZombieReplicantView Не удалось найти приложение этого репликанта. Не указана сигнатура приложения.\n%error
Redo TextView Повторить Redo TextView Повторить
@@ -26,6 +34,8 @@ Undo TextView Отменить
Red: ColorControl Красный: Red: ColorControl Красный:
%3.2f MiB StringForSize %3.2f МБ %3.2f MiB StringForSize %3.2f МБ
About %app… Dragger О программе… About %app… Dragger О программе…
development AboutWindow в разработке
Error ZombieReplicantView Ошибка Error ZombieReplicantView Ошибка
Blue: ColorControl Синий: Blue: ColorControl Синий:
gold master AboutWindow золотая
Can't delete this replicant from its original application. Life goes on. Dragger Не удалось удалить этот репликант из его изначальное приложения. Жизнь продолжается. Can't delete this replicant from its original application. Life goes on. Dragger Не удалось удалить этот репликант из его изначальное приложения. Жизнь продолжается.
+5
View File
@@ -48,6 +48,9 @@ public:
// Operators and misc // Operators and misc
status_t SetTo(const char *signature, team_id team = -1);
status_t SetTo(const BHandler *handler, const BLooper *looper = NULL);
BMessenger &operator=(const BMessenger &from); BMessenger &operator=(const BMessenger &from);
bool operator==(const BMessenger &other) const; bool operator==(const BMessenger &other) const;
@@ -63,6 +66,8 @@ private:
void _SetTo(team_id team, port_id port, int32 token); void _SetTo(team_id team, port_id port, int32 token);
void _InitData(const char *signature, team_id team, status_t *result); void _InitData(const char *signature, team_id team, status_t *result);
void _InitData(const BHandler *handler, const BLooper *looper,
status_t *result);
private: private:
port_id fPort; port_id fPort;
+65 -36
View File
@@ -52,6 +52,7 @@ ThreadHandler::ThreadHandler(Thread* thread, Worker* worker,
fStepMode(STEP_NONE), fStepMode(STEP_NONE),
fStepStatement(NULL), fStepStatement(NULL),
fBreakpointAddress(0), fBreakpointAddress(0),
fSteppedOverFunctionAddress(0),
fPreviousInstructionPointer(0), fPreviousInstructionPointer(0),
fPreviousFrameAddress(0), fPreviousFrameAddress(0),
fSingleStepping(false) fSingleStepping(false)
@@ -487,17 +488,8 @@ ThreadHandler::_DoStepOver(CpuState* cpuState)
if (_InstallTemporaryBreakpoint(info.Address() + info.Size()) != B_OK) if (_InstallTemporaryBreakpoint(info.Address() + info.Size()) != B_OK)
return false; return false;
ReturnValueInfo* returnInfo = new(std::nothrow) ReturnValueInfo( fSteppedOverFunctionAddress = info.TargetAddress();
info.TargetAddress(), cpuState);
if (returnInfo == NULL)
return false;
BReference<ReturnValueInfo> returnInfoReference(returnInfo, true);
if (fThread->AddReturnValueInfo(returnInfo) != B_OK)
return false;
returnInfoReference.Detach();
_RunThread(cpuState->InstructionPointer()); _RunThread(cpuState->InstructionPointer());
return true; return true;
} }
@@ -597,6 +589,26 @@ ThreadHandler::_HandleBreakpointHitStep(CpuState* cpuState)
} }
} }
if (fPreviousFrameAddress != 0 && fSteppedOverFunctionAddress
!= cpuState->InstructionPointer()) {
TRACE_CONTROL("STEP_OVER: called function address %#" B_PRIx64
", previous frame address: %#" B_PRIx64 ", frame address: %#"
B_PRIx64 ", adding return info\n", fSteppedOverFunctionAddress,
fPreviousFrameAddress, stackTrace->FrameAt(0)->FrameAddress());
ReturnValueInfo* returnInfo = new(std::nothrow) ReturnValueInfo(
fSteppedOverFunctionAddress, cpuState);
if (returnInfo == NULL)
return false;
BReference<ReturnValueInfo> returnInfoReference(returnInfo, true);
if (fThread->AddReturnValueInfo(returnInfo) != B_OK)
return false;
returnInfoReference.Detach();
fSteppedOverFunctionAddress = 0;
}
// If we're still in the statement, we continue single-stepping, // If we're still in the statement, we continue single-stepping,
// otherwise we're done. // otherwise we're done.
if (fStepStatement->ContainsAddress( if (fStepStatement->ContainsAddress(
@@ -618,6 +630,23 @@ ThreadHandler::_HandleBreakpointHitStep(CpuState* cpuState)
// That's the return address, so we're done in theory, // That's the return address, so we're done in theory,
// unless we're a recursive function. Check if we've actually // unless we're a recursive function. Check if we've actually
// exited the previous stack frame or not // exited the previous stack frame or not
if (!_HasExitedFrame(cpuState->StackFramePointer())) {
status_t error = _InstallTemporaryBreakpoint(
cpuState->InstructionPointer());
if (error != B_OK)
_StepFallback();
else
_RunThread(cpuState->InstructionPointer());
return true;
}
if (fPreviousFrameAddress == 0)
return false;
TRACE_CONTROL("ThreadHandler::_HandleBreakpointHitStep() - "
"frame pointer 0x%#" B_PRIx64 ", previous: 0x%#" B_PRIx64
" - step out adding return value\n", cpuState
->StackFramePointer(), fPreviousFrameAddress);
ReturnValueInfo* info = new(std::nothrow) ReturnValueInfo( ReturnValueInfo* info = new(std::nothrow) ReturnValueInfo(
cpuState->InstructionPointer(), cpuState); cpuState->InstructionPointer(), cpuState);
if (info == NULL) if (info == NULL)
@@ -627,21 +656,6 @@ ThreadHandler::_HandleBreakpointHitStep(CpuState* cpuState)
return false; return false;
infoReference.Detach(); infoReference.Detach();
target_addr_t framePointer = cpuState->StackFramePointer();
bool hasExitedFrame = fDebuggerInterface->GetArchitecture()
->StackGrowthDirection() == STACK_GROWTH_DIRECTION_POSITIVE
? framePointer < fPreviousFrameAddress
: framePointer > fPreviousFrameAddress;
if (!hasExitedFrame) {
status_t error = _InstallTemporaryBreakpoint(
cpuState->InstructionPointer());
if (error != B_OK)
_StepFallback();
else
_RunThread(cpuState->InstructionPointer());
return true;
}
fPreviousFrameAddress = 0; fPreviousFrameAddress = 0;
} }
@@ -709,19 +723,24 @@ ThreadHandler::_HandleSingleStepStep(CpuState* cpuState)
} }
} }
if (stackTrace != NULL && stackTrace->FrameAt(0)
->FrameAddress() != fPreviousFrameAddress) {
ReturnValueInfo* info = new(std::nothrow) ReturnValueInfo(
cpuState->InstructionPointer(), cpuState);
if (info == NULL)
return false;
BReference<ReturnValueInfo> infoReference(info, true);
if (fThread->AddReturnValueInfo(info) != B_OK)
return false;
infoReference.Detach(); if (stackTrace != NULL) {
if (_HasExitedFrame(stackTrace->FrameAt(0)
->FrameAddress())) {
TRACE_CONTROL("ThreadHandler::_HandleSingleStepStep() "
" - adding return value for STEP_OVER\n");
ReturnValueInfo* info = new(std::nothrow)
ReturnValueInfo(cpuState->InstructionPointer(),
cpuState);
if (info == NULL)
return false;
BReference<ReturnValueInfo> infoReference(info, true);
if (fThread->AddReturnValueInfo(info) != B_OK)
return false;
infoReference.Detach();
}
} }
return false; return false;
} }
return _DoStepOver(cpuState); return _DoStepOver(cpuState);
@@ -733,3 +752,13 @@ ThreadHandler::_HandleSingleStepStep(CpuState* cpuState)
return false; return false;
} }
} }
bool
ThreadHandler::_HasExitedFrame(target_addr_t framePointer) const
{
return fDebuggerInterface->GetArchitecture()->StackGrowthDirection()
== STACK_GROWTH_DIRECTION_POSITIVE
? framePointer < fPreviousFrameAddress
: framePointer > fPreviousFrameAddress;
}
@@ -91,6 +91,9 @@ private:
bool _HandleBreakpointHitStep(CpuState* cpuState); bool _HandleBreakpointHitStep(CpuState* cpuState);
bool _HandleSingleStepStep(CpuState* cpuState); bool _HandleSingleStepStep(CpuState* cpuState);
bool _HasExitedFrame(target_addr_t framePointer)
const;
private: private:
Thread* fThread; Thread* fThread;
Worker* fWorker; Worker* fWorker;
@@ -99,6 +102,7 @@ private:
uint32 fStepMode; uint32 fStepMode;
Statement* fStepStatement; Statement* fStepStatement;
target_addr_t fBreakpointAddress; target_addr_t fBreakpointAddress;
target_addr_t fSteppedOverFunctionAddress;
target_addr_t fPreviousInstructionPointer; target_addr_t fPreviousInstructionPointer;
target_addr_t fPreviousFrameAddress; target_addr_t fPreviousFrameAddress;
bool fSingleStepping; bool fSingleStepping;
@@ -673,7 +673,7 @@ DwarfImageDebugInfo::CreateFrame(Image* image,
instructionPointer, functionInstance->Address() - fRelocationDelta, instructionPointer, functionInstance->Address() - fRelocationDelta,
subprogramEntry->Variables(), subprogramEntry->Blocks()); subprogramEntry->Variables(), subprogramEntry->Blocks());
if (!returnValueInfos->IsEmpty()) { if (returnValueInfos != NULL && !returnValueInfos->IsEmpty()) {
_CreateReturnValues(returnValueInfos, image, frame, _CreateReturnValues(returnValueInfos, image, frame,
*stackFrameDebugInfo); *stackFrameDebugInfo);
} }
@@ -1166,7 +1166,7 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos,
BReference<FunctionID> idReference( BReference<FunctionID> idReference(
targetFunction->GetFunctionID(), true); targetFunction->GetFunctionID(), true);
result = factory.CreateReturnValue(idReference, returnType, result = factory.CreateReturnValue(idReference, returnType,
location, variable); location, subroutineState, variable);
if (result != B_OK) if (result != B_OK)
return result; return result;
@@ -11,6 +11,7 @@
#include "Architecture.h" #include "Architecture.h"
#include "CompilationUnit.h" #include "CompilationUnit.h"
#include "CpuState.h"
#include "DebugInfoEntries.h" #include "DebugInfoEntries.h"
#include "Dwarf.h" #include "Dwarf.h"
#include "DwarfFile.h" #include "DwarfFile.h"
@@ -279,7 +280,8 @@ DwarfStackFrameDebugInfo::CreateLocalVariable(FunctionID* functionID,
status_t status_t
DwarfStackFrameDebugInfo::CreateReturnValue(FunctionID* functionID, DwarfStackFrameDebugInfo::CreateReturnValue(FunctionID* functionID,
DIEType* returnType, ValueLocation* location, Variable*& _variable) DIEType* returnType, ValueLocation* location, CpuState* state,
Variable*& _variable)
{ {
if (returnType == NULL) if (returnType == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
@@ -300,7 +302,7 @@ DwarfStackFrameDebugInfo::CreateReturnValue(FunctionID* functionID,
name.SetToFormat("%s returned", functionID->FunctionName().String()); name.SetToFormat("%s returned", functionID->FunctionName().String());
Variable* variable = new(std::nothrow) Variable(id, name, Variable* variable = new(std::nothrow) Variable(id, name,
type, location); type, location, state);
if (variable == NULL) if (variable == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -14,6 +14,7 @@
class CompilationUnit; class CompilationUnit;
class CpuState;
class DIEFormalParameter; class DIEFormalParameter;
class DIESubprogram; class DIESubprogram;
class DIEType; class DIEType;
@@ -60,6 +61,7 @@ public:
status_t CreateReturnValue(FunctionID* functionID, status_t CreateReturnValue(FunctionID* functionID,
DIEType* returnType, DIEType* returnType,
ValueLocation* location, ValueLocation* location,
CpuState* state,
Variable*& _variable); Variable*& _variable);
// returns reference // returns reference
+11 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012, Rene Gollent, rene@gollent.com. * Copyright 2012-2013, Rene Gollent, rene@gollent.com.
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -18,6 +18,8 @@
#include "ValueLocation.h" #include "ValueLocation.h"
#include "ValueNode.h" #include "ValueNode.h"
#include "ValueNodeContainer.h" #include "ValueNodeContainer.h"
#include "Variable.h"
#include "VariableValueNodeChild.h"
ResolveValueNodeValueJob::ResolveValueNodeValueJob( ResolveValueNodeValueJob::ResolveValueNodeValueJob(
@@ -144,9 +146,16 @@ ResolveValueNodeValueJob::_ResolveNodeValue()
} }
} }
CpuState* variableCpuState = NULL;
VariableValueNodeChild* variableChild = dynamic_cast<
VariableValueNodeChild*>(nodeChild);
if (variableChild != NULL)
variableCpuState = variableChild->GetVariable()->GetCpuState();
// resolve the node location and value // resolve the node location and value
ValueLoader valueLoader(fArchitecture, fDebuggerInterface, ValueLoader valueLoader(fArchitecture, fDebuggerInterface,
fTypeInformation, fCpuState); fTypeInformation, variableCpuState != NULL ? variableCpuState
: fCpuState);
ValueLocation* location; ValueLocation* location;
Value* value; Value* value;
status_t error = fValueNode->ResolvedLocationAndValue(&valueLoader, status_t error = fValueNode->ResolvedLocationAndValue(&valueLoader,
@@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include "ReturnValueInfo.h" #include "ReturnValueInfo.h"
#include "CpuState.h" #include "CpuState.h"
@@ -5,6 +5,7 @@
#ifndef RETURN_VALUE_INFO_H #ifndef RETURN_VALUE_INFO_H
#define RETURN_VALUE_INFO_H #define RETURN_VALUE_INFO_H
#include "ObjectList.h" #include "ObjectList.h"
#include "Referenceable.h" #include "Referenceable.h"
#include "Types.h" #include "Types.h"
+8 -2
View File
@@ -6,22 +6,26 @@
#include "Variable.h" #include "Variable.h"
#include "CpuState.h"
#include "ObjectID.h" #include "ObjectID.h"
#include "Type.h" #include "Type.h"
#include "ValueLocation.h" #include "ValueLocation.h"
Variable::Variable(ObjectID* id, const BString& name, Type* type, Variable::Variable(ObjectID* id, const BString& name, Type* type,
ValueLocation* location) ValueLocation* location, CpuState* state)
: :
fID(id), fID(id),
fName(name), fName(name),
fType(type), fType(type),
fLocation(location) fLocation(location),
fCpuState(state)
{ {
fID->AcquireReference(); fID->AcquireReference();
fType->AcquireReference(); fType->AcquireReference();
fLocation->AcquireReference(); fLocation->AcquireReference();
if (fCpuState != NULL)
fCpuState->AcquireReference();
} }
@@ -30,4 +34,6 @@ Variable::~Variable()
fID->ReleaseReference(); fID->ReleaseReference();
fType->ReleaseReference(); fType->ReleaseReference();
fLocation->ReleaseReference(); fLocation->ReleaseReference();
if (fCpuState != NULL)
fCpuState->ReleaseReference();
} }
+5 -1
View File
@@ -11,6 +11,7 @@
#include <Referenceable.h> #include <Referenceable.h>
class CpuState;
class ObjectID; class ObjectID;
class Type; class Type;
class ValueLocation; class ValueLocation;
@@ -19,19 +20,22 @@ class ValueLocation;
class Variable : public BReferenceable { class Variable : public BReferenceable {
public: public:
Variable(ObjectID* id, const BString& name, Variable(ObjectID* id, const BString& name,
Type* type, ValueLocation* location); Type* type, ValueLocation* location,
CpuState* state = NULL);
~Variable(); ~Variable();
ObjectID* ID() const { return fID; } ObjectID* ID() const { return fID; }
const BString& Name() const { return fName; } const BString& Name() const { return fName; }
Type* GetType() const { return fType; } Type* GetType() const { return fType; }
ValueLocation* Location() const { return fLocation; } ValueLocation* Location() const { return fLocation; }
CpuState* GetCpuState() const { return fCpuState; }
private: private:
ObjectID* fID; ObjectID* fID;
BString fName; BString fName;
Type* fType; Type* fType;
ValueLocation* fLocation; ValueLocation* fLocation;
CpuState* fCpuState;
}; };
+40 -20
View File
@@ -719,6 +719,12 @@ TBarApp::Unsubscribe(const BMessenger &subscriber)
void void
TBarApp::AddTeam(team_id team, uint32 flags, const char* sig, entry_ref* ref) TBarApp::AddTeam(team_id team, uint32 flags, const char* sig, entry_ref* ref)
{ {
if ((flags & B_BACKGROUND_APP) != 0
|| strcasecmp(sig, kDeskbarSignature) == 0) {
// it's a background app or Deskbar itself, don't add it
return;
}
BAutolock autolock(sSubscriberLock); BAutolock autolock(sSubscriberLock);
if (!autolock.IsLocked()) if (!autolock.IsLocked())
return; return;
@@ -761,15 +767,9 @@ TBarApp::AddTeam(team_id team, uint32 flags, const char* sig, entry_ref* ref)
} }
BarTeamInfo* barInfo = new BarTeamInfo(new BList(), flags, strdup(sig), BarTeamInfo* barInfo = new BarTeamInfo(new BList(), flags, strdup(sig),
new BBitmap(IconRect(), kIconColorSpace), strdup(name.String())); NULL, strdup(name.String()));
FetchAppIcon(barInfo);
if ((barInfo->flags & B_BACKGROUND_APP) == 0
&& strcasecmp(barInfo->sig, kDeskbarSignature) != 0) {
FetchAppIcon(barInfo->sig, barInfo->icon);
}
barInfo->teams->AddItem((void*)(addr_t)team); barInfo->teams->AddItem((void*)(addr_t)team);
sBarTeamInfoList.AddItem(barInfo); sBarTeamInfoList.AddItem(barInfo);
if (fSettings.expandNewTeams) if (fSettings.expandNewTeams)
@@ -839,9 +839,7 @@ TBarApp::ResizeTeamIcons()
BarTeamInfo* barInfo = (BarTeamInfo*)sBarTeamInfoList.ItemAt(i); BarTeamInfo* barInfo = (BarTeamInfo*)sBarTeamInfoList.ItemAt(i);
if ((barInfo->flags & B_BACKGROUND_APP) == 0 if ((barInfo->flags & B_BACKGROUND_APP) == 0
&& strcasecmp(barInfo->sig, kDeskbarSignature) != 0) { && strcasecmp(barInfo->sig, kDeskbarSignature) != 0) {
delete barInfo->icon; FetchAppIcon(barInfo);
barInfo->icon = new BBitmap(IconRect(), kIconColorSpace);
FetchAppIcon(barInfo->sig, barInfo->icon);
} }
} }
} }
@@ -886,26 +884,40 @@ TBarApp::QuitPreferencesWindow()
void void
TBarApp::FetchAppIcon(const char* signature, BBitmap* icon) TBarApp::FetchAppIcon(BarTeamInfo* barInfo)
{ {
app_info appInfo; int32 width = IconSize();
icon_size size = icon->Bounds().IntegerHeight() >= 31 int32 index = (width - kMinimumIconSize) / kIconSizeInterval;
? B_LARGE_ICON : B_MINI_ICON;
if (be_roster->GetAppInfo(signature, &appInfo) == B_OK) { // first look in the icon cache
barInfo->icon = barInfo->iconCache[index];
if (barInfo->icon != NULL)
return;
// icon wasn't in cache, get it from be_roster and cache it
app_info appInfo;
icon_size size = width >= 31 ? B_LARGE_ICON : B_MINI_ICON;
BBitmap* icon = new BBitmap(IconRect(), kIconColorSpace);
if (be_roster->GetAppInfo(barInfo->sig, &appInfo) == B_OK) {
// fetch the app icon // fetch the app icon
BFile file(&appInfo.ref, B_READ_ONLY); BFile file(&appInfo.ref, B_READ_ONLY);
BAppFileInfo appMime(&file); BAppFileInfo appMime(&file);
if (appMime.GetIcon(icon, size) == B_OK) if (appMime.GetIcon(icon, size) == B_OK) {
delete barInfo->iconCache[index];
barInfo->iconCache[index] = barInfo->icon = icon;
return; return;
}
} }
// couldn't find the app icon // couldn't find the app icon
// fetch the generic 3 boxes icon // fetch the generic 3 boxes icon and cache it
BMimeType defaultAppMime; BMimeType defaultAppMime;
defaultAppMime.SetTo(B_APP_MIME_TYPE); defaultAppMime.SetTo(B_APP_MIME_TYPE);
if (defaultAppMime.GetIcon(icon, size) == B_OK) if (defaultAppMime.GetIcon(icon, size) == B_OK) {
delete barInfo->iconCache[index];
barInfo->iconCache[index] = barInfo->icon = icon;
return; return;
}
// couldn't find generic 3 boxes icon // couldn't find generic 3 boxes icon
// fill with transparent // fill with transparent
@@ -923,6 +935,9 @@ TBarApp::FetchAppIcon(const char* signature, BBitmap* icon)
for (int32 i = 0; i < icon->BitsLength(); i++) for (int32 i = 0; i < icon->BitsLength(); i++)
iconBits[i] = B_TRANSPARENT_MAGIC_CMAP8; iconBits[i] = B_TRANSPARENT_MAGIC_CMAP8;
} }
delete barInfo->iconCache[index];
barInfo->iconCache[index] = NULL;
} }
@@ -945,6 +960,8 @@ BarTeamInfo::BarTeamInfo(BList* teams, uint32 flags, char* sig, BBitmap* icon,
icon(icon), icon(icon),
name(name) name(name)
{ {
for (int32 i = 0; i < kIconCacheCount; i++)
iconCache[i] = NULL;
} }
@@ -955,6 +972,8 @@ BarTeamInfo::BarTeamInfo(const BarTeamInfo &info)
icon(new BBitmap(*info.icon)), icon(new BBitmap(*info.icon)),
name(strdup(info.name)) name(strdup(info.name))
{ {
for (int32 i = 0; i < kIconCacheCount; i++)
iconCache[i] = NULL;
} }
@@ -962,6 +981,7 @@ BarTeamInfo::~BarTeamInfo()
{ {
delete teams; delete teams;
free(sig); free(sig);
delete icon;
free(name); free(name);
for (int32 i = 0; i < kIconCacheCount; i++)
delete iconCache[i];
} }
+5 -3
View File
@@ -71,15 +71,17 @@ const uint32 kSuspendSystem = 304;
const int32 kMinimumIconSize = 16; const int32 kMinimumIconSize = 16;
const int32 kMaximumIconSize = 96; const int32 kMaximumIconSize = 96;
const int32 kIconSizeInterval = 8; const int32 kIconSizeInterval = 8;
const int32 kIconCacheCount = (kMaximumIconSize - kMinimumIconSize)
/ kIconSizeInterval + 1;
// update preferences message constant // update preferences message constant
const uint32 kUpdatePreferences = 'Pref'; const uint32 kUpdatePreferences = 'Pref';
/* --------------------------------------------- */ /* --------------------------------------------- */
class BBitmap;
class BFile; class BFile;
class BList; class BList;
class BBitmap;
class PreferencesWindow; class PreferencesWindow;
class TBarView; class TBarView;
class TBarWindow; class TBarWindow;
@@ -96,6 +98,7 @@ public:
char* sig; char* sig;
BBitmap* icon; BBitmap* icon;
char* name; char* name;
BBitmap* iconCache[kIconCacheCount];
}; };
class TBarApp : public BApplication { class TBarApp : public BApplication {
@@ -133,8 +136,7 @@ private:
void QuitPreferencesWindow(); void QuitPreferencesWindow();
void ResizeTeamIcons(); void ResizeTeamIcons();
void FetchAppIcon(const char* signature, void FetchAppIcon(BarTeamInfo* barInfo);
BBitmap* icon);
BRect IconRect(); BRect IconRect();
-7
View File
@@ -520,14 +520,7 @@ TExpandoMenuBar::BuildItems()
barInfo->name, barInfo->sig, itemWidth, itemHeight, barInfo->name, barInfo->sig, itemWidth, itemHeight,
fDrawLabel, fVertical)); fDrawLabel, fVertical));
} }
barInfo->teams = NULL;
barInfo->icon = NULL;
barInfo->name = NULL;
barInfo->sig = NULL;
} }
delete barInfo;
} }
if (CountItems() == 0) { if (CountItems() == 0) {
-6
View File
@@ -108,13 +108,7 @@ TTeamMenu::AttachedToWindow()
menu->SetTrackingHook(barview->MenuTrackingHook, menu->SetTrackingHook(barview->MenuTrackingHook,
barview->GetTrackingHookData()); barview->GetTrackingHookData());
} }
barInfo->teams = NULL;
barInfo->icon = NULL;
barInfo->name = NULL;
barInfo->sig = NULL;
} }
delete barInfo;
} }
if (CountItems() == 0) { if (CountItems() == 0) {
+14 -25
View File
@@ -104,7 +104,6 @@ AppearancePrefView::AppearancePrefView(const char* name,
kColorTable[0]); kColorTable[0]);
fColorField = new BMenuField(B_TRANSLATE("Color:"), colorsPopUp); fColorField = new BMenuField(B_TRANSLATE("Color:"), colorsPopUp);
fColorField->SetEnabled(false);
fTabTitle = new BTextControl("tabTitle", B_TRANSLATE("Tab title:"), "", fTabTitle = new BTextControl("tabTitle", B_TRANSLATE("Tab title:"), "",
NULL); NULL);
@@ -151,7 +150,6 @@ AppearancePrefView::AppearancePrefView(const char* name,
fTabTitle->SetText(PrefHandler::Default()->getString(PREF_TAB_TITLE)); fTabTitle->SetText(PrefHandler::Default()->getString(PREF_TAB_TITLE));
fWindowTitle->SetText(PrefHandler::Default()->getString(PREF_WINDOW_TITLE)); fWindowTitle->SetText(PrefHandler::Default()->getString(PREF_WINDOW_TITLE));
fColorControl->SetEnabled(false);
fColorControl->SetValue( fColorControl->SetValue(
PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR)); PrefHandler::Default()->getRGB(PREF_TEXT_FORE_COLOR));
@@ -219,16 +217,11 @@ AppearancePrefView::AttachedToWindow()
fontSizeMenu->SetTargetForItems(this); fontSizeMenu->SetTargetForItems(this);
} }
fColorControl->SetTarget(this); fColorControl->SetTarget(this);
fColorField->Menu()->SetTargetForItems(this); fColorField->Menu()->SetTargetForItems(this);
fColorSchemeField->Menu()->SetTargetForItems(this); fColorSchemeField->Menu()->SetTargetForItems(this);
_SetCurrentColorScheme(fColorSchemeField); _SetCurrentColorScheme();
bool enableCustomColors =
strcmp(fColorSchemeField->Menu()->FindMarked()->Label(),
gCustomColorScheme.name) == 0;
_EnableCustomColors(enableCustomColors);
} }
@@ -279,6 +272,15 @@ AppearancePrefView::MessageReceived(BMessage* msg)
break; break;
rgb_color oldColor = PrefHandler::Default()->getRGB(label); rgb_color oldColor = PrefHandler::Default()->getRGB(label);
if (oldColor != fColorControl->ValueAsColor()) { if (oldColor != fColorControl->ValueAsColor()) {
BMenuItem* item = fColorSchemeField->Menu()->FindMarked();
if (strcmp(item->Label(), gCustomColorScheme.name) != 0) {
item->SetMarked(false);
item = fColorSchemeField->Menu()->FindItem(
gCustomColorScheme.name);
if (item)
item->SetMarked(true);
}
PrefHandler::Default()->setRGB(label, PrefHandler::Default()->setRGB(label,
fColorControl->ValueAsColor()); fColorControl->ValueAsColor());
modified = true; modified = true;
@@ -291,11 +293,6 @@ AppearancePrefView::MessageReceived(BMessage* msg)
color_scheme* newScheme = NULL; color_scheme* newScheme = NULL;
if (msg->FindPointer("color_scheme", if (msg->FindPointer("color_scheme",
(void**)&newScheme) == B_OK) { (void**)&newScheme) == B_OK) {
if (newScheme == &gCustomColorScheme)
_EnableCustomColors(true);
else
_EnableCustomColors(false);
_ChangeColorScheme(newScheme); _ChangeColorScheme(newScheme);
modified = true; modified = true;
} }
@@ -365,14 +362,6 @@ AppearancePrefView::MessageReceived(BMessage* msg)
} }
void
AppearancePrefView::_EnableCustomColors(bool enable)
{
fColorField->SetEnabled(enable);
fColorControl->SetEnabled(enable);
}
void void
AppearancePrefView::_ChangeColorScheme(color_scheme* scheme) AppearancePrefView::_ChangeColorScheme(color_scheme* scheme)
{ {
@@ -388,7 +377,7 @@ AppearancePrefView::_ChangeColorScheme(color_scheme* scheme)
void void
AppearancePrefView::_SetCurrentColorScheme(BMenuField* field) AppearancePrefView::_SetCurrentColorScheme()
{ {
PrefHandler* pref = PrefHandler::Default(); PrefHandler* pref = PrefHandler::Default();
+1 -3
View File
@@ -54,10 +54,8 @@ public:
float* _height); float* _height);
private: private:
void _EnableCustomColors(bool enable);
void _ChangeColorScheme(color_scheme* scheme); void _ChangeColorScheme(color_scheme* scheme);
void _SetCurrentColorScheme(BMenuField* field); void _SetCurrentColorScheme();
static BMenu* _MakeFontMenu(uint32 command, static BMenu* _MakeFontMenu(uint32 command,
const char* defaultFamily, const char* defaultFamily,
+1
View File
@@ -286,6 +286,7 @@ BasicTerminalBuffer::InsertChar(const char* c)
return InsertChar(UTF8Char(c), 1); return InsertChar(UTF8Char(c), 1);
} }
void void
BasicTerminalBuffer::InsertChar(const char* c, int32 length) BasicTerminalBuffer::InsertChar(const char* c, int32 length)
{ {
+3 -1
View File
@@ -412,6 +412,8 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
} else } else
fShellInfo.SetDefaultShell(false); fShellInfo.SetDefaultShell(false);
fShellInfo.SetEncoding(parameters.Encoding());
signal(SIGTTOU, SIG_IGN); signal(SIGTTOU, SIG_IGN);
// get a pseudo-tty // get a pseudo-tty
@@ -548,7 +550,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
*/ */
setenv("TERM", kTerminalType, true); setenv("TERM", kTerminalType, true);
setenv("TTY", ttyName, true); setenv("TTY", ttyName, true);
setenv("TTYPE", parameters.Encoding(), true); setenv("TTYPE", fShellInfo.EncodingName(), true);
// set the current working directory, if one is given // set the current working directory, if one is given
if (parameters.CurrentDirectory().Length() > 0) if (parameters.CurrentDirectory().Length() > 0)
+5
View File
@@ -49,6 +49,11 @@ public:
const ShellInfo& Info() const const ShellInfo& Info() const
{ return fShellInfo; } { return fShellInfo; }
int Encoding() const
{ return fShellInfo.Encoding(); }
void SetEncoding(int encoding)
{ fShellInfo.SetEncoding(encoding); }
bool HasActiveProcesses() const; bool HasActiveProcesses() const;
bool GetActiveProcessInfo( bool GetActiveProcessInfo(
ActiveProcessInfo& _info) const; ActiveProcessInfo& _info) const;
+21 -1
View File
@@ -6,10 +6,30 @@
#include "ShellInfo.h" #include "ShellInfo.h"
#include <CharacterSet.h>
#include <CharacterSetRoster.h>
#include "TermConst.h"
using namespace BPrivate ; // BCharacterSet stuff
ShellInfo::ShellInfo() ShellInfo::ShellInfo()
: :
fProcessID(-1), fProcessID(-1),
fIsDefaultShell(true) fIsDefaultShell(true),
fEncoding(M_UTF8),
fEncodingName("UTF-8")
{ {
} }
void
ShellInfo::SetEncoding(int encoding)
{
fEncoding = encoding;
const BCharacterSet* charset
= BCharacterSetRoster::GetCharacterSetByConversionID(fEncoding);
fEncodingName = charset ? charset->GetName() : "UTF-8";
}
+9
View File
@@ -7,6 +7,7 @@
#include <OS.h> #include <OS.h>
#include <String.h>
class ShellInfo { class ShellInfo {
@@ -23,9 +24,17 @@ public:
void SetDefaultShell(bool isDefault) void SetDefaultShell(bool isDefault)
{ fIsDefaultShell = isDefault; } { fIsDefaultShell = isDefault; }
int Encoding() const
{ return fEncoding; }
const BString& EncodingName() const
{ return fEncodingName; }
void SetEncoding(int encoding);
private: private:
pid_t fProcessID; pid_t fProcessID;
bool fIsDefaultShell; bool fIsDefaultShell;
int fEncoding;
BString fEncodingName;
}; };
+4 -2
View File
@@ -6,6 +6,8 @@
#include "ShellParameters.h" #include "ShellParameters.h"
#include "TermConst.h"
ShellParameters::ShellParameters(int argc, const char* const* argv, ShellParameters::ShellParameters(int argc, const char* const* argv,
const BString& currentDirectory) const BString& currentDirectory)
@@ -13,7 +15,7 @@ ShellParameters::ShellParameters(int argc, const char* const* argv,
fArguments(argv), fArguments(argv),
fArgumentCount(argc), fArgumentCount(argc),
fCurrentDirectory(currentDirectory), fCurrentDirectory(currentDirectory),
fEncoding("UTF8") fEncoding(M_UTF8)
{ {
} }
@@ -34,7 +36,7 @@ ShellParameters::SetCurrentDirectory(const BString& currentDirectory)
void void
ShellParameters::SetEncoding(const BString& encoding) ShellParameters::SetEncoding(int encoding)
{ {
fEncoding = encoding; fEncoding = encoding;
} }
+3 -3
View File
@@ -27,15 +27,15 @@ public:
const BString& CurrentDirectory() const const BString& CurrentDirectory() const
{ return fCurrentDirectory; } { return fCurrentDirectory; }
void SetEncoding(const BString& encoding); void SetEncoding(int encoding);
const BString& Encoding() const int Encoding() const
{ return fEncoding; } { return fEncoding; }
private: private:
const char* const* fArguments; const char* const* fArguments;
int fArgumentCount; int fArgumentCount;
BString fCurrentDirectory; BString fCurrentDirectory;
BString fEncoding; int fEncoding;
}; };
+1
View File
@@ -26,6 +26,7 @@ const char* const kTooTipSetWindowTitlePlaceholders = B_TRANSLATE(
"\t\t\tcurrent tab. Optionally the maximum number of path components\n" "\t\t\tcurrent tab. Optionally the maximum number of path components\n"
"\t\t\tcan be specified. E.g. '%2d' for at most two components.\n" "\t\t\tcan be specified. E.g. '%2d' for at most two components.\n"
"\t%T\t-\tThe Terminal application name for the current locale.\n" "\t%T\t-\tThe Terminal application name for the current locale.\n"
"\t%e\t-\tThe encoding of the current tab. Not shown for UTF-8.\n"
"\t%i\t-\tThe index of the window.\n" "\t%i\t-\tThe index of the window.\n"
"\t%p\t-\tThe name of the active process in the current tab.\n" "\t%p\t-\tThe name of the active process in the current tab.\n"
"\t%t\t-\tThe title of the current tab.\n" "\t%t\t-\tThe title of the current tab.\n"
+4 -4
View File
@@ -383,11 +383,11 @@ TermParse::EscParse()
int row; int row;
int column; int column;
/* default encoding system is UTF8 */ // default encoding system is UTF8
int *groundtable = gUTF8GroundTable; int *groundtable = gUTF8GroundTable;
int *parsestate = gUTF8GroundTable; int *parsestate = gUTF8GroundTable;
/* handle alternative character sets G0 - G4 */ // handle alternative character sets G0 - G4
const char** graphSets[4] = { NULL, NULL, NULL, NULL }; const char** graphSets[4] = { NULL, NULL, NULL, NULL };
int curGL = 0; int curGL = 0;
int curGR = 0; int curGR = 0;
@@ -422,12 +422,12 @@ TermParse::EscParse()
if (curGraphSet != NULL) { if (curGraphSet != NULL) {
int offset = c - (c < 128 ? 0x20 : 0xA0); int offset = c - (c < 128 ? 0x20 : 0xA0);
if (offset >= 0 && offset < 96 if (offset >= 0 && offset < 96
&& (curGraphSet[offset] != 0)) { && curGraphSet[offset] != 0) {
fBuffer->InsertChar(curGraphSet[offset]); fBuffer->InsertChar(curGraphSet[offset]);
break; break;
} }
} }
fBuffer->InsertChar((char)(c)); fBuffer->InsertChar((char)c);
break; break;
} }
case CASE_PRINT_GR: case CASE_PRINT_GR:
+4 -8
View File
@@ -30,8 +30,6 @@
#include <Application.h> #include <Application.h>
#include <Beep.h> #include <Beep.h>
#include <Catalog.h> #include <Catalog.h>
#include <CharacterSet.h>
#include <CharacterSetRoster.h>
#include <Clipboard.h> #include <Clipboard.h>
#include <Debug.h> #include <Debug.h>
#include <Directory.h> #include <Directory.h>
@@ -67,8 +65,6 @@
#include "VTkeymap.h" #include "VTkeymap.h"
using namespace BPrivate ; // BCharacterSet stuff
// defined in VTKeyTbl.c // defined in VTKeyTbl.c
extern int function_keycode_table[]; extern int function_keycode_table[];
extern char *function_key_char_table[]; extern char *function_key_char_table[];
@@ -364,10 +360,7 @@ TermView::_InitObject(const ShellParameters& shellParameters)
// set the shell parameters' encoding // set the shell parameters' encoding
ShellParameters modifiedShellParameters(shellParameters); ShellParameters modifiedShellParameters(shellParameters);
modifiedShellParameters.SetEncoding(fEncoding);
const BCharacterSet* charset
= BCharacterSetRoster::GetCharacterSetByConversionID(fEncoding);
modifiedShellParameters.SetEncoding(charset ? charset->GetName() : "UTF-8");
error = fShell->Open(fRows, fColumns, modifiedShellParameters); error = fShell->Open(fRows, fColumns, modifiedShellParameters);
@@ -700,6 +693,9 @@ TermView::SetEncoding(int encoding)
{ {
fEncoding = encoding; fEncoding = encoding;
if (fShell != NULL)
fShell->SetEncoding(fEncoding);
BAutolock _(fTextBuffer); BAutolock _(fTextBuffer);
fTextBuffer->SetEncoding(fEncoding); fTextBuffer->SetEncoding(fEncoding);
} }
+1 -1
View File
@@ -60,7 +60,7 @@ public:
bool IsShellBusy() const; bool IsShellBusy() const;
bool GetActiveProcessInfo( bool GetActiveProcessInfo(
ActiveProcessInfo& _info) const; ActiveProcessInfo& _info) const;
bool GetShellInfo(ShellInfo& _info) const; bool GetShellInfo(ShellInfo& _info) const;
const char* TerminalName() const; const char* TerminalName() const;
+12 -3
View File
@@ -4,9 +4,11 @@
*/ */
#include "TitlePlaceholderMapper.h"
#include <Catalog.h> #include <Catalog.h>
#include "TitlePlaceholderMapper.h" #include "TermConst.h"
// #pragma mark - TitlePlaceholderMapper // #pragma mark - TitlePlaceholderMapper
@@ -36,8 +38,8 @@ TitlePlaceholderMapper::MapPlaceholder(char placeholder, int64 number,
if (numberGiven && number > 0) { if (numberGiven && number > 0) {
int32 index = directory.Length(); int32 index = directory.Length();
while (number > 0 && index > 0) { while (number > 0 && index > 0) {
index = directory.FindLast('/', index - 1); index = directory.FindLast('/', index - 1);
number--; number--;
} }
if (number == 0 && index >= 0 && index + 1 < directory.Length()) if (number == 0 && index >= 0 && index + 1 < directory.Length())
@@ -48,6 +50,13 @@ TitlePlaceholderMapper::MapPlaceholder(char placeholder, int64 number,
return true; return true;
} }
case 'e':
if (fShellInfo.Encoding() != M_UTF8) {
_string.Truncate(0);
_string << "[" << fShellInfo.EncodingName() << "]";
}
return true;
case 'p': case 'p':
// process name -- use "--", if the shell is active and it is the // process name -- use "--", if the shell is active and it is the
// default shell // default shell
+1
View File
@@ -9,6 +9,7 @@
* Siarzhuk Zharski, zharik@gmx.li * Siarzhuk Zharski, zharik@gmx.li
*/ */
#include <SupportDefs.h> #include <SupportDefs.h>
#include "VTparse.h" #include "VTparse.h"
+12 -2
View File
@@ -9,6 +9,7 @@
#include <KeyStoreDefs.h> #include <KeyStoreDefs.h>
#include <Messenger.h> #include <Messenger.h>
#include <Roster.h>
using namespace BPrivate; using namespace BPrivate;
@@ -416,8 +417,17 @@ BKeyStore::_SendKeyMessage(BMessage& message, BMessage* reply) const
reply = &localReply; reply = &localReply;
BMessenger messenger(kKeyStoreServerSignature); BMessenger messenger(kKeyStoreServerSignature);
if (!messenger.IsValid()) if (!messenger.IsValid()) {
return B_ERROR; // Try to start the keystore server.
status_t result = be_roster->Launch(kKeyStoreServerSignature);
if (result != B_OK && result != B_ALREADY_RUNNING)
return B_ERROR;
// Then re-target the messenger and check again.
messenger.SetTo(kKeyStoreServerSignature);
if (!messenger.IsValid())
return B_ERROR;
}
if (messenger.SendMessage(&message, reply) != B_OK) if (messenger.SendMessage(&message, reply) != B_OK)
return B_ERROR; return B_ERROR;
+93 -27
View File
@@ -98,33 +98,7 @@ BMessenger::BMessenger(const BHandler* handler, const BLooper* looper,
fHandlerToken(B_NULL_TOKEN), fHandlerToken(B_NULL_TOKEN),
fTeam(-1) fTeam(-1)
{ {
status_t error = (handler || looper ? B_OK : B_BAD_VALUE); _InitData(handler, looper, _result);
if (error == B_OK) {
if (handler) {
// BHandler is given, check/retrieve the looper.
if (looper) {
if (handler->Looper() != looper)
error = B_MISMATCHED_VALUES;
} else {
looper = handler->Looper();
if (looper == NULL)
error = B_MISMATCHED_VALUES;
}
}
// set port, token,...
if (error == B_OK) {
AutoLocker<BLooperList> locker(gLooperList);
if (locker.IsLocked() && gLooperList.IsLooperValid(looper)) {
fPort = looper->fMsgPort;
fHandlerToken = (handler
? _get_object_token_(handler) : B_PREFERRED_TOKEN);
fTeam = looper->Team();
} else
error = B_BAD_VALUE;
}
}
if (_result)
*_result = error;
} }
@@ -427,6 +401,50 @@ BMessenger::SendMessage(BMessage *message, BMessage *reply,
// #pragma mark - Operators and misc // #pragma mark - Operators and misc
/*! \brief Reinitializes a BMessenger to target the already running application
identified by the supplied signature and/or team ID.
When only a signature is given, and multiple instances of the application
are running it is undeterminate which one is chosen as the target. In case
only a team ID is passed, the target application is identified uniquely.
If both are supplied, the application identified by the team ID must have
a matching signature, otherwise the initilization fails.
\param signature The target application's signature. May be \c NULL.
\param team The target application's team ID. May be < 0.
\return The result of the reinitialization.
*/
status_t
BMessenger::SetTo(const char *signature, team_id team)
{
status_t result = B_OK;
_InitData(signature, team, &result);
return result;
}
/*! \brief Reinitializes a BMessenger to target the local BHandler and/or
BLooper.
When a \c NULL handler is supplied, the preferred handler in the given
looper is targeted. If no looper is supplied the looper the given handler
belongs to is used -- that means in particular, that the handler must
already belong to a looper. If both are supplied the handler must actually
belong to looper.
\param handler The target handler. May be \c NULL.
\param looper The target looper. May be \c NULL.
\return The result of the reinitialization.
*/
status_t
BMessenger::SetTo(const BHandler* handler, const BLooper* looper)
{
status_t result = B_OK;
_InitData(handler, looper, &result);
return result;
}
/*! \brief Makes this BMessenger a copy of the supplied one. /*! \brief Makes this BMessenger a copy of the supplied one.
\param from the messenger to be copied. \param from the messenger to be copied.
@@ -564,6 +582,54 @@ BMessenger::_InitData(const char* signature, team_id team, status_t* _result)
} }
/*! \brief Initializes the BMessenger to target the local BHandler and/or
BLooper.
When a \c NULL handler is supplied, the preferred handler in the given
looper is targeted. If no looper is supplied the looper the given handler
belongs to is used -- that means in particular, that the handler must
already belong to a looper. If both are supplied the handler must actually
belong to looper.
\param handler The target handler. May be \c NULL.
\param looper The target looper. May be \c NULL.
\param result An optional pointer to a pre-allocated status_t into which
the result of the initialization is written.
*/
void
BMessenger::_InitData(const BHandler* handler, const BLooper* looper,
status_t* _result)
{
status_t error = (handler || looper ? B_OK : B_BAD_VALUE);
if (error == B_OK) {
if (handler) {
// BHandler is given, check/retrieve the looper.
if (looper) {
if (handler->Looper() != looper)
error = B_MISMATCHED_VALUES;
} else {
looper = handler->Looper();
if (looper == NULL)
error = B_MISMATCHED_VALUES;
}
}
// set port, token,...
if (error == B_OK) {
AutoLocker<BLooperList> locker(gLooperList);
if (locker.IsLocked() && gLooperList.IsLooperValid(looper)) {
fPort = looper->fMsgPort;
fHandlerToken = (handler
? _get_object_token_(handler) : B_PREFERRED_TOKEN);
fTeam = looper->Team();
} else
error = B_BAD_VALUE;
}
}
if (_result)
*_result = error;
}
/*! \brief Returns whether the first one of two BMessengers is less than the /*! \brief Returns whether the first one of two BMessengers is less than the
second one. second one.
+4 -4
View File
@@ -53,11 +53,11 @@ compat_open(const char *name, uint32 flags, void **cookie)
if (!HAIKU_DRIVER_REQUIRES(FBSD_WLAN)) { if (!HAIKU_DRIVER_REQUIRES(FBSD_WLAN)) {
ifp->if_flags &= ~IFF_UP; ifp->if_flags &= ~IFF_UP;
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL); ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
}
memset(&ifr, 0, sizeof(ifr)); memset(&ifr, 0, sizeof(ifr));
ifr.ifr_media = IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, 0); ifr.ifr_media = IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, 0);
ifp->if_ioctl(ifp, SIOCSIFMEDIA, (caddr_t)&ifr); ifp->if_ioctl(ifp, SIOCSIFMEDIA, (caddr_t)&ifr);
}
ifp->if_flags |= IFF_UP; ifp->if_flags |= IFF_UP;
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL); ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
@@ -191,6 +191,34 @@ stop_wlan(device_t device)
} }
status_t
wlan_open(void* cookie)
{
dprintf("wlan_open(%p)\n", cookie);
struct ifnet* ifp = (struct ifnet*)cookie;
ifp->if_init(ifp->if_softc);
ifp->if_flags |= IFF_UP;
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
return B_OK;
}
status_t
wlan_close(void* cookie)
{
dprintf("wlan_close(%p)\n", cookie);
struct ifnet* ifp = (struct ifnet*)cookie;
ifp->if_flags &= ~IFF_UP;
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
return release_sem_etc(ifp->scan_done_sem, 1, B_RELEASE_ALL);
}
status_t status_t
wlan_control(void* cookie, uint32 op, void* arg, size_t length) wlan_control(void* cookie, uint32 op, void* arg, size_t length)
{ {
@@ -344,6 +372,11 @@ wlan_control(void* cookie, uint32 op, void* arg, size_t length)
if (user_memcpy(&request, arg, sizeof(struct ieee80211req)) != B_OK) if (user_memcpy(&request, arg, sizeof(struct ieee80211req)) != B_OK)
return B_BAD_ADDRESS; return B_BAD_ADDRESS;
if (request.i_type == IEEE80211_IOC_HAIKU_COMPAT_WLAN_UP)
return wlan_open(cookie);
else if (request.i_type == IEEE80211_IOC_HAIKU_COMPAT_WLAN_DOWN)
return wlan_close(cookie);
TRACE("wlan_control: %ld, %d\n", op, request.i_type); TRACE("wlan_control: %ld, %d\n", op, request.i_type);
status_t status = ifp->if_ioctl(ifp, op, (caddr_t)&request); status_t status = ifp->if_ioctl(ifp, op, (caddr_t)&request);
if (status != B_OK) if (status != B_OK)
@@ -367,18 +400,6 @@ wlan_control(void* cookie, uint32 op, void* arg, size_t length)
} }
status_t
wlan_close(void* cookie)
{
struct ifnet* ifp = (struct ifnet*)cookie;
ifp->if_flags &= ~IFF_UP;
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
return release_sem_etc(ifp->scan_done_sem, 1, B_RELEASE_ALL);
}
status_t status_t
wlan_if_l2com_alloc(void* data) wlan_if_l2com_alloc(void* data)
{ {
@@ -1549,8 +1549,25 @@ ieee80211_ioctl_setmlme(struct ieee80211vap *vap, struct ieee80211req *ireq)
return error; return error;
if (vap->iv_opmode == IEEE80211_M_STA && if (vap->iv_opmode == IEEE80211_M_STA &&
mlme.im_op == IEEE80211_MLME_ASSOC) mlme.im_op == IEEE80211_MLME_ASSOC)
#ifndef __HAIKU__
return setmlme_assoc_sta(vap, mlme.im_macaddr, return setmlme_assoc_sta(vap, mlme.im_macaddr,
vap->iv_des_ssid[0].len, vap->iv_des_ssid[0].ssid); vap->iv_des_ssid[0].len, vap->iv_des_ssid[0].ssid);
#else
/* The wpa_supplicant (rightfully) supplies the SSID with this request.
However, with the code above it gets ignored and the desired SSID,
as set by IEEE80211_IOC_SSID is used instead. This still works if
the wpa_supplicant is the only client in use and IEEE80211_IOC_SSID
is never used, as then the mlme.im_macaddr is used as the only
identifying element. If we used IEEE80211_IOC_SSID before though,
for example because we joined an open network from the net_server
directly, there will always be a mismatch between the desired SSID
and the one the wpa_supplicant tries to associate with using this
MLME request. No association is then possible. As there is no
obvious reason why the request supplied SSID shouldn't be used, we
simply do so. */
return setmlme_assoc_sta(vap, mlme.im_macaddr,
mlme.im_ssid_len, mlme.im_ssid);
#endif
else if (mlme.im_op == IEEE80211_MLME_ASSOC) else if (mlme.im_op == IEEE80211_MLME_ASSOC)
return setmlme_assoc_adhoc(vap, mlme.im_macaddr, return setmlme_assoc_adhoc(vap, mlme.im_macaddr,
mlme.im_ssid_len, mlme.im_ssid); mlme.im_ssid_len, mlme.im_ssid);
@@ -719,6 +719,22 @@ struct ieee80211req {
#define IEEE80211_IOC_TDMA_SLOTLEN 203 /* TDMA: slot length (usecs) */ #define IEEE80211_IOC_TDMA_SLOTLEN 203 /* TDMA: slot length (usecs) */
#define IEEE80211_IOC_TDMA_BINTERVAL 204 /* TDMA: beacon intvl (slots) */ #define IEEE80211_IOC_TDMA_BINTERVAL 204 /* TDMA: beacon intvl (slots) */
#ifdef __HAIKU__
/*
These are here to allow overcoming a difference between Haiku and
FreeBSD drivers. In FreeBSD a device can be set into the down state
but is still fully configurable using the ioctl interface. The Haiku
network stack on the other hand opens and closes the driver on the
transition form up to down and vice versa. This difference can become
problematic with ported software that depends on the original behaviour.
Therefore IEEE80211_IOC_HAIKU_COMPAT_WLAN_{UP|DOWN} provide a way to
achieve the behaviour of setting and clearing IFF_UP without opening
or closing the driver itself.
*/
#define IEEE80211_IOC_HAIKU_COMPAT_WLAN_UP 0x6000
#define IEEE80211_IOC_HAIKU_COMPAT_WLAN_DOWN 0x6001
#endif /* __HAIKU__ */
/* /*
* Parameters for controlling a scan requested with * Parameters for controlling a scan requested with
* IEEE80211_IOC_SCAN_REQ. * IEEE80211_IOC_SCAN_REQ.
@@ -411,6 +411,15 @@ start_scan_locked(const struct ieee80211_scanner *scan,
, flags & IEEE80211_SCAN_ONCE ? ", once" : "" , flags & IEEE80211_SCAN_ONCE ? ", once" : ""
); );
#ifdef __HAIKU__
/* We never want to join if not explicitly looking for an SSID */
if (nssid == 0 && (flags & IEEE80211_SCAN_NOJOIN) == 0) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: setting nojoin due to no configured ssid\n", __func__);
flags |= IEEE80211_SCAN_NOJOIN;
}
#endif
scan_update_locked(vap, scan); scan_update_locked(vap, scan);
if (ss->ss_ops != NULL) { if (ss->ss_ops != NULL) {
if ((flags & IEEE80211_SCAN_NOSSID) == 0) if ((flags & IEEE80211_SCAN_NOSSID) == 0)
+11 -2
View File
@@ -42,6 +42,11 @@ Keyring::ReadFromMessage(const BMessage& message)
if (result != B_OK) if (result != B_OK)
return result; return result;
if (message.GetBool("noData", false)) {
fFlatBuffer.SetSize(0);
return B_OK;
}
ssize_t size; ssize_t size;
const void* data; const void* data;
result = message.FindData("data", B_RAW_TYPE, &data, &size); result = message.FindData("data", B_RAW_TYPE, &data, &size);
@@ -69,8 +74,12 @@ Keyring::WriteToMessage(BMessage& message)
if (result != B_OK) if (result != B_OK)
return result; return result;
result = message.AddData("data", B_RAW_TYPE, fFlatBuffer.Buffer(), if (fFlatBuffer.BufferLength() == 0)
fFlatBuffer.BufferLength()); result = message.AddBool("noData", true);
else {
result = message.AddData("data", B_RAW_TYPE, fFlatBuffer.Buffer(),
fFlatBuffer.BufferLength());
}
if (result != B_OK) if (result != B_OK)
return result; return result;
+78 -27
View File
@@ -80,7 +80,7 @@ private:
status_t _ConfigureDevice(const char* path); status_t _ConfigureDevice(const char* path);
void _ConfigureDevices(const char* path, void _ConfigureDevices(const char* path,
BMessage* suggestedInterface = NULL); BMessage* suggestedInterface = NULL);
void _ConfigureInterfaces( void _ConfigureInterfacesFromSettings(
BMessage* _missingDevice = NULL); BMessage* _missingDevice = NULL);
void _ConfigureIPv6LinkLocal(const char* name); void _ConfigureIPv6LinkLocal(const char* name);
@@ -268,7 +268,7 @@ NetServer::MessageReceived(BMessage* message)
case kMsgInterfaceSettingsUpdated: case kMsgInterfaceSettingsUpdated:
{ {
_ConfigureInterfaces(); _ConfigureInterfacesFromSettings();
break; break;
} }
@@ -351,9 +351,10 @@ NetServer::MessageReceived(BMessage* message)
case kMsgAddPersistentNetwork: case kMsgAddPersistentNetwork:
{ {
status_t result = _ConvertNetworkToSettings(*message); BMessage network = *message;
status_t result = _ConvertNetworkToSettings(network);
if (result == B_OK) if (result == B_OK)
result = fSettings.AddNetwork(*message); result = fSettings.AddNetwork(network);
BMessage reply(B_REPLY); BMessage reply(B_REPLY);
reply.AddInt32("status", result); reply.AddInt32("status", result);
@@ -532,7 +533,7 @@ NetServer::_ConfigureInterface(BMessage& message)
} }
BNetworkDevice device(name); BNetworkDevice device(name);
if (device.IsWireless()) { if (device.IsWireless() && !device.HasLink()) {
const char* networkName; const char* networkName;
if (message.FindString("network", &networkName) == B_OK) { if (message.FindString("network", &networkName) == B_OK) {
// join configured network // join configured network
@@ -786,7 +787,7 @@ NetServer::_ConfigureDevices(const char* startPath,
void void
NetServer::_ConfigureInterfaces(BMessage* _missingDevice) NetServer::_ConfigureInterfacesFromSettings(BMessage* _missingDevice)
{ {
BMessage interface; BMessage interface;
uint32 cookie = 0; uint32 cookie = 0;
@@ -836,7 +837,7 @@ NetServer::_BringUpInterfaces()
// First, we look into the settings, and try to bring everything up from there // First, we look into the settings, and try to bring everything up from there
BMessage missingDevice; BMessage missingDevice;
_ConfigureInterfaces(&missingDevice); _ConfigureInterfacesFromSettings(&missingDevice);
// check configuration // check configuration
@@ -1112,30 +1113,39 @@ NetServer::_JoinNetwork(const BMessage& message, const char* name)
} }
} }
if (!askForConfig // We always try to join via the wpa_supplicant. Even if we could join
&& network.authentication_mode == B_NETWORK_AUTHENTICATION_NONE) { // ourselves, we need to make sure that the wpa_supplicant knows about
// we join the network ourselves // our intention, as otherwise it would interfere with it.
status_t status = set_80211(deviceName, IEEE80211_IOC_SSID,
network.name, strlen(network.name)); BMessenger wpaSupplicant(kWPASupplicantSignature);
if (status != B_OK) { if (!wpaSupplicant.IsValid()) {
fprintf(stderr, "%s: joining SSID failed: %s\n", name, // The wpa_supplicant isn't running yet, we may join ourselves.
strerror(status)); if (!askForConfig
return status; && network.authentication_mode == B_NETWORK_AUTHENTICATION_NONE) {
// We can join this network ourselves.
status_t status = set_80211(deviceName, IEEE80211_IOC_SSID,
network.name, strlen(network.name));
if (status != B_OK) {
fprintf(stderr, "%s: joining SSID failed: %s\n", name,
strerror(status));
return status;
}
} }
return B_OK; // We need the supplicant, try to launch it.
status_t status = be_roster->Launch(kWPASupplicantSignature);
if (status != B_OK && status != B_ALREADY_RUNNING)
return status;
wpaSupplicant.SetTo(kWPASupplicantSignature);
if (!wpaSupplicant.IsValid())
return B_ERROR;
} }
// Join via wpa_supplicant
status_t status = be_roster->Launch(kWPASupplicantSignature);
if (status != B_OK && status != B_ALREADY_RUNNING)
return status;
// TODO: listen to notifications from the supplicant! // TODO: listen to notifications from the supplicant!
BMessage join(kMsgWPAJoinNetwork); BMessage join(kMsgWPAJoinNetwork);
status = join.AddString("device", deviceName); status_t status = join.AddString("device", deviceName);
if (status == B_OK) if (status == B_OK)
status = join.AddString("name", network.name); status = join.AddString("name", network.name);
if (status == B_OK) if (status == B_OK)
@@ -1147,7 +1157,6 @@ NetServer::_JoinNetwork(const BMessage& message, const char* name)
if (status != B_OK) if (status != B_OK)
return status; return status;
BMessenger wpaSupplicant(kWPASupplicantSignature);
status = wpaSupplicant.SendMessage(&join); status = wpaSupplicant.SendMessage(&join);
if (status != B_OK) if (status != B_OK)
return status; return status;
@@ -1159,8 +1168,50 @@ NetServer::_JoinNetwork(const BMessage& message, const char* name)
status_t status_t
NetServer::_LeaveNetwork(const BMessage& message) NetServer::_LeaveNetwork(const BMessage& message)
{ {
// TODO: not yet implemented const char* deviceName;
return B_NOT_SUPPORTED; if (message.FindString("device", &deviceName) != B_OK)
return B_BAD_VALUE;
int32 reason;
if (message.FindInt32("reason", &reason) != B_OK)
reason = IEEE80211_REASON_AUTH_LEAVE;
// We always try to send the leave request to the wpa_supplicant.
BMessenger wpaSupplicant(kWPASupplicantSignature);
if (wpaSupplicant.IsValid()) {
BMessage leave(kMsgWPALeaveNetwork);
status_t status = leave.AddString("device", deviceName);
if (status == B_OK)
status = leave.AddInt32("reason", reason);
if (status != B_OK)
return status;
status = wpaSupplicant.SendMessage(&leave);
if (status == B_OK)
return B_OK;
}
// The wpa_supplicant doesn't seem to be running, check if this was an open
// network we connected ourselves.
BNetworkDevice device(deviceName);
wireless_network network;
uint32 cookie = 0;
if (device.GetNextAssociatedNetwork(cookie, network) != B_OK
|| network.authentication_mode != B_NETWORK_AUTHENTICATION_NONE) {
// We didn't join ourselves, we can't do much.
return B_ERROR;
}
// We joined ourselves, so we can just disassociate again.
ieee80211req_mlme mlmeRequest;
memset(&mlmeRequest, 0, sizeof(mlmeRequest));
mlmeRequest.im_op = IEEE80211_MLME_DISASSOC;
mlmeRequest.im_reason = reason;
return set_80211(deviceName, IEEE80211_IOC_MLME, &mlmeRequest,
sizeof(mlmeRequest));
} }
+12 -6
View File
@@ -10,6 +10,7 @@
#include "Settings.h" #include "Settings.h"
#include <Directory.h> #include <Directory.h>
#include <File.h>
#include <FindDirectory.h> #include <FindDirectory.h>
#include <fs_interface.h> #include <fs_interface.h>
#include <Path.h> #include <Path.h>
@@ -410,13 +411,18 @@ Settings::_ConvertToDriverSettings(const char* name,
BString settings; BString settings;
status = _ConvertToDriverSettings(settingsTemplate, settings, message); status = _ConvertToDriverSettings(settingsTemplate, settings, message);
if (status == B_OK) { if (status != B_OK)
settings.RemoveFirst("\n"); return status;
// TODO: actually write the settings.String() out into the file
printf("settings:\n%s\n", settings.String());
}
return status; settings.RemoveFirst("\n");
BFile settingsFile(path.Path(), B_WRITE_ONLY | B_ERASE_FILE
| B_CREATE_FILE);
ssize_t written = settingsFile.Write(settings.String(), settings.Length());
if (written < 0)
return written;
return written == settings.Length() ? B_OK : B_ERROR;
} }
@@ -1,18 +1,33 @@
/* /*
* Copyright 2004-2011 Haiku, Inc. All rights reserved. * Copyright 2004-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Alexander von Gluck, kallisti5@unixzen.com * Alexander von Gluck, kallisti5@unixzen.com
* John Scipione, jscipione@gmail.com
*/ */
#include "InterfaceAddressView.h" #include "InterfaceAddressView.h"
#include "NetworkSettings.h" #include "NetworkSettings.h"
#include <Catalog.h>
#include <ControlLook.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <MenuField.h>
#include <PopUpMenu.h>
#include <Screen.h>
#include <Size.h>
#include <StringView.h> #include <StringView.h>
#include <TextControl.h>
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "IntefaceAddressView"
// #pragma mark - InterfaceAddressView
InterfaceAddressView::InterfaceAddressView(BRect frame, int family, InterfaceAddressView::InterfaceAddressView(BRect frame, int family,
@@ -27,26 +42,31 @@ InterfaceAddressView::InterfaceAddressView(BRect frame, int family,
// Create our controls // Create our controls
fModePopUpMenu = new BPopUpMenu("modes"); fModePopUpMenu = new BPopUpMenu("modes");
fModePopUpMenu->AddItem(new BMenuItem("Automatic", fModePopUpMenu->AddItem(new BMenuItem(B_TRANSLATE("DHCP"),
new BMessage(M_MODE_AUTO))); new BMessage(M_MODE_AUTO)));
fModePopUpMenu->AddItem(new BMenuItem("Static", fModePopUpMenu->AddItem(new BMenuItem(B_TRANSLATE("Static"),
new BMessage(M_MODE_STATIC))); new BMessage(M_MODE_STATIC)));
fModePopUpMenu->AddSeparatorItem(); fModePopUpMenu->AddSeparatorItem();
fModePopUpMenu->AddItem(new BMenuItem("None", fModePopUpMenu->AddItem(new BMenuItem(B_TRANSLATE("Off"),
new BMessage(M_MODE_NONE))); new BMessage(M_MODE_OFF)));
fModeField = new BMenuField("Mode:", fModePopUpMenu); fModeField = new BMenuField(B_TRANSLATE("Mode:"), fModePopUpMenu);
fModeField->SetToolTip(BString("The method for obtaining an IP address")); fModeField->SetToolTip(BString(B_TRANSLATE("The method for obtaining an IP address")));
fAddressField = new BTextControl("IP Address:", NULL, NULL); float minimumWidth = be_control_look->DefaultItemSpacing() * 16;
fAddressField->SetToolTip(BString("Your internet protocol address"));
fNetmaskField = new BTextControl("Netmask:", NULL, NULL);
fNetmaskField->SetToolTip(BString("Your netmask (subnet)"));
fGatewayField = new BTextControl("Gateway:", NULL, NULL);
fGatewayField->SetToolTip(BString("Your gateway (router)"));
RevertFields(); fAddressField = new BTextControl(B_TRANSLATE("IP Address:"), NULL, NULL);
// Do the initial field population fAddressField->SetToolTip(BString(B_TRANSLATE("Your IP address")));
fAddressField->TextView()->SetExplicitMinSize(BSize(minimumWidth, B_SIZE_UNSET));
fNetmaskField = new BTextControl(B_TRANSLATE("Netmask:"), NULL, NULL);
fNetmaskField->SetToolTip(BString(B_TRANSLATE("Your netmask")));
fNetmaskField->TextView()->SetExplicitMinSize(BSize(minimumWidth, B_SIZE_UNSET));
fGatewayField = new BTextControl(B_TRANSLATE("Gateway:"), NULL, NULL);
fGatewayField->SetToolTip(BString(B_TRANSLATE("Your gateway")));
fGatewayField->TextView()->SetExplicitMinSize(BSize(minimumWidth, B_SIZE_UNSET));
Revert();
// Populate the fields
BLayoutBuilder::Group<>(this) BLayoutBuilder::Group<>(this)
.AddGrid() .AddGrid()
@@ -67,6 +87,9 @@ InterfaceAddressView::~InterfaceAddressView()
} }
// #pragma mark - InterfaceAddressView virtual methods
void void
InterfaceAddressView::AttachedToWindow() InterfaceAddressView::AttachedToWindow()
{ {
@@ -80,71 +103,109 @@ InterfaceAddressView::MessageReceived(BMessage* message)
switch (message->what) { switch (message->what) {
case M_MODE_AUTO: case M_MODE_AUTO:
_EnableFields(false); _EnableFields(false);
_ShowFields(true);
break; break;
case M_MODE_STATIC: case M_MODE_STATIC:
_EnableFields(true); _EnableFields(true);
_ShowFields(true);
break; break;
case M_MODE_NONE:
_EnableFields(false); case M_MODE_OFF:
fAddressField->SetText(""); fAddressField->SetText("");
fNetmaskField->SetText(""); fNetmaskField->SetText("");
fGatewayField->SetText(""); fGatewayField->SetText("");
_EnableFields(false);
_ShowFields(false);
break; break;
default: default:
BView::MessageReceived(message); BView::MessageReceived(message);
} }
} }
// #pragma mark - InterfaceAddressView private methods
void void
InterfaceAddressView::_EnableFields(bool enabled) InterfaceAddressView::_EnableFields(bool enable)
{ {
fAddressField->SetEnabled(enabled); fAddressField->SetEnabled(enable);
fNetmaskField->SetEnabled(enabled); fNetmaskField->SetEnabled(enable);
fGatewayField->SetEnabled(enabled); fGatewayField->SetEnabled(enable);
} }
void
InterfaceAddressView::_ShowFields(bool show)
{
if (show) {
if (fAddressField->IsHidden())
fAddressField->Show();
if (fNetmaskField->IsHidden())
fNetmaskField->Show();
if (fGatewayField->IsHidden())
fGatewayField->Show();
} else {
if (!fAddressField->IsHidden())
fAddressField->Hide();
if (!fNetmaskField->IsHidden())
fNetmaskField->Hide();
if (!fGatewayField->IsHidden())
fGatewayField->Hide();
}
}
// #pragma mark - InterfaceAddressView public methods
status_t status_t
InterfaceAddressView::RevertFields() InterfaceAddressView::Revert()
{ {
// Populate address fields with current settings // Populate address fields with current settings
const char* currMode = fSettings->AutoConfigure(fFamily) int32 mode;
? "Automatic" : "Static"; if (fSettings->AutoConfigure(fFamily)) {
mode = M_MODE_AUTO;
_EnableFields(!fSettings->AutoConfigure(fFamily));
// if Autoconfigured, disable address fields until changed
if (fSettings->IPAddr(fFamily).IsEmpty()
&& !fSettings->AutoConfigure(fFamily))
{
currMode = "None";
_EnableFields(false); _EnableFields(false);
_ShowFields(true);
} else if (fSettings->IPAddr(fFamily).IsEmpty()) {
mode = M_MODE_OFF;
_EnableFields(false);
_ShowFields(false);
} else {
mode = M_MODE_STATIC;
_EnableFields(true);
_ShowFields(true);
} }
BMenuItem* item = fModePopUpMenu->FindItem(currMode); BMenuItem* item = fModePopUpMenu->FindItem(mode);
if (item) if (item != NULL)
item->SetMarked(true); item->SetMarked(true);
fAddressField->SetText(fSettings->IP(fFamily)); if (!fSettings->IPAddr(fFamily).IsEmpty()) {
fNetmaskField->SetText(fSettings->Netmask(fFamily)); fAddressField->SetText(fSettings->IP(fFamily));
fGatewayField->SetText(fSettings->Gateway(fFamily)); fNetmaskField->SetText(fSettings->Netmask(fFamily));
fGatewayField->SetText(fSettings->Gateway(fFamily));
}
return B_OK; return B_OK;
} }
status_t status_t
InterfaceAddressView::SaveFields() InterfaceAddressView::Save()
{ {
BMenuItem* item = fModePopUpMenu->FindMarked();
if (item == NULL)
return B_ERROR;
fSettings->SetIP(fFamily, fAddressField->Text()); fSettings->SetIP(fFamily, fAddressField->Text());
fSettings->SetNetmask(fFamily, fNetmaskField->Text()); fSettings->SetNetmask(fFamily, fNetmaskField->Text());
fSettings->SetGateway(fFamily, fGatewayField->Text()); fSettings->SetGateway(fFamily, fGatewayField->Text());
fSettings->SetAutoConfigure(fFamily, item->Command() == M_MODE_AUTO);
BMenuItem* item = fModePopUpMenu->FindItem("Automatic");
fSettings->SetAutoConfigure(fFamily, item->IsMarked());
return B_OK; return B_OK;
} }
@@ -1,9 +1,10 @@
/* /*
* Copyright 2004-2011 Haiku, Inc. All rights reserved. * Copyright 2004-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Alexander von Gluck, kallisti5@unixzen.com * Alexander von Gluck, kallisti5@unixzen.com
* John Scipione, jscipione@gmail.com
*/ */
#ifndef INTERFACE_ADDRESS_VIEW_H #ifndef INTERFACE_ADDRESS_VIEW_H
#define INTERFACE_ADDRESS_VIEW_H #define INTERFACE_ADDRESS_VIEW_H
@@ -11,33 +12,37 @@
#include "NetworkSettings.h" #include "NetworkSettings.h"
#include <MenuField.h>
#include <PopUpMenu.h>
#include <Screen.h>
#include <TextControl.h>
#include <GroupView.h> #include <GroupView.h>
enum { enum {
M_MODE_AUTO = 'iato', M_MODE_AUTO = 'iato',
M_MODE_STATIC = 'istc', M_MODE_STATIC = 'istc',
M_MODE_NONE = 'inon' M_MODE_OFF = 'ioff'
}; };
class BMenuField;
class BMessage;
class BPopUpMenu;
class BRect;
class BTextControl;
class InterfaceAddressView : public BGroupView { class InterfaceAddressView : public BGroupView {
public: public:
InterfaceAddressView(BRect frame, InterfaceAddressView(BRect frame,
int family, NetworkSettings* settings); int family, NetworkSettings* settings);
virtual ~InterfaceAddressView(); virtual ~InterfaceAddressView();
virtual void MessageReceived(BMessage* message);
virtual void AttachedToWindow();
status_t RevertFields();
status_t SaveFields();
virtual void AttachedToWindow();
virtual void MessageReceived(BMessage* message);
status_t Revert();
status_t Save();
private: private:
void _EnableFields(bool enabled); void _EnableFields(bool enable);
void _ShowFields(bool show);
NetworkSettings* fSettings; NetworkSettings* fSettings;
int fFamily; int fFamily;
@@ -50,5 +55,4 @@ private:
}; };
#endif /* INTERFACE_ADDRESS_VIEW_H */ #endif // INTERFACE_ADDRESS_VIEW_H
@@ -1,17 +1,33 @@
/* /*
* Copyright 2004-2011 Haiku, Inc. All rights reserved. * Copyright 2004-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Alexander von Gluck, kallisti5@unixzen.com * Alexander von Gluck, kallisti5@unixzen.com
* John Scipione, jscipione@gmail.com
*/ */
#include "InterfaceHardwareView.h" #include "InterfaceHardwareView.h"
#include "NetworkSettings.h" #include "NetworkSettings.h"
#include <Catalog.h>
#include <ControlLook.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <MenuField.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <NetworkAddress.h>
#include <Screen.h>
#include <Size.h>
#include <StringView.h>
#include <TextControl.h>
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "IntefaceHardwareView"
// #pragma mark - InterfaceHardwareView
InterfaceHardwareView::InterfaceHardwareView(BRect frame, InterfaceHardwareView::InterfaceHardwareView(BRect frame,
@@ -24,22 +40,34 @@ InterfaceHardwareView::InterfaceHardwareView(BRect frame,
// TODO : Small graph of throughput? // TODO : Small graph of throughput?
// TODO : Use strings instead of TextControls float minimumWidth = be_control_look->DefaultItemSpacing() * 16;
fStatusField = new BTextControl("Status:", NULL, NULL);
fStatusField->SetEnabled(false);
fMACField = new BTextControl("MAC Address:", NULL, NULL);
fMACField->SetEnabled(false);
fSpeedField = new BTextControl("Link Speed:", NULL, NULL);
fSpeedField->SetEnabled(false);
RevertFields(); BStringView* status = new BStringView("status label", B_TRANSLATE("Status:"));
// Do the initial field population status->SetAlignment(B_ALIGN_RIGHT);
fStatusField = new BStringView("status field", "");
fStatusField->SetExplicitMinSize(BSize(minimumWidth, B_SIZE_UNSET));
BStringView* macAddress = new BStringView("mac address label",
B_TRANSLATE("MAC address:"));
macAddress->SetAlignment(B_ALIGN_RIGHT);
fMacAddressField = new BStringView("mac address field", "");
fMacAddressField->SetExplicitMinSize(BSize(minimumWidth, B_SIZE_UNSET));
BStringView* linkSpeed = new BStringView("link speed label",
B_TRANSLATE("Link speed:"));
linkSpeed->SetAlignment(B_ALIGN_RIGHT);
fLinkSpeedField = new BStringView("link speed field", "");
fLinkSpeedField->SetExplicitMinSize(BSize(minimumWidth, B_SIZE_UNSET));
Revert();
// Populate the fields
BLayoutBuilder::Group<>(this) BLayoutBuilder::Group<>(this)
.AddGrid() .AddGrid()
.AddTextControl(fStatusField, 0, 0, B_ALIGN_RIGHT) .Add(status, 0, 0)
.AddTextControl(fMACField, 0, 1, B_ALIGN_RIGHT) .Add(fStatusField, 1, 0)
.AddTextControl(fSpeedField, 0, 2, B_ALIGN_RIGHT) .Add(macAddress, 0, 1)
.Add(fMacAddressField, 1, 1)
.Add(linkSpeed, 0, 2)
.Add(fLinkSpeedField, 1, 2)
.End() .End()
.AddGlue() .AddGlue()
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, .SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
@@ -53,6 +81,9 @@ InterfaceHardwareView::~InterfaceHardwareView()
} }
// #pragma mark - InterfaceHardwareView virtual methods
void void
InterfaceHardwareView::AttachedToWindow() InterfaceHardwareView::AttachedToWindow()
{ {
@@ -70,26 +101,29 @@ InterfaceHardwareView::MessageReceived(BMessage* message)
} }
// #pragma mark - InterfaceHardwareView public methods
status_t status_t
InterfaceHardwareView::RevertFields() InterfaceHardwareView::Revert()
{ {
// Populate fields with current settings // Populate fields with current settings
if (fSettings->HasLink()) if (fSettings->HasLink())
fStatusField->SetText("connected"); fStatusField->SetText(B_TRANSLATE("connected"));
else else
fStatusField->SetText("disconnected"); fStatusField->SetText(B_TRANSLATE("disconnected"));
fMacAddressField->SetText(fSettings->HardwareAddress());
// TODO : Find how to get link speed // TODO : Find how to get link speed
fSpeedField->SetText("100 Mb/s"); fLinkSpeedField->SetText("100 Mb/s");
return B_OK; return B_OK;
} }
status_t status_t
InterfaceHardwareView::SaveFields() InterfaceHardwareView::Save()
{ {
return B_OK; return B_OK;
} }
@@ -1,9 +1,10 @@
/* /*
* Copyright 2004-2011 Haiku, Inc. All rights reserved. * Copyright 2004-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Alexander von Gluck, kallisti5@unixzen.com * Alexander von Gluck, kallisti5@unixzen.com
* John Scipione, jscipione@gmail.com
*/ */
#ifndef INTERFACE_HARDWARE_VIEW_H #ifndef INTERFACE_HARDWARE_VIEW_H
#define INTERFACE_HARDWARE_VIEW_H #define INTERFACE_HARDWARE_VIEW_H
@@ -11,35 +12,34 @@
#include "NetworkSettings.h" #include "NetworkSettings.h"
#include <MenuField.h>
#include <PopUpMenu.h>
#include <Screen.h>
#include <StringView.h>
#include <TextControl.h>
#include <GroupView.h> #include <GroupView.h>
class BMessage;
class BRect;
class BStringView;
class InterfaceHardwareView : public BGroupView { class InterfaceHardwareView : public BGroupView {
public: public:
InterfaceHardwareView(BRect frame, InterfaceHardwareView(BRect frame,
NetworkSettings* settings); NetworkSettings* settings);
virtual ~InterfaceHardwareView(); virtual ~InterfaceHardwareView();
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual void AttachedToWindow(); virtual void AttachedToWindow();
status_t RevertFields(); status_t Revert();
status_t SaveFields(); status_t Save();
private: private:
void _EnableFields(bool enabled); void _EnableFields(bool enabled);
NetworkSettings* fSettings; NetworkSettings* fSettings;
BTextControl* fStatusField; BStringView* fStatusField;
BTextControl* fMACField; BStringView* fMacAddressField;
BTextControl* fSpeedField; BStringView* fLinkSpeedField;
}; };
#endif /* INTERFACE_HARDWARE_VIEW_H */ #endif // INTERFACE_HARDWARE_VIEW_H
@@ -1,55 +1,59 @@
/* /*
* Copyright 2004-2011 Haiku, Inc. All rights reserved. * Copyright 2004-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Alexander von Gluck, kallisti5@unixzen.com * Alexander von Gluck, kallisti5@unixzen.com
* John Scipione, jscipione@gmail.com
*/ */
#include "InterfaceWindow.h" #include "InterfaceWindow.h"
#include <Application.h> #include <Application.h>
#include <Button.h>
#include <stdio.h> #include <Catalog.h>
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <TabView.h>
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "NetworkSetupWindow" #define B_TRANSLATION_CONTEXT "InterfaceWindow"
InterfaceWindow::InterfaceWindow(NetworkSettings* settings) InterfaceWindow::InterfaceWindow(NetworkSettings* settings)
: :
BWindow(BRect(50, 50, 370, 350), "Interface Settings", BWindow(BRect(50, 50, 370, 350), "Interface Settings",
B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
B_CURRENT_WORKSPACE) | B_AUTO_UPDATE_SIZE_LIMITS, B_CURRENT_WORKSPACE)
{ {
fNetworkSettings = settings; fNetworkSettings = settings;
fTabView = new BTabView("settings_tabs"); fTabView = new BTabView("settings_tabs");
fTabView->SetTabWidth(B_WIDTH_FROM_LABEL);
fApplyButton = new BButton("save", B_TRANSLATE("Save"),
new BMessage(MSG_IP_SAVE));
fRevertButton = new BButton("revert", B_TRANSLATE("Revert"), fRevertButton = new BButton("revert", B_TRANSLATE("Revert"),
new BMessage(MSG_IP_REVERT)); new BMessage(MSG_IP_REVERT));
fTabView->SetResizingMode(B_FOLLOW_ALL); fApplyButton = new BButton("save", B_TRANSLATE("Save"),
// ensure tab container matches window size new BMessage(MSG_IP_SAVE));
SetDefaultButton(fApplyButton);
_PopulateTabs(); _PopulateTabs();
SetLayout(new BGroupLayout(B_VERTICAL)); SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) AddChild(BGroupLayoutBuilder(B_VERTICAL, B_USE_SMALL_SPACING)
.Add(fTabView) .Add(fTabView)
.AddGroup(B_HORIZONTAL, 5) .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
.AddGlue()
.Add(fRevertButton) .Add(fRevertButton)
.AddGlue()
.Add(fApplyButton) .Add(fApplyButton)
.End() .End()
.SetInsets(10, 10, 10, 10) .SetInsets(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING,
B_USE_SMALL_SPACING, B_USE_SMALL_SPACING)
); );
} }
@@ -65,21 +69,20 @@ InterfaceWindow::MessageReceived(BMessage* message)
protocols* supportedFamilies = fNetworkSettings->ProtocolVersions(); protocols* supportedFamilies = fNetworkSettings->ProtocolVersions();
switch (message->what) { switch (message->what) {
case MSG_IP_REVERT: case MSG_IP_REVERT:
for (int index = 0; index < MAX_PROTOCOLS; index++) for (int index = 0; index < MAX_PROTOCOLS; index++) {
{
if (supportedFamilies[index].present) { if (supportedFamilies[index].present) {
int inet_id = supportedFamilies[index].inet_id; int inet_id = supportedFamilies[index].inet_id;
fTabIPView[inet_id]->RevertFields(); fTabIPView[inet_id]->Revert();
} }
} }
break; break;
case MSG_IP_SAVE: case MSG_IP_SAVE:
for (int index = 0; index < MAX_PROTOCOLS; index++) for (int index = 0; index < MAX_PROTOCOLS; index++) {
{
if (supportedFamilies[index].present) { if (supportedFamilies[index].present) {
int inet_id = supportedFamilies[index].inet_id; int inet_id = supportedFamilies[index].inet_id;
fTabIPView[inet_id]->SaveFields(); fTabIPView[inet_id]->Save();
} }
} }
this->Quit(); this->Quit();
@@ -97,15 +100,15 @@ InterfaceWindow::_PopulateTabs()
BRect frame = fTabView->Bounds(); BRect frame = fTabView->Bounds();
protocols* supportedFamilies = fNetworkSettings->ProtocolVersions(); protocols* supportedFamilies = fNetworkSettings->ProtocolVersions();
BTab* hardwaretab = new BTab; BTab* hardwareTab = new BTab;
fTabHardwareView = new InterfaceHardwareView(frame, fTabHardwareView = new InterfaceHardwareView(frame,
fNetworkSettings); fNetworkSettings);
fTabView->AddTab(fTabHardwareView, hardwaretab); fTabView->AddTab(fTabHardwareView, hardwareTab);
if (fNetworkSettings->IsEthernet()) if (fNetworkSettings->IsEthernet())
hardwaretab->SetLabel("Wired"); hardwareTab->SetLabel(B_TRANSLATE("Wired"));
else else
hardwaretab->SetLabel("Wirless"); hardwareTab->SetLabel(B_TRANSLATE("Wirless"));
for (int index = 0; index < MAX_PROTOCOLS; index++) for (int index = 0; index < MAX_PROTOCOLS; index++)
{ {
@@ -128,4 +131,3 @@ InterfaceWindow::QuitRequested()
{ {
return true; return true;
} }
@@ -1,9 +1,10 @@
/* /*
* Copyright 2004-2011 Haiku, Inc. All rights reserved. * Copyright 2004-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Alexander von Gluck, kallisti5@unixzen.com * Alexander von Gluck, kallisti5@unixzen.com
* John Scipione, jscipione@gmail.com
*/ */
#ifndef INTERFACE_WINDOW_H #ifndef INTERFACE_WINDOW_H
#define INTERFACE_WINDOW_H #define INTERFACE_WINDOW_H
@@ -13,15 +14,10 @@
#include "InterfaceAddressView.h" #include "InterfaceAddressView.h"
#include "InterfaceHardwareView.h" #include "InterfaceHardwareView.h"
#include <Button.h>
#include <Catalog.h>
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <TabView.h>
#include <Window.h>
#include <map> #include <map>
#include <Window.h>
enum { enum {
MSG_IP_SAVE = 'ipap', MSG_IP_SAVE = 'ipap',
@@ -32,25 +28,30 @@ enum {
typedef std::map<int, InterfaceAddressView*> IPViewMap; typedef std::map<int, InterfaceAddressView*> IPViewMap;
class BButton;
class BTabView;
class InterfaceWindow : public BWindow { class InterfaceWindow : public BWindow {
public: public:
InterfaceWindow(NetworkSettings* settings); InterfaceWindow(NetworkSettings* settings);
virtual ~InterfaceWindow(); virtual ~InterfaceWindow();
virtual bool QuitRequested();
virtual void MessageReceived(BMessage* mesage); virtual void MessageReceived(BMessage* mesage);
virtual bool QuitRequested();
private: private:
status_t _PopulateTabs(); status_t _PopulateTabs();
NetworkSettings* fNetworkSettings; NetworkSettings* fNetworkSettings;
BButton* fApplyButton;
BButton* fRevertButton;
BTabView* fTabView;
IPViewMap fTabIPView; BButton* fRevertButton;
InterfaceHardwareView* fTabHardwareView; BButton* fApplyButton;
BTabView* fTabView;
IPViewMap fTabIPView;
InterfaceHardwareView* fTabHardwareView;
}; };
#endif /* INTERFACE_WINDOW_H */ #endif // INTERFACE_WINDOW_H
@@ -1,30 +1,38 @@
/* /*
* Copyright 2004-2011 Haiku, Inc. All rights reserved. * Copyright 2004-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Andre Alves Garzia, andre@andregarzia.com * Stephan Aßmus
* Stephan Assmuß
* Axel Dörfler * Axel Dörfler
* Andre Alves Garzia, andre@andregarzia.com
* Alexander von Gluck, kallisti5@unixzen.com
* Philippe Houdoin * Philippe Houdoin
* Fredrik Modéen * Fredrik Modéen
* Hugo Santos
* Philippe Saint-Pierre * Philippe Saint-Pierre
* Alexander von Gluck, kallisti5@unixzen.com * Hugo Santos
* John Scipione, jscipione@gmail.com
*/ */
#include "InterfacesAddOn.h" #include "InterfacesAddOn.h"
#include "InterfaceWindow.h" #include "InterfaceWindow.h"
#include <stdio.h>
#include <Alert.h> #include <Alert.h>
#include <Button.h>
#include <Catalog.h>
#include <ControlLook.h>
#include <GroupLayout.h> #include <GroupLayout.h>
#include <GroupLayoutBuilder.h> #include <GroupLayoutBuilder.h>
#include <ListItem.h>
#include <ListView.h>
#include <ScrollView.h> #include <ScrollView.h>
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "InterfacesAddOn"
NetworkSetupAddOn* NetworkSetupAddOn*
get_nth_addon(image_id image, int index) get_nth_addon(image_id image, int index)
{ {
@@ -60,42 +68,40 @@ InterfacesAddOn::Name()
BView* BView*
InterfacesAddOn::CreateView(BRect *bounds) InterfacesAddOn::CreateView(BRect *bounds)
{ {
BRect intViewRect = *bounds;
// Construct the ListView // Construct the ListView
fListview = new InterfacesListView(intViewRect, fListView = new InterfacesListView("interfaces");
"interfaces", B_FOLLOW_ALL_SIDES); fListView->SetSelectionMessage(new BMessage(kMsgInterfaceSelected));
fListview->SetSelectionMessage(new BMessage(kMsgInterfaceSelected)); fListView->SetInvocationMessage(new BMessage(kMsgInterfaceConfigure));
fListview->SetInvocationMessage(new BMessage(kMsgInterfaceConfigure));
BScrollView* scrollView = new BScrollView(NULL, fListview, BScrollView* scrollView = new BScrollView("scrollView", fListView,
B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, false, true); B_WILL_DRAW | B_FRAME_EVENTS, false, true);
// Construct the BButtons // Construct the BButtons
fConfigure = new BButton(intViewRect, "configure", fConfigure = new BButton("configure", B_TRANSLATE("Configure" B_UTF8_ELLIPSIS),
"Configure" B_UTF8_ELLIPSIS, new BMessage(kMsgInterfaceConfigure)); new BMessage(kMsgInterfaceConfigure));
fConfigure->SetEnabled(false); fConfigure->SetEnabled(false);
fOnOff = new BButton(intViewRect, "onoff", "Disable", fOnOff = new BButton("onoff", B_TRANSLATE("Disable"),
new BMessage(kMsgInterfaceToggle)); new BMessage(kMsgInterfaceToggle));
fOnOff->SetEnabled(false); fOnOff->SetEnabled(false);
fRenegotiate = new BButton(intViewRect, "heal", fRenegotiate = new BButton("heal", B_TRANSLATE("Renegotiate"),
"Renegotiate", new BMessage(kMsgInterfaceRenegotiate)); new BMessage(kMsgInterfaceRenegotiate));
fRenegotiate->SetEnabled(false); fRenegotiate->SetEnabled(false);
// Build the layout // Build the layout
SetLayout(new BGroupLayout(B_VERTICAL)); SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) AddChild(BGroupLayoutBuilder(B_VERTICAL, B_USE_DEFAULT_SPACING)
.Add(scrollView) .Add(scrollView)
.AddGroup(B_HORIZONTAL, 5) .AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING)
.Add(fConfigure) .Add(fConfigure)
.Add(fOnOff) .Add(fOnOff)
.AddGlue() .AddGlue()
.Add(fRenegotiate) .Add(fRenegotiate)
.End() .End()
.SetInsets(10, 10, 10, 10) .SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
); );
*bounds = Bounds(); *bounds = Bounds();
@@ -106,7 +112,7 @@ InterfacesAddOn::CreateView(BRect *bounds)
void void
InterfacesAddOn::AttachedToWindow() InterfacesAddOn::AttachedToWindow()
{ {
fListview->SetTarget(this); fListView->SetTarget(this);
fConfigure->SetTarget(this); fConfigure->SetTarget(this);
fOnOff->SetTarget(this); fOnOff->SetTarget(this);
fRenegotiate->SetTarget(this); fRenegotiate->SetTarget(this);
@@ -117,18 +123,17 @@ status_t
InterfacesAddOn::Save() InterfacesAddOn::Save()
{ {
// TODO : Profile? // TODO : Profile?
return fListview->SaveItems(); return fListView->SaveItems();
} }
void void
InterfacesAddOn::MessageReceived(BMessage* msg) InterfacesAddOn::MessageReceived(BMessage* msg)
{ {
int nr = fListview->CurrentSelection(); int nr = fListView->CurrentSelection();
InterfaceListItem *item = NULL; InterfaceListItem *item = NULL;
if (nr != -1) { if (nr != -1)
item = dynamic_cast<InterfaceListItem*>(fListview->ItemAt(nr)); item = dynamic_cast<InterfaceListItem*>(fListView->ItemAt(nr));
}
switch (msg->what) { switch (msg->what) {
case kMsgInterfaceSelected: case kMsgInterfaceSelected:
@@ -136,7 +141,7 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
fConfigure->SetEnabled(item != NULL); fConfigure->SetEnabled(item != NULL);
fOnOff->SetEnabled(item != NULL); fOnOff->SetEnabled(item != NULL);
fRenegotiate->SetEnabled(item != NULL); fRenegotiate->SetEnabled(item != NULL);
if (!item) if (item == NULL)
break; break;
fConfigure->SetEnabled(!item->IsDisabled()); fConfigure->SetEnabled(!item->IsDisabled());
fRenegotiate->SetEnabled(!item->IsDisabled()); fRenegotiate->SetEnabled(!item->IsDisabled());
@@ -146,7 +151,7 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
case kMsgInterfaceConfigure: case kMsgInterfaceConfigure:
{ {
if (!item) if (item == NULL)
break; break;
InterfaceWindow* sw = new InterfaceWindow(item->GetSettings()); InterfaceWindow* sw = new InterfaceWindow(item->GetSettings());
@@ -156,20 +161,20 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
case kMsgInterfaceToggle: case kMsgInterfaceToggle:
{ {
if (!item) if (item == NULL)
break; break;
item->SetDisabled(!item->IsDisabled()); item->SetDisabled(!item->IsDisabled());
fConfigure->SetEnabled(!item->IsDisabled()); fConfigure->SetEnabled(!item->IsDisabled());
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable"); fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
fRenegotiate->SetEnabled(!item->IsDisabled()); fRenegotiate->SetEnabled(!item->IsDisabled());
fListview->Invalidate(); fListView->Invalidate();
break; break;
} }
case kMsgInterfaceRenegotiate: case kMsgInterfaceRenegotiate:
{ {
if (!item) if (item == NULL)
break; break;
NetworkSettings* ns = item->GetSettings(); NetworkSettings* ns = item->GetSettings();
@@ -1,20 +1,18 @@
/* /*
* Copyright 2004-2011 Haiku, Inc. All rights reserved. * Copyright 2004-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Alexander von Gluck, <kallisti5@unixzen.com>
* Philippe Houdoin * Philippe Houdoin
* Fredrik Modéen * Fredrik Modéen
* Alexander von Gluck, <kallisti5@unixzen.com> * John Scipione, jscipione@gmail.com
*/ */
#ifndef INTERFACES_ADDON_H #ifndef INTERFACES_ADDON_H
#define INTERFACES_ADDON_H #define INTERFACES_ADDON_H
#include <Box.h> #include <Box.h>
#include <ListView.h>
#include <ListItem.h>
#include <Button.h>
#include "NetworkSetupAddOn.h" #include "NetworkSetupAddOn.h"
#include "InterfacesListView.h" #include "InterfacesListView.h"
@@ -26,6 +24,9 @@ static const uint32 kMsgInterfaceToggle = 'onof';
static const uint32 kMsgInterfaceRenegotiate = 'redo'; static const uint32 kMsgInterfaceRenegotiate = 'redo';
class BButton;
class BView;
class InterfacesAddOn : public NetworkSetupAddOn, public BBox class InterfacesAddOn : public NetworkSetupAddOn, public BBox
{ {
public: public:
@@ -41,12 +42,12 @@ public:
void MessageReceived(BMessage* msg); void MessageReceived(BMessage* msg);
private: private:
InterfacesListView* fListview; InterfacesListView* fListView;
BButton* fConfigure; BButton* fConfigure;
BButton* fOnOff; BButton* fOnOff;
BButton* fRenegotiate; BButton* fRenegotiate;
}; };
#endif /*INTERFACES_ADDON_H*/ #endif // INTERFACES_ADDON_H
@@ -1,11 +1,12 @@
/* /*
* Copyright 2004-2011 Haiku, Inc. All rights reserved. * Copyright 2004-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Alexander von Gluck IV, kallisti5@unixzen.com
* Philippe Houdoin * Philippe Houdoin
* Fredrik Modéen * Fredrik Modéen
* Alexander von Gluck IV, kallisti5@unixzen.com * John Scipione, jscipione@gmail.com
*/ */
@@ -19,24 +20,39 @@
#include <net/if_media.h> #include <net/if_media.h>
#include <net/if_types.h> #include <net/if_types.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <net_notifications.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/sockio.h> #include <sys/sockio.h>
#include <Bitmap.h>
#include <Catalog.h>
#include <File.h> #include <File.h>
#include <IconUtils.h> #include <IconUtils.h>
#include <net_notifications.h> #include <MenuItem.h>
#include <NetworkDevice.h> #include <NetworkDevice.h>
#include <NetworkInterface.h> #include <NetworkInterface.h>
#include <NetworkRoster.h> #include <NetworkRoster.h>
#include <Point.h>
#include <PopUpMenu.h>
#include <Resources.h> #include <Resources.h>
#include <String.h>
#include <SeparatorItem.h>
#include <Window.h> #include <Window.h>
#include <AutoDeleter.h> #include <AutoDeleter.h>
#include "NetworkSettings.h" #include "InterfacesAddOn.h"
#include "InterfaceWindow.h"
// #pragma mark - #define ICON_SIZE 37
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "InterfacesListView"
// #pragma mark - our_image function
status_t status_t
@@ -53,7 +69,7 @@ our_image(image_info& image)
} }
// #pragma mark - // #pragma mark - InterfaceListItem
InterfaceListItem::InterfaceListItem(const char* name) InterfaceListItem::InterfaceListItem(const char* name)
@@ -73,22 +89,7 @@ InterfaceListItem::~InterfaceListItem()
} }
void // #pragma mark - InterfaceListItem public methods
InterfaceListItem::Update(BView* owner, const BFont* font)
{
BListItem::Update(owner, font);
font_height height;
font->GetHeight(&height);
float lineHeight = ceilf(height.ascent) + ceilf(height.descent)
+ ceilf(height.leading);
fFirstlineOffset = 2 + ceilf(height.ascent + height.leading / 2);
fSecondlineOffset = fFirstlineOffset + lineHeight;
fThirdlineOffset = fFirstlineOffset + (lineHeight * 2);
SetHeight(3 * lineHeight + 4);
}
void void
@@ -96,22 +97,22 @@ InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete)
{ {
BListView* list = dynamic_cast<BListView*>(owner); BListView* list = dynamic_cast<BListView*>(owner);
if (!list) if (list == NULL)
return; return;
owner->PushState(); owner->PushState();
BRect bounds = list->ItemFrame(list->IndexOf(this)); BRect bounds = list->ItemFrame(list->IndexOf(this));
rgb_color black = {0, 0, 0, 255}; rgb_color highColor = list->HighColor();
rgb_color lowColor = list->LowColor();
if (IsSelected() || complete) { if (IsSelected() || complete) {
if (IsSelected()) { if (IsSelected()) {
list->SetHighColor(tint_color(list->ViewColor(), list->SetHighColor(ui_color(B_LIST_SELECTED_BACKGROUND_COLOR));
B_HIGHLIGHT_BACKGROUND_TINT)); list->SetLowColor(list->HighColor());
} else { } else
list->SetHighColor(list->LowColor()); list->SetHighColor(lowColor);
}
list->FillRect(bounds); list->FillRect(bounds);
} }
@@ -139,18 +140,18 @@ InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete)
// Set the initial bounds of item contents // Set the initial bounds of item contents
BPoint iconPt = bounds.LeftTop(); BPoint iconPt = bounds.LeftTop();
BPoint namePt = bounds.LeftTop(); BPoint namePt = bounds.LeftTop();
BPoint v4addrPt = bounds.LeftTop(); BPoint line2Pt = bounds.LeftTop();
BPoint v6addrPt = bounds.LeftTop(); BPoint line3Pt = bounds.LeftTop();
BPoint statePt = bounds.RightTop(); BPoint statePt = bounds.RightTop();
iconPt += BPoint(4, 4); iconPt += BPoint(4, 4);
statePt += BPoint(0, fFirstlineOffset); statePt += BPoint(0, fFirstlineOffset);
namePt += BPoint(ICON_SIZE + 12, fFirstlineOffset); namePt += BPoint(ICON_SIZE + 12, fFirstlineOffset);
v4addrPt += BPoint(ICON_SIZE + 12, fSecondlineOffset); line2Pt += BPoint(ICON_SIZE + 12, fSecondlineOffset);
v6addrPt += BPoint(ICON_SIZE + 12, fThirdlineOffset); line3Pt += BPoint(ICON_SIZE + 12, fThirdlineOffset);
statePt statePt -= BPoint(
-= BPoint(be_plain_font->StringWidth(interfaceState.String()), 0); be_plain_font->StringWidth(interfaceState.String()) + 4.0f, 0);
if (fSettings->IsDisabled()) { if (fSettings->IsDisabled()) {
list->SetDrawingMode(B_OP_ALPHA); list->SetDrawingMode(B_OP_ALPHA);
@@ -162,46 +163,75 @@ InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete)
list->DrawBitmapAsync(fIcon, iconPt); list->DrawBitmapAsync(fIcon, iconPt);
list->DrawBitmapAsync(stateIcon, iconPt); list->DrawBitmapAsync(stateIcon, iconPt);
if (fSettings->IsDisabled()) if (fSettings->IsDisabled()) {
list->SetHighColor(tint_color(black, B_LIGHTEN_1_TINT)); rgb_color textColor;
else if (IsSelected())
list->SetHighColor(black); textColor = ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR);
else
textColor = ui_color(B_LIST_ITEM_TEXT_COLOR);
if (textColor.red + textColor.green + textColor.blue > 128 * 3)
list->SetHighColor(tint_color(textColor, B_DARKEN_1_TINT));
else
list->SetHighColor(tint_color(textColor, B_LIGHTEN_1_TINT));
} else {
if (IsSelected())
list->SetHighColor(ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR));
else
list->SetHighColor(ui_color(B_LIST_ITEM_TEXT_COLOR));
}
list->SetFont(be_bold_font); list->SetFont(be_bold_font);
list->DrawString(Name(), namePt); list->DrawString(Name(), namePt);
list->SetFont(be_plain_font); list->SetFont(be_plain_font);
list->DrawString(interfaceState, statePt); list->DrawString(interfaceState, statePt);
if (!fSettings->IsDisabled()) { if (!fSettings->IsDisabled()) {
// Render IPv4 Address // Render IPv4 Address
BString v4str("IPv4: "); BString ipv4Str(B_TRANSLATE_COMMENT("IP:", "IPv4 address label"));
if (fSettings->IPAddr(AF_INET).IsEmpty()) if (fSettings->IPAddr(AF_INET).IsEmpty())
v4str << "none"; ipv4Str << " " << B_TRANSLATE("None");
else {
v4str << fSettings->IP(AF_INET);
}
if (fSettings->AutoConfigure(AF_INET))
v4str << " (DHCP)";
else else
v4str << " (static)"; ipv4Str << " " << BString(fSettings->IP(AF_INET));
list->DrawString(v4str.String(), v4addrPt); list->DrawString(ipv4Str, line2Pt);
}
// Render IPv6 Address (if present)
if (!fSettings->IsDisabled()
&& !fSettings->IPAddr(AF_INET6).IsEmpty()) {
BString ipv6Str(B_TRANSLATE_COMMENT("IPv6:", "IPv6 address label"));
ipv6Str << " " << BString(fSettings->IP(AF_INET6));
// Render IPv6 Address (if present) list->DrawString(ipv6Str, line3Pt);
if (!fSettings->IPAddr(AF_INET6).IsEmpty()) {
BString v6str("IPv6: ");
v6str << fSettings->IP(AF_INET6);
list->DrawString(v6str, v6addrPt);
}
} }
owner->PopState(); owner->PopState();
} }
void
InterfaceListItem::Update(BView* owner, const BFont* font)
{
BListItem::Update(owner, font);
font_height height;
font->GetHeight(&height);
float lineHeight = ceilf(height.ascent) + ceilf(height.descent)
+ ceilf(height.leading);
fFirstlineOffset = 2 + ceilf(height.ascent + height.leading / 2);
fSecondlineOffset = fFirstlineOffset + lineHeight;
fThirdlineOffset = fFirstlineOffset + (lineHeight * 2);
SetHeight(max(3 * lineHeight + 4, fIcon->Bounds().Height() + 8));
// either to the text height or icon height, whichever is taller
}
// #pragma mark - InterfaceListItem private methods
void void
InterfaceListItem::_Init() InterfaceListItem::_Init()
{ {
@@ -299,17 +329,17 @@ InterfaceListItem::_PopulateBitmaps(const char* mediaType) {
0, B_RGBA32); 0, B_RGBA32);
BIconUtils::GetVectorIcon(onlineHVIF, iconSize, fIconOnline); BIconUtils::GetVectorIcon(onlineHVIF, iconSize, fIconOnline);
} }
} }
// #pragma mark - // #pragma mark - InterfaceListView
InterfacesListView::InterfacesListView(BRect rect, const char* name, uint32 resizingMode) InterfacesListView::InterfacesListView(const char* name)
: BListView(rect, name, B_SINGLE_SELECTION_LIST, resizingMode) :
BListView(name)
{ {
fContextMenu = new BPopUpMenu("context menu", false, false);
} }
@@ -318,6 +348,9 @@ InterfacesListView::~InterfacesListView()
} }
// #pragma mark - InterfaceListView protected methods
void void
InterfacesListView::AttachedToWindow() InterfacesListView::AttachedToWindow()
{ {
@@ -327,12 +360,16 @@ InterfacesListView::AttachedToWindow()
start_watching_network( start_watching_network(
B_WATCH_NETWORK_INTERFACE_CHANGES | B_WATCH_NETWORK_LINK_CHANGES, this); B_WATCH_NETWORK_INTERFACE_CHANGES | B_WATCH_NETWORK_LINK_CHANGES, this);
Select(0);
// Select the first item in the list
} }
void void
InterfacesListView::FrameResized(float width, float height) InterfacesListView::FrameResized(float width, float height)
{ {
BListView::FrameResized(width, height);
Invalidate(); Invalidate();
} }
@@ -345,9 +382,9 @@ InterfacesListView::DetachedFromWindow()
stop_watching_network(this); stop_watching_network(this);
// free all items, they will be retrieved again in AttachedToWindow() // free all items, they will be retrieved again in AttachedToWindow()
for (int32 i = CountItems(); i-- > 0;) { for (int32 i = CountItems(); i-- > 0;)
delete ItemAt(i); delete ItemAt(i);
}
MakeEmpty(); MakeEmpty();
} }
@@ -366,7 +403,77 @@ InterfacesListView::MessageReceived(BMessage* message)
} }
InterfaceListItem * void
InterfacesListView::MouseDown(BPoint where)
{
int32 buttons = 0;
Window()->CurrentMessage()->FindInt32("buttons", &buttons);
if ((B_SECONDARY_MOUSE_BUTTON & buttons) == 0) {
// If not secondary mouse button do the default
BListView::MouseDown(where);
return;
}
InterfaceListItem* item = FindItem(where);
if (item == NULL)
return;
// Remove all items from the menu
for (int32 i = fContextMenu->CountItems(); i >= 0; --i) {
BMenuItem* menuItem = fContextMenu->RemoveItem(i);
delete menuItem;
}
// Now add the ones we want
if (item->GetSettings()->IsDisabled()) {
fContextMenu->AddItem(new BMenuItem(B_TRANSLATE("Enable"),
new BMessage(kMsgInterfaceToggle)));
} else {
fContextMenu->AddItem(new BMenuItem(
B_TRANSLATE("Configure" B_UTF8_ELLIPSIS),
new BMessage(kMsgInterfaceConfigure)));
if (item->GetSettings()->AutoConfigure(AF_INET)
|| item->GetSettings()->AutoConfigure(AF_INET6)) {
fContextMenu->AddItem(new BMenuItem(
B_TRANSLATE("Renegotiate Address"),
new BMessage(kMsgInterfaceRenegotiate)));
}
fContextMenu->AddItem(new BSeparatorItem());
fContextMenu->AddItem(new BMenuItem(B_TRANSLATE("Disable"),
new BMessage(kMsgInterfaceToggle)));
}
fContextMenu->ResizeToPreferred();
BMenuItem* selected = fContextMenu->Go(ConvertToScreen(where));
if (selected == NULL)
return;
switch (selected->Message()->what) {
case kMsgInterfaceConfigure:
{
InterfaceWindow* win = new InterfaceWindow(item->GetSettings());
win->MoveTo(ConvertToScreen(where));
win->Show();
break;
}
case kMsgInterfaceToggle:
item->SetDisabled(!item->IsDisabled());
Invalidate();
break;
case kMsgInterfaceRenegotiate:
item->GetSettings()->RenegotiateAddresses();
break;
}
}
// #pragma mark - InterfaceListView public methods
InterfaceListItem*
InterfacesListView::FindItem(const char* name) InterfacesListView::FindItem(const char* name)
{ {
for (int32 i = CountItems(); i-- > 0;) { for (int32 i = CountItems(); i-- > 0;) {
@@ -382,6 +489,22 @@ InterfacesListView::FindItem(const char* name)
} }
InterfaceListItem*
InterfacesListView::FindItem(BPoint where)
{
for (int32 i = CountItems(); i-- > 0;) {
InterfaceListItem* item = dynamic_cast<InterfaceListItem*>(ItemAt(i));
if (item == NULL)
continue;
if (ItemFrame(i).Contains(where))
return item;
}
return NULL;
}
status_t status_t
InterfacesListView::SaveItems() InterfacesListView::SaveItems()
{ {
@@ -403,6 +526,9 @@ InterfacesListView::SaveItems()
} }
// #pragma mark - InterfaceListView private methods
status_t status_t
InterfacesListView::_InitList() InterfacesListView::_InitList()
{ {
@@ -411,9 +537,8 @@ InterfacesListView::_InitList()
uint32 cookie = 0; uint32 cookie = 0;
while (roster.GetNextInterface(&cookie, interface) == B_OK) { while (roster.GetNextInterface(&cookie, interface) == B_OK) {
if (strncmp(interface.Name(), "loop", 4) && interface.Name()[0]) { if (strncmp(interface.Name(), "loop", 4) && interface.Name()[0])
AddItem(new InterfaceListItem(interface.Name())); AddItem(new InterfaceListItem(interface.Name()));
}
} }
return B_OK; return B_OK;
@@ -447,29 +572,28 @@ InterfacesListView::_HandleNetworkMessage(BMessage* message)
return; return;
InterfaceListItem* item = FindItem(name); InterfaceListItem* item = FindItem(name);
if (!item) if (item == NULL)
printf("InterfaceListItem %s not found!\n", name); printf("InterfaceListItem %s not found!\n", name);
switch (opcode) { switch (opcode) {
case B_NETWORK_INTERFACE_CHANGED: case B_NETWORK_INTERFACE_CHANGED:
case B_NETWORK_DEVICE_LINK_CHANGED: case B_NETWORK_DEVICE_LINK_CHANGED:
if (item) if (item != NULL)
InvalidateItem(IndexOf(item)); InvalidateItem(IndexOf(item));
break; break;
case B_NETWORK_INTERFACE_ADDED: case B_NETWORK_INTERFACE_ADDED:
if (item) if (item != NULL)
InvalidateItem(IndexOf(item)); InvalidateItem(IndexOf(item));
else else
AddItem(new InterfaceListItem(name)); AddItem(new InterfaceListItem(name));
break; break;
case B_NETWORK_INTERFACE_REMOVED: case B_NETWORK_INTERFACE_REMOVED:
if (item) { if (item != NULL) {
RemoveItem(item); RemoveItem(item);
delete item; delete item;
} }
break; break;
} }
} }
@@ -1,35 +1,30 @@
/* /*
* Copyright 2004-2011 Haiku, Inc. All rights reserved. * Copyright 2004-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Alexander von Gluck, kallisti5@unixzen.com
* Philippe Houdoin * Philippe Houdoin
* Fredrik Modéen * Fredrik Modéen
* Alexander von Gluck, kallisti5@unixzen.com * John Scipione, jscipione@gmail.com
*/ */
#ifndef INTERFACES_LIST_VIEW_H #ifndef INTERFACES_LIST_VIEW_H
#define INTERFACES_LIST_VIEW_H #define INTERFACES_LIST_VIEW_H
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/if_types.h>
#include <Bitmap.h>
#include <ListView.h> #include <ListView.h>
#include <ListItem.h> #include <ListItem.h>
#include <MenuItem.h>
#include <NetworkDevice.h>
#include <NetworkInterface.h>
#include <PopUpMenu.h>
#include <String.h>
#include "NetworkSettings.h" #include "NetworkSettings.h"
#define ICON_SIZE 37 class BBitmap;
class BMenuItem;
class BNetworkInterface;
class BPoint;
class BPopUpMenu;
class BSeparatorItem;
class BString;
class InterfaceListItem : public BListItem { class InterfaceListItem : public BListItem {
public: public:
@@ -71,13 +66,11 @@ private:
class InterfacesListView : public BListView { class InterfacesListView : public BListView {
public: public:
InterfacesListView(BRect rect, const char* name, InterfacesListView(const char* name);
uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP);
virtual ~InterfacesListView(); virtual ~InterfacesListView();
InterfaceListItem* FindItem(const char* name); InterfaceListItem* FindItem(const char* name);
InterfaceListItem* FindItem(BPoint where);
status_t SaveItems(); status_t SaveItems();
protected: protected:
@@ -86,11 +79,16 @@ protected:
virtual void FrameResized(float width, float height); virtual void FrameResized(float width, float height);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint where);
private: private:
// Context menu
BPopUpMenu* fContextMenu;
status_t _InitList(); status_t _InitList();
status_t _UpdateList(); status_t _UpdateList();
void _HandleNetworkMessage(BMessage* message); void _HandleNetworkMessage(BMessage* message);
}; };
#endif /*INTERFACES_LIST_VIEW_H*/
#endif // INTERFACES_LIST_VIEW_H
@@ -34,3 +34,13 @@ Addon Interfaces :
$(HAIKU_LOCALE_LIBS) $(HAIKU_LOCALE_LIBS)
libicon.a libagg.a libicon.a libagg.a
; ;
DoCatalogs Interfaces :
x-vnd.Haiku-InterfacesAddOn
:
InterfacesAddOn.cpp
InterfacesListView.cpp
InterfaceWindow.cpp
InterfaceAddressView.cpp
InterfaceHardwareView.cpp
;
@@ -1,12 +1,13 @@
/* /*
* Copyright 2004-2011 Haiku, Inc. All rights reserved. * Copyright 2004-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Andre Alves Garzia, andre@andregarzia.com
* Axel Dörfler, axeld@pinc-software.de. * Axel Dörfler, axeld@pinc-software.de.
* Vegard Wærp, vegarwa@online.no * Andre Alves Garzia, andre@andregarzia.com
* Alexander von Gluck, kallisti5@unixzen.com * Alexander von Gluck, kallisti5@unixzen.com
* John Scipione, jscipione@gmail.com
* Vegard Wærp, vegarwa@online.no
*/ */
@@ -18,20 +19,17 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <resolv.h> #include <resolv.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/sockio.h> #include <sys/sockio.h>
#include <unistd.h> #include <unistd.h>
#include <AutoDeleter.h>
#include <driver_settings.h> #include <driver_settings.h>
#include <File.h> #include <File.h>
#include <FindDirectory.h> #include <FindDirectory.h>
#include <Path.h> #include <Path.h>
#include <String.h> #include <String.h>
#include <AutoDeleter.h>
NetworkSettings::NetworkSettings(const char* name) NetworkSettings::NetworkSettings(const char* name)
: :
@@ -353,3 +351,14 @@ NetworkSettings::RenegotiateAddresses()
return B_OK; return B_OK;
} }
const char*
NetworkSettings::HardwareAddress()
{
BNetworkAddress macAddress;
if (fNetworkInterface->GetHardwareAddress(macAddress) == B_OK)
return macAddress.ToString();
return NULL;
}
@@ -1,22 +1,22 @@
/* /*
* Copyright 2004-2010 Haiku, Inc. All rights reserved. * Copyright 2004-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Andre Alves Garzia, andre@andregarzia.com * Andre Alves Garzia, andre@andregarzia.com
* Vegard Wærp, vegarwa@online.no
* Alexander von Gluck, kallisti5@unixzen.com * Alexander von Gluck, kallisti5@unixzen.com
* John Scipione, jscipione@gmail.com
* Vegard Wærp, vegarwa@online.no
*/ */
#ifndef SETTINGS_H #ifndef SETTINGS_H
#define SETTINGS_H #define SETTINGS_H
#include <map>
#include <ObjectList.h>
#include <NetworkDevice.h> #include <NetworkDevice.h>
#include <NetworkInterface.h> #include <NetworkInterface.h>
#include <ObjectList.h>
#include <String.h>
#include <map>
#define MAX_PROTOCOLS 7 #define MAX_PROTOCOLS 7
@@ -39,6 +39,8 @@ typedef struct _protocols {
} protocols; } protocols;
class BString;
class NetworkSettings { class NetworkSettings {
public: public:
NetworkSettings(const char* name); NetworkSettings(const char* name);
@@ -48,11 +50,11 @@ public:
{ return fProtocols; } { return fProtocols; }
void SetIP(int family, const char* ip) void SetIP(int family, const char* ip)
{ fAddress[family].SetTo(ip); } { fAddress[family].SetTo(family, ip); }
void SetNetmask(int family, const char* mask) void SetNetmask(int family, const char* mask)
{ fNetmask[family].SetTo(mask); } { fNetmask[family].SetTo(family, mask); }
void SetGateway(int family, const char* ip) void SetGateway(int family, const char* ip)
{ fGateway[family].SetTo(ip); } { fGateway[family].SetTo(family, ip); }
void SetAutoConfigure(int family, bool autoConf) void SetAutoConfigure(int family, bool autoConf)
{ fAutoConfigure[family] = autoConf; } { fAutoConfigure[family] = autoConf; }
@@ -64,7 +66,6 @@ public:
// void SetDomain(const BString& domain) // void SetDomain(const BString& domain)
// { fDomain = domain; } // { fDomain = domain; }
bool AutoConfigure(int family) bool AutoConfigure(int family)
{ return fAutoConfigure[family]; } { return fAutoConfigure[family]; }
BNetworkAddress IPAddr(int family) BNetworkAddress IPAddr(int family)
@@ -91,6 +92,8 @@ public:
bool HasLink() { bool HasLink() {
return fNetworkDevice->HasLink(); } return fNetworkDevice->HasLink(); }
const char* HardwareAddress();
const BString& WirelessNetwork() { return fWirelessNetwork; } const BString& WirelessNetwork() { return fWirelessNetwork; }
BObjectList<BString>& NameServers() { return fNameServers; } BObjectList<BString>& NameServers() { return fNameServers; }
@@ -128,4 +131,4 @@ private:
}; };
#endif /* SETTINGS_H */ #endif // SETTINGS_H
+3 -3
View File
@@ -10,7 +10,7 @@ Preference NetworkSetup :
; ;
SubInclude HAIKU_TOP src tests kits net preflet InterfacesAddOn ; SubInclude HAIKU_TOP src tests kits net preflet InterfacesAddOn ;
SubInclude HAIKU_TOP src tests kits net preflet ServicesAddOn ; #SubInclude HAIKU_TOP src tests kits net preflet ServicesAddOn ;
SubInclude HAIKU_TOP src tests kits net preflet DummyAddOn ; #SubInclude HAIKU_TOP src tests kits net preflet DummyAddOn ;
SubInclude HAIKU_TOP src tests kits net preflet MultipleAddOns ; #SubInclude HAIKU_TOP src tests kits net preflet MultipleAddOns ;
# SubInclude HAIKU_TOP src tests kits net preflet DialUpAddOn ; # SubInclude HAIKU_TOP src tests kits net preflet DialUpAddOn ;
@@ -11,6 +11,7 @@
#include <Application.h> #include <Application.h>
#include <Catalog.h> #include <Catalog.h>
#include <ControlLook.h>
#include <GroupLayout.h> #include <GroupLayout.h>
#include <GroupLayoutBuilder.h> #include <GroupLayoutBuilder.h>
#include <InterfaceKit.h> #include <InterfaceKit.h>
@@ -50,46 +51,43 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
fPanel = new BTabView("showview_box"); fPanel = new BTabView("showview_box");
// ---- Bottom globals buttons section
BBox *bottomDivider = new BBox(B_EMPTY_STRING);
bottomDivider->SetBorder(B_PLAIN_BORDER);
fApplyButton = new BButton("apply", B_TRANSLATE("Apply"), fApplyButton = new BButton("apply", B_TRANSLATE("Apply"),
new BMessage(kMsgApply)); new BMessage(kMsgApply));
SetDefaultButton(fApplyButton);
fRevertButton = new BButton("revert", B_TRANSLATE("Revert"), fRevertButton = new BButton("revert", B_TRANSLATE("Revert"),
new BMessage(kMsgRevert)); new BMessage(kMsgRevert));
// fRevertButton->SetEnabled(false); // fRevertButton->SetEnabled(false);
// Enable boxes resizing modes // Enable boxes resizing modes
fPanel->SetResizingMode(B_FOLLOW_ALL); //fPanel->SetResizingMode(B_FOLLOW_ALL);
// Build the layout // Build the layout
SetLayout(new BGroupLayout(B_VERTICAL)); SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) AddChild(BGroupLayoutBuilder(B_VERTICAL, B_USE_SMALL_SPACING)
.AddGroup(B_HORIZONTAL, 5) .AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING)
.Add(profilesMenuField) .Add(profilesMenuField)
.AddGlue() .AddGlue()
.End() .End()
.Add(fPanel) .Add(fPanel)
.Add(bottomDivider) .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
.AddGroup(B_HORIZONTAL, 5)
.AddGlue()
.Add(fRevertButton) .Add(fRevertButton)
.AddGlue()
.Add(fApplyButton) .Add(fApplyButton)
.End() .End()
.SetInsets(10, 10, 10, 10) .SetInsets(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING,
B_USE_SMALL_SPACING, B_USE_SMALL_SPACING)
); );
_BuildShowTabView(kMsgAddonShow); _BuildShowTabView(kMsgAddonShow);
bottomDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(), fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(),
fMinAddonViewRect.Height())); fMinAddonViewRect.Height()));
fAddonView = NULL; fAddonView = NULL;
CenterOnScreen();
} }
@@ -243,7 +241,11 @@ NetworkSetupWindow::_BuildShowTabView(int32 msg_what)
if (!search_paths) if (!search_paths)
return; return;
fMinAddonViewRect.Set(0, 0, 375, 225); // Minimum size float minimumWidth = be_control_look->DefaultItemSpacing() * 37;
float minimumHight = be_control_look->DefaultItemSpacing() * 25;
fMinAddonViewRect.Set(0, 0, minimumWidth, minimumHight);
// Minimum size
search_paths = strdup(search_paths); search_paths = strdup(search_paths);
char* next_path_token; char* next_path_token;
@@ -287,37 +289,37 @@ NetworkSetupWindow::_BuildShowTabView(int32 msg_what)
int tabCount = 0; int tabCount = 0;
if (status == B_OK) { if (status != B_OK) {
while ((fNetworkAddOnMap[fAddonCount] // No "addon instantiate function" symbol found in this addon
= get_nth_addon(addon_id, tabCount)) != NULL) { printf("No symbol \"get_nth_addon\" found in %s addon: not a "
printf("Adding Tab: %d\n", fAddonCount); "network setup addon!\n", addon_path.Path());
BMessage* msg = new BMessage(msg_what); unload_add_on(addon_id);
BRect r(0, 0, 0, 0);
BView* addon_view
= fNetworkAddOnMap[fAddonCount]->CreateView(&r);
fMinAddonViewRect = fMinAddonViewRect | r;
msg->AddInt32("image_id", addon_id);
msg->AddString("addon_path", addon_path.Path());
msg->AddPointer("addon", fNetworkAddOnMap[fAddonCount]);
msg->AddPointer("addon_view", addon_view);
BTab *tab = new BTab;
fPanel->AddTab(addon_view, tab);
tab->SetLabel(fNetworkAddOnMap[fAddonCount]->Name());
fAddonCount++;
// Number of tab addons total
tabCount++;
// Tabs for *this* addon
}
continue; continue;
} }
// No "addon instantiate function" symbol found in this addon while ((fNetworkAddOnMap[fAddonCount]
printf("No symbol \"get_nth_addon\" found in %s addon: not a " = get_nth_addon(addon_id, tabCount)) != NULL) {
"network setup addon!\n", addon_path.Path()); printf("Adding Tab: %d\n", fAddonCount);
unload_add_on(addon_id); BMessage* msg = new BMessage(msg_what);
BRect r(0, 0, 0, 0);
BView* addon_view
= fNetworkAddOnMap[fAddonCount]->CreateView(&r);
fMinAddonViewRect = fMinAddonViewRect | r;
msg->AddInt32("image_id", addon_id);
msg->AddString("addon_path", addon_path.Path());
msg->AddPointer("addon", fNetworkAddOnMap[fAddonCount]);
msg->AddPointer("addon_view", addon_view);
BTab* tab = new BTab;
fPanel->AddTab(addon_view, tab);
tab->SetLabel(fNetworkAddOnMap[fAddonCount]->Name());
fAddonCount++;
// Number of tab addons total
tabCount++;
// Tabs for *this* addon
}
} }
} }