More or less rewrote the font preferences panel:
* no more "Rescan" button (although the font list is never updated yet) * completely font sensitive * centers window on screen if settings are invalid or not existing * now updates the system fonts instantly, and not when you close the app * added author list, although I am not sure who actually initially wrote it (our CVS history unfortunately doesn't reach that far) * major cleanup * removed unused stuff * and more. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14802 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,691 +0,0 @@
|
|||||||
# Doxyfile 1.2.1
|
|
||||||
|
|
||||||
# This file describes the settings to be used by doxygen for a project
|
|
||||||
#
|
|
||||||
# All text after a hash (#) is considered a comment and will be ignored
|
|
||||||
# The format is:
|
|
||||||
# TAG = value [value, ...]
|
|
||||||
# For lists items can also be appended using:
|
|
||||||
# TAG += value [value, ...]
|
|
||||||
# Values that contain spaces should be placed between quotes (" ")
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# General configuration options
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
|
|
||||||
# by quotes) that should identify the project.
|
|
||||||
|
|
||||||
PROJECT_NAME = "Fonts Preferences App"
|
|
||||||
|
|
||||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
|
|
||||||
# This could be handy for archiving the generated documentation or
|
|
||||||
# if some version control system is used.
|
|
||||||
|
|
||||||
PROJECT_NUMBER = 1
|
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
|
||||||
# base path where the generated documentation will be put.
|
|
||||||
# If a relative path is entered, it will be relative to the location
|
|
||||||
# where doxygen was started. If left blank the current directory will be used.
|
|
||||||
|
|
||||||
OUTPUT_DIRECTORY = ../docs/api/
|
|
||||||
|
|
||||||
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
|
|
||||||
# documentation generated by doxygen is written. Doxygen will use this
|
|
||||||
# information to generate all constant output in the proper language.
|
|
||||||
# The default language is English, other supported languages are:
|
|
||||||
# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese,
|
|
||||||
# Spanish, Russian, Croatian, Polish, and Portuguese.
|
|
||||||
|
|
||||||
OUTPUT_LANGUAGE = English
|
|
||||||
|
|
||||||
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
|
|
||||||
# documentation are documented, even if no documentation was available.
|
|
||||||
# Private class members and static file members will be hidden unless
|
|
||||||
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
|
|
||||||
|
|
||||||
EXTRACT_ALL = YES
|
|
||||||
|
|
||||||
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
|
|
||||||
# will be included in the documentation.
|
|
||||||
|
|
||||||
EXTRACT_PRIVATE = YES
|
|
||||||
|
|
||||||
# If the EXTRACT_STATIC tag is set to YES all static members of a file
|
|
||||||
# will be included in the documentation.
|
|
||||||
|
|
||||||
EXTRACT_STATIC = YES
|
|
||||||
|
|
||||||
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
|
|
||||||
# undocumented members of documented classes, files or namespaces.
|
|
||||||
# If set to NO (the default) these members will be included in the
|
|
||||||
# various overviews, but no documentation section is generated.
|
|
||||||
# This option has no effect if EXTRACT_ALL is enabled.
|
|
||||||
|
|
||||||
HIDE_UNDOC_MEMBERS = NO
|
|
||||||
|
|
||||||
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
|
|
||||||
# undocumented classes that are normally visible in the class hierarchy.
|
|
||||||
# If set to NO (the default) these class will be included in the various
|
|
||||||
# overviews. This option has no effect if EXTRACT_ALL is enabled.
|
|
||||||
|
|
||||||
HIDE_UNDOC_CLASSES = NO
|
|
||||||
|
|
||||||
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
|
|
||||||
# include brief member descriptions after the members that are listed in
|
|
||||||
# the file and class documentation (similar to JavaDoc).
|
|
||||||
# Set to NO to disable this.
|
|
||||||
|
|
||||||
BRIEF_MEMBER_DESC = YES
|
|
||||||
|
|
||||||
# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
|
|
||||||
# the brief description of a member or function before the detailed description.
|
|
||||||
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
|
|
||||||
# brief descriptions will be completely suppressed.
|
|
||||||
|
|
||||||
REPEAT_BRIEF = YES
|
|
||||||
|
|
||||||
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
|
|
||||||
# Doxygen will generate a detailed section even if there is only a brief
|
|
||||||
# description.
|
|
||||||
|
|
||||||
ALWAYS_DETAILED_SEC = YES
|
|
||||||
|
|
||||||
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
|
|
||||||
# path before files name in the file list and in the header files. If set
|
|
||||||
# to NO the shortest path that makes the file name unique will be used.
|
|
||||||
|
|
||||||
FULL_PATH_NAMES = NO
|
|
||||||
|
|
||||||
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
|
|
||||||
# can be used to strip a user defined part of the path. Stripping is
|
|
||||||
# only done if one of the specified strings matches the left-hand part of
|
|
||||||
# the path. It is allowed to use relative paths in the argument list.
|
|
||||||
|
|
||||||
STRIP_FROM_PATH =
|
|
||||||
|
|
||||||
# The INTERNAL_DOCS tag determines if documentation
|
|
||||||
# that is typed after a \internal command is included. If the tag is set
|
|
||||||
# to NO (the default) then the documentation will be excluded.
|
|
||||||
# Set it to YES to include the internal documentation.
|
|
||||||
|
|
||||||
INTERNAL_DOCS = NO
|
|
||||||
|
|
||||||
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
|
|
||||||
# generate a class diagram (in Html and LaTeX) for classes with base or
|
|
||||||
# super classes. Setting the tag to NO turns the diagrams off.
|
|
||||||
|
|
||||||
CLASS_DIAGRAMS = YES
|
|
||||||
|
|
||||||
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
|
|
||||||
# be generated. Documented entities will be cross-referenced with these sources.
|
|
||||||
|
|
||||||
SOURCE_BROWSER = YES
|
|
||||||
|
|
||||||
# Setting the INLINE_SOURCES tag to YES will include the body
|
|
||||||
# of functions and classes directly in the documentation.
|
|
||||||
|
|
||||||
INLINE_SOURCES = NO
|
|
||||||
|
|
||||||
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
|
|
||||||
# doxygen to hide any special comment blocks from generated source code
|
|
||||||
# fragments. Normal C and C++ comments will always remain visible.
|
|
||||||
|
|
||||||
STRIP_CODE_COMMENTS = YES
|
|
||||||
|
|
||||||
# If the CASE_SENSE_NAMES tag is set to NO (the default) then Doxygen
|
|
||||||
# will only generate file names in lower case letters. If set to
|
|
||||||
# YES upper case letters are also allowed. This is useful if you have
|
|
||||||
# classes or files whose names only differ in case and if your file system
|
|
||||||
# supports case sensitive file names.
|
|
||||||
|
|
||||||
CASE_SENSE_NAMES = YES
|
|
||||||
|
|
||||||
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
|
|
||||||
# will show members with their full class and namespace scopes in the
|
|
||||||
# documentation. If set to YES the scope will be hidden.
|
|
||||||
|
|
||||||
HIDE_SCOPE_NAMES = NO
|
|
||||||
|
|
||||||
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
|
|
||||||
# will generate a verbatim copy of the header file for each class for
|
|
||||||
# which an include is specified. Set to NO to disable this.
|
|
||||||
|
|
||||||
VERBATIM_HEADERS = YES
|
|
||||||
|
|
||||||
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
|
|
||||||
# will put list of the files that are included by a file in the documentation
|
|
||||||
# of that file.
|
|
||||||
|
|
||||||
SHOW_INCLUDE_FILES = YES
|
|
||||||
|
|
||||||
# If the JAVADOC_AUTOBRIEF tag is set to YES (the default) then Doxygen
|
|
||||||
# will interpret the first line (until the first dot) of a JavaDoc-style
|
|
||||||
# comment as the brief description. If set to NO, the Javadoc-style will
|
|
||||||
# behave just like the Qt-style comments.
|
|
||||||
|
|
||||||
JAVADOC_AUTOBRIEF = YES
|
|
||||||
|
|
||||||
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
|
|
||||||
# member inherits the documentation from any documented member that it
|
|
||||||
# reimplements.
|
|
||||||
|
|
||||||
INHERIT_DOCS = YES
|
|
||||||
|
|
||||||
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
|
|
||||||
# is inserted in the documentation for inline members.
|
|
||||||
|
|
||||||
INLINE_INFO = YES
|
|
||||||
|
|
||||||
# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
|
|
||||||
# will sort the (detailed) documentation of file and class members
|
|
||||||
# alphabetically by member name. If set to NO the members will appear in
|
|
||||||
# declaration order.
|
|
||||||
|
|
||||||
SORT_MEMBER_DOCS = YES
|
|
||||||
|
|
||||||
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
|
|
||||||
# Doxygen uses this value to replace tabs by spaces in code fragments.
|
|
||||||
|
|
||||||
TAB_SIZE = 4
|
|
||||||
|
|
||||||
# The ENABLE_SECTIONS tag can be used to enable conditional
|
|
||||||
# documentation sections, marked by \if sectionname ... \endif.
|
|
||||||
|
|
||||||
ENABLED_SECTIONS =
|
|
||||||
|
|
||||||
# The GENERATE_TODOLIST tag can be used to enable (YES) or
|
|
||||||
# disable (NO) the todo list. This list is created by putting \todo
|
|
||||||
# commands in the documentation.
|
|
||||||
|
|
||||||
GENERATE_TODOLIST = YES
|
|
||||||
|
|
||||||
# The GENERATE_TESTLIST tag can be used to enable (YES) or
|
|
||||||
# disable (NO) the test list. This list is created by putting \test
|
|
||||||
# commands in the documentation.
|
|
||||||
|
|
||||||
GENERATE_TESTLIST = YES
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to warning and progress messages
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# The QUIET tag can be used to turn on/off the messages that are generated
|
|
||||||
# by doxygen. Possible values are YES and NO. If left blank NO is used.
|
|
||||||
|
|
||||||
QUIET = NO
|
|
||||||
|
|
||||||
# The WARNINGS tag can be used to turn on/off the warning messages that are
|
|
||||||
# generated by doxygen. Possible values are YES and NO. If left blank
|
|
||||||
# NO is used.
|
|
||||||
|
|
||||||
WARNINGS = YES
|
|
||||||
|
|
||||||
# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
|
|
||||||
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
|
|
||||||
# automatically be disabled.
|
|
||||||
|
|
||||||
WARN_IF_UNDOCUMENTED = YES
|
|
||||||
|
|
||||||
# The WARN_FORMAT tag determines the format of the warning messages that
|
|
||||||
# doxygen can produce. The string should contain the $file, $line, and $text
|
|
||||||
# tags, which will be replaced by the file and line number from which the
|
|
||||||
# warning originated and the warning text.
|
|
||||||
|
|
||||||
WARN_FORMAT = "$file:$line: $text"
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the input files
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# The INPUT tag can be used to specify the files and/or directories that contain
|
|
||||||
# documented source files. You may enter file names like "myfile.cpp" or
|
|
||||||
# directories like "/usr/src/myproject". Separate the files or directories
|
|
||||||
# with spaces.
|
|
||||||
|
|
||||||
INPUT = .
|
|
||||||
|
|
||||||
# If the value of the INPUT tag contains directories, you can use the
|
|
||||||
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
|
||||||
# and *.h) to filter out the source-files in the directories. If left
|
|
||||||
# blank all files are included.
|
|
||||||
|
|
||||||
FILE_PATTERNS = *.cpp *.h
|
|
||||||
|
|
||||||
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
|
|
||||||
# should be searched for input files as well. Possible values are YES and NO.
|
|
||||||
# If left blank NO is used.
|
|
||||||
|
|
||||||
RECURSIVE = NO
|
|
||||||
|
|
||||||
# The EXCLUDE tag can be used to specify files and/or directories that should
|
|
||||||
# excluded from the INPUT source files. This way you can easily exclude a
|
|
||||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
|
||||||
|
|
||||||
EXCLUDE =
|
|
||||||
|
|
||||||
# If the value of the INPUT tag contains directories, you can use the
|
|
||||||
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
|
|
||||||
# certain files from those directories.
|
|
||||||
|
|
||||||
EXCLUDE_PATTERNS =
|
|
||||||
|
|
||||||
# The EXAMPLE_PATH tag can be used to specify one or more files or
|
|
||||||
# directories that contain example code fragments that are included (see
|
|
||||||
# the \include command).
|
|
||||||
|
|
||||||
EXAMPLE_PATH =
|
|
||||||
|
|
||||||
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
|
||||||
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
|
||||||
# and *.h) to filter out the source-files in the directories. If left
|
|
||||||
# blank all files are included.
|
|
||||||
|
|
||||||
EXAMPLE_PATTERNS =
|
|
||||||
|
|
||||||
# The IMAGE_PATH tag can be used to specify one or more files or
|
|
||||||
# directories that contain image that are included in the documentation (see
|
|
||||||
# the \image command).
|
|
||||||
|
|
||||||
IMAGE_PATH =
|
|
||||||
|
|
||||||
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
|
||||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
|
||||||
# by executing (via popen()) the command <filter> <input-file>, where <filter>
|
|
||||||
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
|
|
||||||
# input file. Doxygen will then use the output that the filter program writes
|
|
||||||
# to standard output.
|
|
||||||
|
|
||||||
INPUT_FILTER =
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the alphabetical class index
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
|
|
||||||
# of all compounds will be generated. Enable this if the project
|
|
||||||
# contains a lot of classes, structs, unions or interfaces.
|
|
||||||
|
|
||||||
ALPHABETICAL_INDEX = YES
|
|
||||||
|
|
||||||
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
|
|
||||||
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
|
|
||||||
# in which this list will be split (can be a number in the range [1..20])
|
|
||||||
|
|
||||||
COLS_IN_ALPHA_INDEX = 5
|
|
||||||
|
|
||||||
# In case all classes in a project start with a common prefix, all
|
|
||||||
# classes will be put under the same header in the alphabetical index.
|
|
||||||
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
|
|
||||||
# should be ignored while generating the index headers.
|
|
||||||
|
|
||||||
IGNORE_PREFIX =
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the HTML output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
|
|
||||||
# generate HTML output.
|
|
||||||
|
|
||||||
GENERATE_HTML = YES
|
|
||||||
|
|
||||||
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
|
|
||||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
|
||||||
# put in front of it. If left blank `html' will be used as the default path.
|
|
||||||
|
|
||||||
HTML_OUTPUT =
|
|
||||||
|
|
||||||
# The HTML_HEADER tag can be used to specify a personal HTML header for
|
|
||||||
# each generated HTML page. If it is left blank doxygen will generate a
|
|
||||||
# standard header.
|
|
||||||
|
|
||||||
HTML_HEADER =
|
|
||||||
|
|
||||||
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
|
|
||||||
# each generated HTML page. If it is left blank doxygen will generate a
|
|
||||||
# standard footer.
|
|
||||||
|
|
||||||
HTML_FOOTER =
|
|
||||||
|
|
||||||
# The HTML_STYLESHEET tag can be used to specify a user defined cascading
|
|
||||||
# style sheet that is used by each HTML page. It can be used to
|
|
||||||
# fine-tune the look of the HTML output. If the tag is left blank doxygen
|
|
||||||
# will generate a default style sheet
|
|
||||||
|
|
||||||
HTML_STYLESHEET =
|
|
||||||
|
|
||||||
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
|
|
||||||
# files or namespaces will be aligned in HTML using tables. If set to
|
|
||||||
# NO a bullet list will be used.
|
|
||||||
|
|
||||||
HTML_ALIGN_MEMBERS = YES
|
|
||||||
|
|
||||||
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
|
|
||||||
# will be generated that can be used as input for tools like the
|
|
||||||
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
|
|
||||||
# of the generated HTML documentation.
|
|
||||||
|
|
||||||
GENERATE_HTMLHELP = NO
|
|
||||||
|
|
||||||
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
|
|
||||||
# top of each HTML page. The value NO (the default) enables the index and
|
|
||||||
# the value YES disables it.
|
|
||||||
|
|
||||||
DISABLE_INDEX = NO
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the LaTeX output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
|
|
||||||
# generate Latex output.
|
|
||||||
|
|
||||||
GENERATE_LATEX = NO
|
|
||||||
|
|
||||||
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
|
|
||||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
|
||||||
# put in front of it. If left blank `latex' will be used as the default path.
|
|
||||||
|
|
||||||
LATEX_OUTPUT = latex
|
|
||||||
|
|
||||||
# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
|
|
||||||
# LaTeX documents. This may be useful for small projects and may help to
|
|
||||||
# save some trees in general.
|
|
||||||
|
|
||||||
COMPACT_LATEX = NO
|
|
||||||
|
|
||||||
# The PAPER_TYPE tag can be used to set the paper type that is used
|
|
||||||
# by the printer. Possible values are: a4, a4wide, letter, legal and
|
|
||||||
# executive. If left blank a4wide will be used.
|
|
||||||
|
|
||||||
PAPER_TYPE = a4wide
|
|
||||||
|
|
||||||
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
|
|
||||||
# packages that should be included in the LaTeX output.
|
|
||||||
|
|
||||||
EXTRA_PACKAGES =
|
|
||||||
|
|
||||||
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
|
|
||||||
# the generated latex document. The header should contain everything until
|
|
||||||
# the first chapter. If it is left blank doxygen will generate a
|
|
||||||
# standard header. Notice: only use this tag if you know what you are doing!
|
|
||||||
|
|
||||||
LATEX_HEADER =
|
|
||||||
|
|
||||||
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
|
|
||||||
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
|
|
||||||
# contain links (just like the HTML output) instead of page references
|
|
||||||
# This makes the output suitable for online browsing using a pdf viewer.
|
|
||||||
|
|
||||||
PDF_HYPERLINKS = NO
|
|
||||||
|
|
||||||
# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
|
|
||||||
# plain latex in the generated Makefile. Set this option to YES to get a
|
|
||||||
# higher quality PDF documentation.
|
|
||||||
|
|
||||||
USE_PDFLATEX = NO
|
|
||||||
|
|
||||||
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
|
|
||||||
# command to the generated LaTeX files. This will instruct LaTeX to keep
|
|
||||||
# running if errors occur, instead of asking the user for help.
|
|
||||||
# This option is also used when generating formulas in HTML.
|
|
||||||
|
|
||||||
LATEX_BATCHMODE = NO
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the RTF output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
|
|
||||||
# The RTF output is optimised for Word 97 and may not look very pretty with
|
|
||||||
# other RTF readers or editors.
|
|
||||||
|
|
||||||
GENERATE_RTF = NO
|
|
||||||
|
|
||||||
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
|
|
||||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
|
||||||
# put in front of it. If left blank `rtf' will be used as the default path.
|
|
||||||
|
|
||||||
RTF_OUTPUT = rtf
|
|
||||||
|
|
||||||
# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
|
|
||||||
# RTF documents. This may be useful for small projects and may help to
|
|
||||||
# save some trees in general.
|
|
||||||
|
|
||||||
COMPACT_RTF = NO
|
|
||||||
|
|
||||||
# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
|
|
||||||
# will contain hyperlink fields. The RTF file will
|
|
||||||
# contain links (just like the HTML output) instead of page references.
|
|
||||||
# This makes the output suitable for online browsing using a WORD or other.
|
|
||||||
# programs which support those fields.
|
|
||||||
# Note: wordpad (write) and others do not support links.
|
|
||||||
|
|
||||||
RTF_HYPERLINKS = NO
|
|
||||||
|
|
||||||
# Load stylesheet definitions from file. Syntax is similar to doxygen's
|
|
||||||
# config file, i.e. a series of assigments. You only have to provide
|
|
||||||
# replacements, missing definitions are set to their default value.
|
|
||||||
|
|
||||||
RTF_STYLESHEET_FILE =
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the man page output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
|
|
||||||
# generate man pages
|
|
||||||
|
|
||||||
GENERATE_MAN = NO
|
|
||||||
|
|
||||||
# The MAN_OUTPUT tag is used to specify where the man pages will be put.
|
|
||||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
|
||||||
# put in front of it. If left blank `man' will be used as the default path.
|
|
||||||
|
|
||||||
MAN_OUTPUT = man
|
|
||||||
|
|
||||||
# The MAN_EXTENSION tag determines the extension that is added to
|
|
||||||
# the generated man pages (default is the subroutine's section .3)
|
|
||||||
|
|
||||||
MAN_EXTENSION = .3
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# configuration options related to the XML output
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# If the GENERATE_XML tag is set to YES Doxygen will
|
|
||||||
# generate an XML file that captures the structure of
|
|
||||||
# the code including all documentation. Warning: This feature
|
|
||||||
# is still experimental and very incomplete.
|
|
||||||
|
|
||||||
GENERATE_XML = NO
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Configuration options related to the preprocessor
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
|
|
||||||
# evaluate all C-preprocessor directives found in the sources and include
|
|
||||||
# files.
|
|
||||||
|
|
||||||
ENABLE_PREPROCESSING = YES
|
|
||||||
|
|
||||||
# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
|
|
||||||
# names in the source code. If set to NO (the default) only conditional
|
|
||||||
# compilation will be performed. Macro expansion can be done in a controlled
|
|
||||||
# way by setting EXPAND_ONLY_PREDEF to YES.
|
|
||||||
|
|
||||||
MACRO_EXPANSION = NO
|
|
||||||
|
|
||||||
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
|
|
||||||
# then the macro expansion is limited to the macros specified with the
|
|
||||||
# PREDEFINED and EXPAND_AS_PREDEFINED tags.
|
|
||||||
|
|
||||||
EXPAND_ONLY_PREDEF = NO
|
|
||||||
|
|
||||||
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
|
|
||||||
# in the INCLUDE_PATH (see below) will be search if a #include is found.
|
|
||||||
|
|
||||||
SEARCH_INCLUDES = YES
|
|
||||||
|
|
||||||
# The INCLUDE_PATH tag can be used to specify one or more directories that
|
|
||||||
# contain include files that are not input files but should be processed by
|
|
||||||
# the preprocessor.
|
|
||||||
|
|
||||||
INCLUDE_PATH =
|
|
||||||
|
|
||||||
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
|
|
||||||
# patterns (like *.h and *.hpp) to filter out the header-files in the
|
|
||||||
# directories. If left blank, the patterns specified with FILE_PATTERNS will
|
|
||||||
# be used.
|
|
||||||
|
|
||||||
INCLUDE_FILE_PATTERNS =
|
|
||||||
|
|
||||||
# The PREDEFINED tag can be used to specify one or more macro names that
|
|
||||||
# are defined before the preprocessor is started (similar to the -D option of
|
|
||||||
# gcc). The argument of the tag is a list of macros of the form: name
|
|
||||||
# or name=definition (no spaces). If the definition and the = are
|
|
||||||
# omitted =1 is assumed.
|
|
||||||
|
|
||||||
PREDEFINED =
|
|
||||||
|
|
||||||
# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
|
|
||||||
# this tag can be used to specify a list of macro names that should be expanded.
|
|
||||||
# The macro definition that is found in the sources will be used.
|
|
||||||
# Use the PREDEFINED tag if you want to use a different macro definition.
|
|
||||||
|
|
||||||
EXPAND_AS_DEFINED =
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Configuration::addtions related to external references
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# The TAGFILES tag can be used to specify one or more tagfiles.
|
|
||||||
|
|
||||||
TAGFILES =
|
|
||||||
|
|
||||||
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
|
|
||||||
# a tag file that is based on the input files it reads.
|
|
||||||
|
|
||||||
GENERATE_TAGFILE =
|
|
||||||
|
|
||||||
# If the ALLEXTERNALS tag is set to YES all external classes will be listed
|
|
||||||
# in the class index. If set to NO only the inherited external classes
|
|
||||||
# will be listed.
|
|
||||||
|
|
||||||
ALLEXTERNALS = NO
|
|
||||||
|
|
||||||
# The PERL_PATH should be the absolute path and name of the perl script
|
|
||||||
# interpreter (i.e. the result of `which perl').
|
|
||||||
|
|
||||||
PERL_PATH = /usr/bin/perl
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Configuration options related to the dot tool
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
|
|
||||||
# available from the path. This tool is part of Graphviz, a graph visualization
|
|
||||||
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
|
|
||||||
# have no effect if this option is set to NO (the default)
|
|
||||||
|
|
||||||
HAVE_DOT = YES
|
|
||||||
|
|
||||||
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
|
|
||||||
# will generate a graph for each documented class showing the direct and
|
|
||||||
# indirect inheritance relations. Setting this tag to YES will force the
|
|
||||||
# the CLASS_DIAGRAMS tag to NO.
|
|
||||||
|
|
||||||
CLASS_GRAPH = YES
|
|
||||||
|
|
||||||
# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
|
|
||||||
# will generate a graph for each documented class showing the direct and
|
|
||||||
# indirect implementation dependencies (inheritance, containment, and
|
|
||||||
# class references variables) of the class with other documented classes.
|
|
||||||
|
|
||||||
COLLABORATION_GRAPH = YES
|
|
||||||
|
|
||||||
# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to
|
|
||||||
# YES then doxygen will generate a graph for each documented file showing
|
|
||||||
# the direct and indirect include dependencies of the file with other
|
|
||||||
# documented files.
|
|
||||||
|
|
||||||
INCLUDE_GRAPH = YES
|
|
||||||
|
|
||||||
# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to
|
|
||||||
# YES then doxygen will generate a graph for each documented header file showing
|
|
||||||
# the documented files that directly or indirectly include this file
|
|
||||||
|
|
||||||
INCLUDED_BY_GRAPH = YES
|
|
||||||
|
|
||||||
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
|
|
||||||
# will graphical hierarchy of all classes instead of a textual one.
|
|
||||||
|
|
||||||
GRAPHICAL_HIERARCHY = YES
|
|
||||||
|
|
||||||
# The tag DOT_PATH can be used to specify the path where the dot tool can be
|
|
||||||
# found. If left blank, it is assumed the dot tool can be found on the path.
|
|
||||||
|
|
||||||
DOT_PATH =
|
|
||||||
|
|
||||||
# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
|
|
||||||
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
|
|
||||||
# this value, doxygen will try to truncate the graph, so that it fits within
|
|
||||||
# the specified constraint. Beware that most browsers cannot cope with very
|
|
||||||
# large images.
|
|
||||||
|
|
||||||
MAX_DOT_GRAPH_WIDTH = 1024
|
|
||||||
|
|
||||||
# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
|
|
||||||
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
|
|
||||||
# this value, doxygen will try to truncate the graph, so that it fits within
|
|
||||||
# the specified constraint. Beware that most browsers cannot cope with very
|
|
||||||
# large images.
|
|
||||||
|
|
||||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
# Configuration::addtions related to the search engine
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# The SEARCHENGINE tag specifies whether or not a search engine should be
|
|
||||||
# used. If set to NO the values of all tags below this one will be ignored.
|
|
||||||
|
|
||||||
SEARCHENGINE = NO
|
|
||||||
|
|
||||||
# The CGI_NAME tag should be the name of the CGI script that
|
|
||||||
# starts the search engine (doxysearch) with the correct parameters.
|
|
||||||
# A script with this name will be generated by doxygen.
|
|
||||||
|
|
||||||
CGI_NAME = search.cgi
|
|
||||||
|
|
||||||
# The CGI_URL tag should be the absolute URL to the directory where the
|
|
||||||
# cgi binaries are located. See the documentation of your http daemon for
|
|
||||||
# details.
|
|
||||||
|
|
||||||
CGI_URL =
|
|
||||||
|
|
||||||
# The DOC_URL tag should be the absolute URL to the directory where the
|
|
||||||
# documentation is located. If left blank the absolute path to the
|
|
||||||
# documentation, with file:// prepended to it, will be used.
|
|
||||||
|
|
||||||
DOC_URL =
|
|
||||||
|
|
||||||
# The DOC_ABSPATH tag should be the absolute path to the directory where the
|
|
||||||
# documentation is located. If left blank the directory on the local machine
|
|
||||||
# will be used.
|
|
||||||
|
|
||||||
DOC_ABSPATH =
|
|
||||||
|
|
||||||
# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
|
|
||||||
# is installed.
|
|
||||||
|
|
||||||
BIN_ABSPATH = /usr/local/bin/
|
|
||||||
|
|
||||||
# The EXT_DOC_PATHS tag can be used to specify one or more paths to
|
|
||||||
# documentation generated for other projects. This allows doxysearch to search
|
|
||||||
# the documentation for these projects as well.
|
|
||||||
|
|
||||||
EXT_DOC_PATHS =
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2001-2005, Haiku.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include "ButtonView.h"
|
|
||||||
#include "MainWindow.h"
|
|
||||||
|
|
||||||
ButtonView::ButtonView(BRect rect)
|
|
||||||
: BView(rect, "ButtonView", B_FOLLOW_ALL, B_WILL_DRAW)
|
|
||||||
{
|
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
||||||
|
|
||||||
BRect btnRect(0, 0, 75, 25);
|
|
||||||
btnRect.OffsetBy(10, 8);
|
|
||||||
BButton *rescanButton = new BButton(btnRect, "rescanButton", "Rescan",
|
|
||||||
new BMessage(M_RESCAN_FONTS),
|
|
||||||
B_FOLLOW_LEFT, B_WILL_DRAW);
|
|
||||||
AddChild(rescanButton);
|
|
||||||
|
|
||||||
btnRect.OffsetBy(96, 0);
|
|
||||||
BButton *defaultsButton = new BButton(btnRect, "defaultsButton",
|
|
||||||
"Defaults",
|
|
||||||
new BMessage(M_SET_DEFAULTS),
|
|
||||||
B_FOLLOW_LEFT, B_WILL_DRAW);
|
|
||||||
AddChild(defaultsButton);
|
|
||||||
|
|
||||||
btnRect.OffsetBy(85, 0);
|
|
||||||
fRevertButton = new BButton(btnRect, "fRevertButton", "Revert",
|
|
||||||
new BMessage(M_REVERT),
|
|
||||||
B_FOLLOW_LEFT, B_WILL_DRAW);
|
|
||||||
AddChild(fRevertButton);
|
|
||||||
|
|
||||||
fRevertButton->SetEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ButtonView::Draw(BRect update)
|
|
||||||
{
|
|
||||||
rgb_color dark = {100, 100, 100, 255};
|
|
||||||
rgb_color light = {255, 255, 255, 255};
|
|
||||||
BRect bounds(Bounds());
|
|
||||||
|
|
||||||
BeginLineArray(6);
|
|
||||||
|
|
||||||
AddLine(bounds.LeftTop(), bounds.RightTop(), light);
|
|
||||||
AddLine(bounds.LeftTop(), bounds.LeftBottom(), light);
|
|
||||||
AddLine(bounds.RightTop(), bounds.RightBottom(), dark);
|
|
||||||
AddLine(bounds.RightBottom(), bounds.LeftBottom(), dark);
|
|
||||||
AddLine(BPoint(95, 9), BPoint(95, 34), dark);
|
|
||||||
AddLine(BPoint(96, 9), BPoint(96, 34), light);
|
|
||||||
|
|
||||||
EndLineArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
ButtonView::RevertState(void) const
|
|
||||||
{
|
|
||||||
return fRevertButton->IsEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ButtonView::SetRevertState(bool value)
|
|
||||||
{
|
|
||||||
fRevertButton->SetEnabled(value);
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2001-2005, Haiku.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef BUTTON_VIEW_H
|
|
||||||
#define BUTTON_VIEW_H
|
|
||||||
|
|
||||||
#include <View.h>
|
|
||||||
#include <Button.h>
|
|
||||||
|
|
||||||
// Message sent when the rescan button is sent.
|
|
||||||
#define M_RESCAN_FONTS 'rscn'
|
|
||||||
|
|
||||||
class ButtonView : public BView
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ButtonView(BRect frame);
|
|
||||||
bool RevertState() const;
|
|
||||||
void SetRevertState(bool b);
|
|
||||||
void Draw(BRect);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
BButton *fRevertButton;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -2,467 +2,443 @@
|
|||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2005, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
|
* Authors:
|
||||||
|
* Mark Hogben
|
||||||
|
* DarkWyrm <[email protected]>
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "FontSelectionView.h"
|
#include "FontSelectionView.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "Pref_Utils.h"
|
|
||||||
|
#include <Box.h>
|
||||||
|
#include <MenuField.h>
|
||||||
|
#include <MenuItem.h>
|
||||||
|
#include <PopUpMenu.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
#include <StringView.h>
|
||||||
|
|
||||||
#define SIZE_CHANGED_MSG 'plsz'
|
#include <stdio.h>
|
||||||
#define FONT_CHANGED_MSG 'plfn'
|
|
||||||
#define STYLE_CHANGED_MSG 'plst'
|
|
||||||
|
|
||||||
// should be changed to allow larger and smaller
|
|
||||||
#define MIN_SIZE_INDEX 9
|
|
||||||
#define MAX_SIZE_INDEX 14
|
|
||||||
|
|
||||||
extern void _set_system_font_(const char *which, font_family family, font_style style, float size);
|
#define INSTANT_UPDATE
|
||||||
|
// if defined, the system font will be updated immediately, and not
|
||||||
|
// only on exit
|
||||||
|
|
||||||
FontSelectionView::FontSelectionView(BRect rect, const char *name, int type)
|
static const int32 kMsgSetFamily = 'fmly';
|
||||||
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW),
|
static const int32 kMsgSetStyle = 'styl';
|
||||||
fType(type)
|
static const int32 kMsgSetSize = 'size';
|
||||||
|
|
||||||
|
static const float kMinSize = 8.0;
|
||||||
|
static const float kMaxSize = 18.0;
|
||||||
|
|
||||||
|
|
||||||
|
// private font API
|
||||||
|
extern void _set_system_font_(const char *which, font_family family,
|
||||||
|
font_style style, float size);
|
||||||
|
extern status_t _get_system_default_font_(const char* which,
|
||||||
|
font_family family, font_style style, float* _size);
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __HAIKU__
|
||||||
|
|
||||||
|
#ifdef B_BEOS_VERSION_DANO
|
||||||
|
// this call only exists under R5
|
||||||
|
void
|
||||||
|
_set_system_font_(const char *which, font_family family,
|
||||||
|
font_style style, float size)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
puts("you don't have _set_system_font_()");
|
||||||
|
}
|
||||||
BString typelabel;
|
#endif
|
||||||
|
/*
|
||||||
switch(fType)
|
status_t
|
||||||
{
|
_get_system_default_font_(const char* which, font_family family,
|
||||||
case BOLD_FONT_SELECTION_VIEW:
|
font_style style, float* _size)
|
||||||
{
|
{
|
||||||
typelabel="Bold font:";
|
puts("you don't have _get_system_default_font_()");
|
||||||
fSavedFont = be_bold_font;
|
return B_ERROR;
|
||||||
fCurrentFont = be_bold_font;
|
}
|
||||||
|
*/
|
||||||
fDefaultFont.SetFamilyAndStyle("Swis721 BT", "Bold");
|
#endif // !__HAIKU__
|
||||||
fDefaultFont.SetSize(12.0);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FIXED_FONT_SELECTION_VIEW:
|
|
||||||
{
|
|
||||||
typelabel="Fixed font:";
|
|
||||||
fSavedFont = be_fixed_font;
|
|
||||||
fCurrentFont = be_fixed_font;
|
|
||||||
|
|
||||||
fDefaultFont = new BFont();
|
|
||||||
fDefaultFont.SetFamilyAndStyle("Courier10 BT", "Roman");
|
|
||||||
fDefaultFont.SetSize(12.0);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
typelabel="Plain font:";
|
|
||||||
fSavedFont = be_plain_font;
|
|
||||||
fCurrentFont = be_plain_font;
|
|
||||||
|
|
||||||
fDefaultFont = new BFont();
|
|
||||||
fDefaultFont.SetFamilyAndStyle("Swis721 BT", "Roman");
|
|
||||||
fDefaultFont.SetSize(10.0);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float fontheight = FontHeight(false);
|
|
||||||
float divider = StringWidth("Fixed font:");
|
|
||||||
|
|
||||||
fSizeMenu = new BPopUpMenu("fSizeMenu", true, true, B_ITEMS_IN_COLUMN);
|
FontSelectionView::FontSelectionView(BRect rect, const char* name,
|
||||||
fFontMenu = new BPopUpMenu("fFontMenu", true, true, B_ITEMS_IN_COLUMN);
|
const char* label, const BFont& currentFont)
|
||||||
|
: BView(rect, name, B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW),
|
||||||
// size box
|
fSavedFont(currentFont),
|
||||||
BRect r( Bounds() );
|
fCurrentFont(currentFont)
|
||||||
|
{
|
||||||
float x = StringWidth("999") + 16;
|
fDivider = StringWidth(label) + 5;
|
||||||
r.left = r.right -( x + StringWidth("Size: ") + 8.0 );
|
|
||||||
r.bottom = fontheight +5;
|
fSizesMenu = new BPopUpMenu("size menu");
|
||||||
|
_BuildSizesMenu();
|
||||||
BMenuField *fSizeMenuField = new BMenuField(r, "fontField", "Size: ", fSizeMenu, true);
|
|
||||||
fSizeMenuField->SetDivider( StringWidth("Size: ") + 5.0 );
|
fFontsMenu = new BPopUpMenu("font menu");
|
||||||
fSizeMenuField->SetAlignment(B_ALIGN_RIGHT);
|
|
||||||
AddChild(fSizeMenuField);
|
|
||||||
|
|
||||||
// font menu
|
// font menu
|
||||||
r.right = r.left;
|
BRect rect(Bounds());
|
||||||
r.left = 1;
|
fFontsMenuField = new BMenuField(rect, "fonts", label, fFontsMenu, false);
|
||||||
r.bottom = fontheight *1.5;
|
fFontsMenuField->SetDivider(fDivider);
|
||||||
BMenuField *fFontMenuField = new BMenuField(r, "fontField", typelabel.String(), fFontMenu, false);
|
fFontsMenuField->SetAlignment(B_ALIGN_RIGHT);
|
||||||
fFontMenuField->SetDivider(divider + 6.0);
|
fFontsMenuField->ResizeToPreferred();
|
||||||
fFontMenuField->SetAlignment(B_ALIGN_RIGHT);
|
AddChild(fFontsMenuField);
|
||||||
AddChild(fFontMenuField);
|
|
||||||
|
|
||||||
r = Bounds();
|
|
||||||
r.left = divider +8.0;
|
|
||||||
r.top = fontheight *1.5 +4;
|
|
||||||
r.InsetBy(1, 1);
|
|
||||||
BBox *fPreviewTextBox = new BBox(r, "TestTextBox", B_FOLLOW_ALL, B_WILL_DRAW, B_FANCY_BORDER);
|
|
||||||
AddChild(fPreviewTextBox);
|
|
||||||
|
|
||||||
// Place the text slightly inside the entire box area, so it doesn't overlap the box outline.
|
// size menu
|
||||||
r = fPreviewTextBox->Bounds().InsetByCopy(2, 2);
|
rect.right = rect.left + StringWidth("99") + 40;
|
||||||
r.right -= 2;
|
fSizesMenuField = new BMenuField(rect, "sizes", "Size:", fSizesMenu, true,
|
||||||
BRect fPreviewTextRect(r);
|
B_FOLLOW_RIGHT | B_FOLLOW_TOP);
|
||||||
fPreviewText = new BStringView(fPreviewTextRect, "fPreviewText", "The quick brown fox jumps over the lazy dog.",
|
fSizesMenuField->SetDivider(StringWidth(fSizesMenuField->Label()) + 5.0);
|
||||||
B_FOLLOW_ALL, B_WILL_DRAW);
|
fSizesMenuField->SetAlignment(B_ALIGN_RIGHT);
|
||||||
|
fSizesMenuField->ResizeToPreferred();
|
||||||
|
rect = Bounds();
|
||||||
|
fSizesMenuField->MoveBy(rect.right - fSizesMenuField->Bounds().Width(), 0);
|
||||||
|
AddChild(fSizesMenuField);
|
||||||
|
|
||||||
|
rect.top += fFontsMenuField->Bounds().Height() + 5;
|
||||||
|
rect.left = fDivider;
|
||||||
|
BFont font = be_plain_font;
|
||||||
|
font.SetSize(kMaxSize);
|
||||||
|
font_height height;
|
||||||
|
font.GetHeight(&height);
|
||||||
|
rect.bottom = rect.top + floorf(height.ascent + height.descent + height.leading) + 5;
|
||||||
|
|
||||||
|
fPreviewBox = new BBox(rect, "preview", B_FOLLOW_LEFT_RIGHT,
|
||||||
|
B_WILL_DRAW | B_FRAME_EVENTS);
|
||||||
|
AddChild(fPreviewBox);
|
||||||
|
|
||||||
|
// Place the text slightly inside the entire box area, so
|
||||||
|
// it doesn't overlap the box outline.
|
||||||
|
rect = fPreviewBox->Bounds().InsetByCopy(3, 3);
|
||||||
|
fPreviewText = new BStringView(rect, "preview text",
|
||||||
|
"The quick brown fox jumps over the lazy dog.",
|
||||||
|
B_FOLLOW_LEFT_RIGHT);
|
||||||
fPreviewText->SetFont(&fCurrentFont);
|
fPreviewText->SetFont(&fCurrentFont);
|
||||||
fPreviewTextBox->AddChild(fPreviewText);
|
fPreviewBox->AddChild(fPreviewText);
|
||||||
}
|
}
|
||||||
|
|
||||||
FontSelectionView::~FontSelectionView(void)
|
|
||||||
|
FontSelectionView::~FontSelectionView()
|
||||||
{
|
{
|
||||||
font_family family;
|
#ifdef INSTANT_UPDATE
|
||||||
font_style style;
|
_UpdateSystemFont();
|
||||||
fCurrentFont.GetFamilyAndStyle(&family,&style);
|
#endif
|
||||||
|
|
||||||
switch(fType)
|
|
||||||
{
|
|
||||||
case PLAIN_FONT_SELECTION_VIEW:
|
|
||||||
{
|
|
||||||
_set_system_font_("plain", family, style, fCurrentFont.Size());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case BOLD_FONT_SELECTION_VIEW:
|
|
||||||
{
|
|
||||||
_set_system_font_("bold", family, style, fCurrentFont.Size());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FIXED_FONT_SELECTION_VIEW:
|
|
||||||
{
|
|
||||||
_set_system_font_("fixed", family, style, fCurrentFont.Size());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FontSelectionView::AttachedToWindow(void)
|
FontSelectionView::GetPreferredSize(float *_width, float *_height)
|
||||||
{
|
{
|
||||||
BuildMenus();
|
// don't change the width if it is large enough
|
||||||
|
if (_width) {
|
||||||
|
*_width = fMaxFontNameWidth + 40 + fDivider
|
||||||
|
+ fSizesMenuField->Bounds().Width();
|
||||||
|
|
||||||
|
if (*_width < Bounds().Width())
|
||||||
|
*_width = Bounds().Width();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_height) {
|
||||||
|
BView* view = FindView("preview");
|
||||||
|
if (view != NULL)
|
||||||
|
*_height = view->Frame().bottom + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FontSelectionView::SetDivider(float divider)
|
||||||
|
{
|
||||||
|
fFontsMenuField->SetDivider(divider);
|
||||||
|
|
||||||
|
fPreviewBox->ResizeBy(fDivider - divider, 0);
|
||||||
|
fPreviewBox->MoveBy(divider - fDivider, 0);
|
||||||
|
|
||||||
|
// if the view is not yet attached to a window, the resizing mode is ignored
|
||||||
|
if (Window() == NULL)
|
||||||
|
fPreviewText->ResizeBy(fDivider - divider, 0);
|
||||||
|
|
||||||
|
fDivider = divider;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FontSelectionView::AttachedToWindow()
|
||||||
|
{
|
||||||
|
if (Parent() != NULL)
|
||||||
|
SetViewColor(Parent()->ViewColor());
|
||||||
|
else
|
||||||
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
|
fSizesMenu->SetTargetForItems(this);
|
||||||
|
UpdateFontsMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FontSelectionView::MessageReceived(BMessage *msg)
|
FontSelectionView::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
switch(msg->what)
|
switch (msg->what) {
|
||||||
{
|
case kMsgSetSize:
|
||||||
case SIZE_CHANGED_MSG:
|
|
||||||
{
|
{
|
||||||
int32 size;
|
int32 size;
|
||||||
if(msg->FindInt32("size",&size)!=B_OK)
|
if (msg->FindInt32("size", &size) != B_OK
|
||||||
|
|| size == fCurrentFont.Size())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
BString str(B_EMPTY_STRING);
|
fCurrentFont.SetSize(size);
|
||||||
str << size;
|
_UpdateFontPreview();
|
||||||
|
|
||||||
BMenuItem *item=fSizeMenu->FindItem(str.String());
|
Window()->PostMessage(kMsgUpdate);
|
||||||
if(item)
|
|
||||||
{
|
|
||||||
item->SetMarked(true);
|
|
||||||
|
|
||||||
fCurrentFont.SetSize(size);
|
|
||||||
fPreviewText->SetFont(&fCurrentFont, B_FONT_ALL);
|
|
||||||
fPreviewText->Invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
NotifyFontChange();
|
|
||||||
Window()->PostMessage(M_ENABLE_REVERT);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FONT_CHANGED_MSG:
|
|
||||||
|
case kMsgSetFamily:
|
||||||
{
|
{
|
||||||
BString str;
|
const char* family;
|
||||||
if(msg->FindString("family",&str)!=B_OK)
|
if (msg->FindString("family", &family) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
font_family family;
|
font_style style;
|
||||||
sprintf(family,"%s",str.String());
|
fCurrentFont.GetFamilyAndStyle(NULL, &style);
|
||||||
BMenuItem *menu=fFontMenu->FindItem(family);
|
|
||||||
if(menu)
|
BMenuItem *familyItem = fFontsMenu->FindItem(family);
|
||||||
{
|
if (familyItem != NULL) {
|
||||||
menu->SetMarked(true);
|
_SelectCurrentFont(false);
|
||||||
fCurrentFont.SetFamilyAndFace(family,B_REGULAR_FACE);
|
|
||||||
|
BMenuItem *item = familyItem->Submenu()->FindItem(style);
|
||||||
font_style style;
|
if (item == NULL)
|
||||||
fCurrentFont.GetFamilyAndStyle(&family,&style);
|
item = familyItem->Submenu()->ItemAt(0);
|
||||||
|
|
||||||
BMenuItem *item=menu->Submenu()->FindItem(style);
|
if (item != NULL) {
|
||||||
if(item)
|
|
||||||
{
|
|
||||||
fCurrentStyle->SetMarked(false);
|
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
fCurrentStyle=item;
|
fCurrentFont.SetFamilyAndStyle(family, item->Label());
|
||||||
|
_UpdateFontPreview();
|
||||||
fPreviewText->SetFont(&fCurrentFont, B_FONT_ALL);
|
|
||||||
fPreviewText->Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifyFontChange();
|
Window()->PostMessage(kMsgUpdate);
|
||||||
Window()->PostMessage(M_ENABLE_REVERT);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STYLE_CHANGED_MSG:
|
|
||||||
|
case kMsgSetStyle:
|
||||||
{
|
{
|
||||||
BString str;
|
const char* family;
|
||||||
if(msg->FindString("family",&str)!=B_OK)
|
const char* style;
|
||||||
|
if (msg->FindString("family", &family) != B_OK
|
||||||
|
|| msg->FindString("style", &style) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
font_family family;
|
BMenuItem *familyItem = fFontsMenu->FindItem(family);
|
||||||
font_style style;
|
if (!familyItem)
|
||||||
sprintf(family,"%s",str.String());
|
|
||||||
|
|
||||||
if(msg->FindString("style",&str)!=B_OK)
|
|
||||||
break;
|
break;
|
||||||
sprintf(style,"%s",str.String());
|
|
||||||
|
_SelectCurrentFont(false);
|
||||||
BMenuItem *menu=fFontMenu->FindItem(family);
|
familyItem->SetMarked(true);
|
||||||
if(!menu)
|
|
||||||
break;
|
fCurrentFont.SetFamilyAndStyle(family, style);
|
||||||
|
_UpdateFontPreview();
|
||||||
BMenuItem *item=menu->Submenu()->FindItem(style);
|
|
||||||
if(item)
|
Window()->PostMessage(kMsgUpdate);
|
||||||
{
|
|
||||||
fCurrentStyle->SetMarked(false);
|
|
||||||
menu->SetMarked(true);
|
|
||||||
item->SetMarked(true);
|
|
||||||
fCurrentStyle=item;
|
|
||||||
|
|
||||||
fCurrentFont.SetFamilyAndStyle(family,style);
|
|
||||||
fPreviewText->SetFont(&fCurrentFont, B_FONT_ALL);
|
|
||||||
fPreviewText->Invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
NotifyFontChange();
|
|
||||||
Window()->PostMessage(M_ENABLE_REVERT);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BView::MessageReceived(msg);
|
BView::MessageReceived(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FontSelectionView::EmptyMenus(void)
|
FontSelectionView::_BuildSizesMenu()
|
||||||
{
|
{
|
||||||
// Empty the font list
|
const int32 sizes[] = {7, 8, 9, 10, 11, 12, 13, 14, 18, 21, 24, 0};
|
||||||
for(int32 i = 0; i < fFontMenu->CountItems(); i++)
|
|
||||||
{
|
// build size menu
|
||||||
BMenu *menu = fFontMenu->SubmenuAt(0L);
|
for (int32 i = 0; sizes[i]; i++) {
|
||||||
|
int32 size = sizes[i];
|
||||||
// We should never have a regular menu item in the font list
|
if (size < kMinSize || size > kMaxSize)
|
||||||
if(!menu)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for(int32 j=0; j < menu->CountItems(); j++)
|
char label[32];
|
||||||
{
|
snprintf(label, sizeof(label), "%ld", size);
|
||||||
BMenuItem *item = menu->RemoveItem(0L);
|
|
||||||
delete item;
|
BMessage* message = new BMessage(kMsgSetSize);
|
||||||
}
|
message->AddInt32("size", size);
|
||||||
|
|
||||||
fFontMenu->RemoveItem(menu);
|
BMenuItem* item = new BMenuItem(label, message);
|
||||||
delete menu;
|
if (size == fCurrentFont.Size())
|
||||||
}
|
item->SetMarked(true);
|
||||||
|
|
||||||
// empty the size list
|
fSizesMenu->AddItem(item);
|
||||||
for(int32 i = 0; i < fSizeMenu->CountItems(); i++)
|
|
||||||
{
|
|
||||||
BMenuItem *item = fSizeMenu->RemoveItem(0L);
|
|
||||||
delete item;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FontSelectionView::BuildMenus(void)
|
FontSelectionView::_SelectCurrentFont(bool select)
|
||||||
{
|
{
|
||||||
int32 numFamilies;
|
font_family family;
|
||||||
int counter;
|
font_style style;
|
||||||
BMessage *msg;
|
fCurrentFont.GetFamilyAndStyle(&family, &style);
|
||||||
|
|
||||||
numFamilies = count_font_families();
|
BMenuItem *item = fFontsMenu->FindItem(family);
|
||||||
|
if (item != NULL) {
|
||||||
for ( int32 i = 0; i < numFamilies; i++ )
|
item->SetMarked(select);
|
||||||
{
|
|
||||||
|
if (item->Submenu() != NULL) {
|
||||||
|
item = item->Submenu()->FindItem(style);
|
||||||
|
if (item != NULL)
|
||||||
|
item->SetMarked(select);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FontSelectionView::_SelectCurrentSize(bool select)
|
||||||
|
{
|
||||||
|
char label[16];
|
||||||
|
snprintf(label, sizeof(label), "%ld", (int32)fCurrentFont.Size());
|
||||||
|
|
||||||
|
BMenuItem* item = fSizesMenu->FindItem(label);
|
||||||
|
if (item != NULL)
|
||||||
|
item->SetMarked(select);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FontSelectionView::_UpdateFontPreview()
|
||||||
|
{
|
||||||
|
fPreviewText->SetFont(&fCurrentFont);
|
||||||
|
fPreviewText->Invalidate();
|
||||||
|
|
||||||
|
#ifdef INSTANT_UPDATE
|
||||||
|
_UpdateSystemFont();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FontSelectionView::_UpdateSystemFont()
|
||||||
|
{
|
||||||
|
font_family family;
|
||||||
|
font_style style;
|
||||||
|
fCurrentFont.GetFamilyAndStyle(&family, &style);
|
||||||
|
|
||||||
|
_set_system_font_(Name(), family, style, fCurrentFont.Size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FontSelectionView::SetDefaults()
|
||||||
|
{
|
||||||
|
font_family family;
|
||||||
|
font_style style;
|
||||||
|
float size;
|
||||||
|
if (_get_system_default_font_(Name(), family, style, &size) != B_OK) {
|
||||||
|
Revert();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BFont defaultFont;
|
||||||
|
defaultFont.SetFamilyAndStyle(family, style);
|
||||||
|
defaultFont.SetSize(size);
|
||||||
|
|
||||||
|
defaultFont.GetFamilyAndStyle(&family, &style);
|
||||||
|
|
||||||
|
_SelectCurrentFont(false);
|
||||||
|
|
||||||
|
fCurrentFont = defaultFont;
|
||||||
|
_UpdateFontPreview();
|
||||||
|
|
||||||
|
_SelectCurrentFont(true);
|
||||||
|
_SelectCurrentSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FontSelectionView::Revert()
|
||||||
|
{
|
||||||
|
if (!IsRevertable())
|
||||||
|
return;
|
||||||
|
|
||||||
|
_SelectCurrentFont(false);
|
||||||
|
|
||||||
|
fCurrentFont = fSavedFont;
|
||||||
|
_UpdateFontPreview();
|
||||||
|
|
||||||
|
_SelectCurrentFont(true);
|
||||||
|
_SelectCurrentSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
FontSelectionView::IsRevertable()
|
||||||
|
{
|
||||||
|
return fCurrentFont != fSavedFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FontSelectionView::UpdateFontsMenu()
|
||||||
|
{
|
||||||
|
int32 numFamilies = count_font_families();
|
||||||
|
|
||||||
|
fFontsMenu->RemoveItems(0, fFontsMenu->CountItems(), true);
|
||||||
|
BFont font;
|
||||||
|
fFontsMenu->GetFont(&font);
|
||||||
|
|
||||||
|
font_family currentFamily;
|
||||||
|
font_style currentStyle;
|
||||||
|
fCurrentFont.GetFamilyAndStyle(¤tFamily, ¤tStyle);
|
||||||
|
|
||||||
|
for (int32 i = 0; i < numFamilies; i++) {
|
||||||
font_family family;
|
font_family family;
|
||||||
|
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
int32 numStyles;
|
if (get_font_family(i, &family, &flags) != B_OK)
|
||||||
|
|
||||||
BMenu *tmpStyleMenu;
|
|
||||||
bool markFamily;
|
|
||||||
|
|
||||||
if ( get_font_family(i, &family, &flags) != B_OK )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
markFamily = false;
|
// if we're setting the fixed font, we only want to show fixed fonts
|
||||||
|
if (!strcmp(Name(), "fixed") && (flags & B_IS_FIXED) == 0)
|
||||||
tmpStyleMenu = new BMenu(family);
|
continue;
|
||||||
tmpStyleMenu->SetRadioMode(true);
|
|
||||||
numStyles = count_font_styles(family);
|
float width = font.StringWidth(family);
|
||||||
|
if (width > fMaxFontNameWidth)
|
||||||
for ( int32 j = 0; j < numStyles; j++ )
|
fMaxFontNameWidth = width;
|
||||||
{
|
|
||||||
|
BMenu* stylesMenu = new BMenu(family);
|
||||||
|
stylesMenu->SetRadioMode(true);
|
||||||
|
stylesMenu->SetFont(&font);
|
||||||
|
|
||||||
|
BMessage* message = new BMessage(kMsgSetFamily);
|
||||||
|
message->AddString("family", family);
|
||||||
|
BMenuItem* familyItem = new BMenuItem(stylesMenu, message);
|
||||||
|
fFontsMenu->AddItem(familyItem);
|
||||||
|
|
||||||
|
int32 numStyles = count_font_styles(family);
|
||||||
|
|
||||||
|
for (int32 j = 0; j < numStyles; j++) {
|
||||||
font_style style;
|
font_style style;
|
||||||
BMenuItem *tmpItem;
|
|
||||||
|
|
||||||
char workingStyle[64];
|
|
||||||
char workingFamily[64];
|
|
||||||
|
|
||||||
if (get_font_style(family, j, &style, &flags) != B_OK)
|
if (get_font_style(family, j, &style, &flags) != B_OK)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fCurrentFont.GetFamilyAndStyle(&workingFamily, &workingStyle);
|
message = new BMessage(kMsgSetStyle);
|
||||||
|
message->AddString("family", (char*)family);
|
||||||
msg = new BMessage(STYLE_CHANGED_MSG);
|
message->AddString("style", (char*)style);
|
||||||
msg->AddString("family",(char*)family);
|
|
||||||
msg->AddString("style",(char*)style);
|
BMenuItem *item = new BMenuItem(style, message);
|
||||||
tmpItem = new BMenuItem(style, msg);
|
|
||||||
|
if (!strcmp(style, currentStyle) && !strcmp(family, currentFamily)) {
|
||||||
if((strcmp(style, workingStyle) == 0) && (strcmp(family, workingFamily) == 0))
|
item->SetMarked(true);
|
||||||
{
|
familyItem->SetMarked(true);
|
||||||
markFamily = true;
|
|
||||||
tmpItem->SetMarked(true);
|
|
||||||
fCurrentStyle=tmpItem;
|
|
||||||
}
|
}
|
||||||
tmpStyleMenu->AddItem(tmpItem);
|
stylesMenu->AddItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = new BMessage(FONT_CHANGED_MSG);
|
stylesMenu->SetTargetForItems(this);
|
||||||
msg->AddString("family",family);
|
|
||||||
fFontMenu->AddItem(new BMenuItem((tmpStyleMenu), msg));
|
|
||||||
tmpStyleMenu->SetTargetForItems(this);
|
|
||||||
|
|
||||||
if(markFamily)
|
|
||||||
tmpStyleMenu->Superitem()->SetMarked(true);
|
|
||||||
}
|
}
|
||||||
fFontMenu->SetTargetForItems(this);
|
|
||||||
|
|
||||||
// build size menu
|
|
||||||
for(counter = MIN_SIZE_INDEX; counter < (MAX_SIZE_INDEX + 1); counter++)
|
|
||||||
{
|
|
||||||
char buf[1];
|
|
||||||
BMenuItem *tmp;
|
|
||||||
|
|
||||||
sprintf(buf, "%d", counter);
|
|
||||||
msg = new BMessage(SIZE_CHANGED_MSG);
|
|
||||||
msg->AddInt32("size",counter);
|
|
||||||
fSizeMenu->AddItem(tmp = new BMenuItem(buf, msg));
|
|
||||||
if(counter == (int) fCurrentFont.Size())
|
|
||||||
tmp->SetMarked(true);
|
|
||||||
}
|
|
||||||
fSizeMenu->SetTargetForItems(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This method is called by outsiders only. As a result,
|
fFontsMenu->SetTargetForItems(this);
|
||||||
// the owning window is NOT notified
|
|
||||||
void
|
|
||||||
FontSelectionView::SetDefaults(void)
|
|
||||||
{
|
|
||||||
font_family family;
|
|
||||||
font_style style;
|
|
||||||
|
|
||||||
fDefaultFont.GetFamilyAndStyle(&family, &style);
|
|
||||||
|
|
||||||
BMenuItem *menu=fFontMenu->FindItem(family);
|
|
||||||
if(!menu)
|
|
||||||
return;
|
|
||||||
|
|
||||||
BMenuItem *item=menu->Submenu()->FindItem(style);
|
|
||||||
if(!item)
|
|
||||||
return;
|
|
||||||
|
|
||||||
fCurrentStyle->SetMarked(false);
|
|
||||||
menu->SetMarked(true);
|
|
||||||
item->SetMarked(true);
|
|
||||||
fCurrentStyle=item;
|
|
||||||
|
|
||||||
char string[5];
|
|
||||||
sprintf(string,"%d",(int)fDefaultFont.Size());
|
|
||||||
item = fSizeMenu->FindItem(string);
|
|
||||||
if(item)
|
|
||||||
item->SetMarked(true);
|
|
||||||
|
|
||||||
fCurrentFont=fDefaultFont;
|
|
||||||
fPreviewText->SetFont(&fCurrentFont, B_FONT_ALL);
|
|
||||||
fPreviewText->Invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method is called by outsiders only. As a result,
|
|
||||||
// the owning window is NOT notified
|
|
||||||
void
|
|
||||||
FontSelectionView::Revert(void)
|
|
||||||
{
|
|
||||||
font_family family;
|
|
||||||
font_style style;
|
|
||||||
|
|
||||||
fSavedFont.GetFamilyAndStyle(&family, &style);
|
|
||||||
|
|
||||||
BMenuItem *menu=fFontMenu->FindItem(family);
|
|
||||||
if(!menu)
|
|
||||||
return;
|
|
||||||
|
|
||||||
BMenuItem *item=menu->Submenu()->FindItem(style);
|
|
||||||
if(!item)
|
|
||||||
return;
|
|
||||||
|
|
||||||
fCurrentStyle->SetMarked(false);
|
|
||||||
menu->SetMarked(true);
|
|
||||||
item->SetMarked(true);
|
|
||||||
fCurrentStyle=item;
|
|
||||||
|
|
||||||
char string[5];
|
|
||||||
sprintf(string,"%d",(int)fSavedFont.Size());
|
|
||||||
item = fSizeMenu->FindItem(string);
|
|
||||||
if(item)
|
|
||||||
item->SetMarked(true);
|
|
||||||
|
|
||||||
fCurrentFont=fSavedFont;
|
|
||||||
fPreviewText->SetFont(&fCurrentFont, B_FONT_ALL);
|
|
||||||
fPreviewText->Invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FontSelectionView::NotifyFontChange(void)
|
|
||||||
{
|
|
||||||
BMessage msg;
|
|
||||||
|
|
||||||
switch(fType)
|
|
||||||
{
|
|
||||||
case BOLD_FONT_SELECTION_VIEW:
|
|
||||||
{
|
|
||||||
msg.what=M_SET_BOLD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FIXED_FONT_SELECTION_VIEW:
|
|
||||||
{
|
|
||||||
msg.what=M_SET_FIXED;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
msg.what=M_SET_PLAIN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
font_family family;
|
|
||||||
font_style style;
|
|
||||||
fCurrentFont.GetFamilyAndStyle(&family,&style);
|
|
||||||
|
|
||||||
msg.AddInt32("size",fCurrentFont.Size());
|
|
||||||
msg.AddString("family",family);
|
|
||||||
msg.AddString("style",style);
|
|
||||||
Window()->PostMessage(&msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FontSelectionView::RescanFonts(void)
|
|
||||||
{
|
|
||||||
EmptyMenus();
|
|
||||||
BuildMenus();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,55 +2,62 @@
|
|||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2005, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
|
* Authors:
|
||||||
|
* Mark Hogben
|
||||||
|
* DarkWyrm <[email protected]>
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
*/
|
*/
|
||||||
#ifndef FONT_SELECTION_VIEW_H
|
#ifndef FONT_SELECTION_VIEW_H
|
||||||
#define FONT_SELECTION_VIEW_H
|
#define FONT_SELECTION_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
#include <Box.h>
|
|
||||||
#include <StringView.h>
|
|
||||||
#include <PopUpMenu.h>
|
|
||||||
#include <MenuField.h>
|
|
||||||
#include <MenuItem.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <String.h>
|
|
||||||
|
|
||||||
enum
|
class BBox;
|
||||||
{
|
class BMenuField;
|
||||||
PLAIN_FONT_SELECTION_VIEW=1,
|
class BPopUpMenu;
|
||||||
BOLD_FONT_SELECTION_VIEW,
|
class BStringView;
|
||||||
FIXED_FONT_SELECTION_VIEW
|
|
||||||
|
|
||||||
|
class FontSelectionView : public BView {
|
||||||
|
public:
|
||||||
|
FontSelectionView(BRect rect, const char* name, const char* label,
|
||||||
|
const BFont& currentFont);
|
||||||
|
virtual ~FontSelectionView();
|
||||||
|
|
||||||
|
virtual void GetPreferredSize(float *_width, float *_height);
|
||||||
|
virtual void AttachedToWindow();
|
||||||
|
virtual void MessageReceived(BMessage *msg);
|
||||||
|
|
||||||
|
void SetDivider(float divider);
|
||||||
|
|
||||||
|
void SetDefaults();
|
||||||
|
void Revert();
|
||||||
|
bool IsRevertable();
|
||||||
|
|
||||||
|
void UpdateFontsMenu();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void _SelectCurrentFont(bool select);
|
||||||
|
void _SelectCurrentSize(bool select);
|
||||||
|
void _UpdateFontPreview();
|
||||||
|
void _UpdateSystemFont();
|
||||||
|
void _BuildSizesMenu();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
float fDivider;
|
||||||
|
|
||||||
|
BMenuField* fFontsMenuField;
|
||||||
|
BMenuField* fSizesMenuField;
|
||||||
|
BPopUpMenu* fFontsMenu;
|
||||||
|
BPopUpMenu* fSizesMenu;
|
||||||
|
|
||||||
|
BBox* fPreviewBox;
|
||||||
|
BStringView* fPreviewText;
|
||||||
|
|
||||||
|
BFont fSavedFont;
|
||||||
|
BFont fCurrentFont;
|
||||||
|
float fMaxFontNameWidth;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FontSelectionView : public BView
|
#endif /* FONT_SELECTION_VIEW_H */
|
||||||
{
|
|
||||||
public:
|
|
||||||
FontSelectionView(BRect rect, const char *name, int type);
|
|
||||||
~FontSelectionView(void);
|
|
||||||
void AttachedToWindow(void);
|
|
||||||
void MessageReceived(BMessage *msg);
|
|
||||||
|
|
||||||
void SetDefaults(void);
|
|
||||||
void Revert(void);
|
|
||||||
void RescanFonts(void);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void BuildMenus(void);
|
|
||||||
void EmptyMenus(void);
|
|
||||||
void NotifyFontChange(void);
|
|
||||||
|
|
||||||
BStringView *fPreviewText;
|
|
||||||
|
|
||||||
BPopUpMenu *fFontMenu;
|
|
||||||
BPopUpMenu *fSizeMenu;
|
|
||||||
|
|
||||||
int fType;
|
|
||||||
|
|
||||||
BFont fSavedFont;
|
|
||||||
BFont fCurrentFont;
|
|
||||||
BFont fDefaultFont;
|
|
||||||
|
|
||||||
BMenuItem *fCurrentStyle;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -2,56 +2,94 @@
|
|||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2005, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
|
* Authors:
|
||||||
|
* Mark Hogben
|
||||||
|
* DarkWyrm <[email protected]>
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "FontView.h"
|
#include "FontView.h"
|
||||||
#include "Pref_Utils.h"
|
|
||||||
|
|
||||||
FontView::FontView(BRect rect)
|
FontView::FontView(BRect rect)
|
||||||
: BView(rect, "Fonts", B_FOLLOW_ALL, B_WILL_DRAW)
|
: BView(rect, "Fonts", B_FOLLOW_ALL, B_WILL_DRAW)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
BRect rect(Bounds());
|
||||||
BRect bounds( Bounds().InsetByCopy(5, 5) );
|
|
||||||
BRect rect(bounds);
|
float labelWidth = StringWidth("Fixed Font:") + 8;
|
||||||
|
|
||||||
rect.bottom = rect.top + FontHeight(true) *3.5;
|
fPlainView = new FontSelectionView(rect, "plain", "Plain Font:", *be_plain_font);
|
||||||
fPlainView = new FontSelectionView(rect, "Plain",
|
fPlainView->SetDivider(labelWidth);
|
||||||
PLAIN_FONT_SELECTION_VIEW);
|
fPlainView->ResizeToPreferred();
|
||||||
AddChild(fPlainView);
|
AddChild(fPlainView);
|
||||||
|
|
||||||
rect.OffsetBy(0, rect.Height() + 4);
|
rect.OffsetBy(0, fPlainView->Bounds().Height() + 10);
|
||||||
fBoldView = new FontSelectionView(rect, "Bold",
|
fBoldView = new FontSelectionView(rect, "bold", "Bold Font:", *be_bold_font);
|
||||||
BOLD_FONT_SELECTION_VIEW);
|
fBoldView->SetDivider(labelWidth);
|
||||||
|
fBoldView->ResizeToPreferred();
|
||||||
AddChild(fBoldView);
|
AddChild(fBoldView);
|
||||||
|
|
||||||
rect.OffsetBy(0, rect.Height() + 4);
|
rect.OffsetBy(0, fPlainView->Bounds().Height() + 10);
|
||||||
fFixedView = new FontSelectionView(rect, "Fixed",
|
fFixedView = new FontSelectionView(rect, "fixed", "Fixed Font:", *be_fixed_font);
|
||||||
FIXED_FONT_SELECTION_VIEW);
|
fFixedView->SetDivider(labelWidth);
|
||||||
|
fFixedView->ResizeToPreferred();
|
||||||
AddChild(fFixedView);
|
AddChild(fFixedView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FontView::SetDefaults(void)
|
FontView::GetPreferredSize(float *_width, float *_height)
|
||||||
{
|
{
|
||||||
fPlainView->SetDefaults();
|
if (_width)
|
||||||
fBoldView->SetDefaults();
|
*_width = fPlainView->Bounds().Width();
|
||||||
fFixedView->SetDefaults();
|
|
||||||
|
if (_height)
|
||||||
|
*_height = fPlainView->Bounds().Height() * 3 + 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FontView::Revert(void)
|
FontView::SetDefaults()
|
||||||
{
|
{
|
||||||
fPlainView->Revert();
|
for (int32 i = 0; i < CountChildren(); i++) {
|
||||||
fBoldView->Revert();
|
FontSelectionView* view = dynamic_cast<FontSelectionView *>(ChildAt(i));
|
||||||
fFixedView->Revert();
|
if (view == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
view->SetDefaults();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FontView::RescanFonts(void)
|
FontView::Revert()
|
||||||
{
|
{
|
||||||
fPlainView->RescanFonts();
|
for (int32 i = 0; i < CountChildren(); i++) {
|
||||||
fBoldView->RescanFonts();
|
FontSelectionView* view = dynamic_cast<FontSelectionView *>(ChildAt(i));
|
||||||
fFixedView->RescanFonts();
|
if (view == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
view->Revert();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FontView::UpdateFonts()
|
||||||
|
{
|
||||||
|
fPlainView->UpdateFontsMenu();
|
||||||
|
fBoldView->UpdateFontsMenu();
|
||||||
|
fFixedView->UpdateFontsMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
FontView::IsRevertable()
|
||||||
|
{
|
||||||
|
return fPlainView->IsRevertable()
|
||||||
|
|| fBoldView->IsRevertable()
|
||||||
|
|| fFixedView->IsRevertable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,27 +2,34 @@
|
|||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2005, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
|
* Authors:
|
||||||
|
* Mark Hogben
|
||||||
|
* DarkWyrm <[email protected]>
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
*/
|
*/
|
||||||
#ifndef FONT_VIEW_H
|
#ifndef FONT_VIEW_H
|
||||||
#define FONT_VIEW_H
|
#define FONT_VIEW_H
|
||||||
|
|
||||||
#include <Box.h>
|
|
||||||
#include <View.h>
|
|
||||||
#include "FontSelectionView.h"
|
#include "FontSelectionView.h"
|
||||||
|
|
||||||
class FontView : public BView
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FontView(BRect frame);
|
|
||||||
void SetDefaults(void);
|
|
||||||
void Revert(void);
|
|
||||||
void RescanFonts(void);
|
|
||||||
|
|
||||||
private:
|
class FontView : public BView {
|
||||||
|
public:
|
||||||
|
FontView(BRect frame);
|
||||||
|
|
||||||
FontSelectionView *fPlainView;
|
virtual void GetPreferredSize(float *_width, float *_height);
|
||||||
FontSelectionView *fBoldView;
|
|
||||||
FontSelectionView *fFixedView;
|
void SetDefaults();
|
||||||
|
void Revert();
|
||||||
|
void UpdateFonts();
|
||||||
|
|
||||||
|
bool IsRevertable();
|
||||||
|
|
||||||
|
private:
|
||||||
|
FontSelectionView *fPlainView;
|
||||||
|
FontSelectionView *fBoldView;
|
||||||
|
FontSelectionView *fFixedView;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif /* FONT_VIEW_H */
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2005, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Mark Hogben
|
||||||
|
* DarkWyrm <[email protected]>
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -65,6 +70,6 @@ FontsSettings::SetWindowCorner(BPoint where)
|
|||||||
void
|
void
|
||||||
FontsSettings::SetDefaults()
|
FontsSettings::SetDefaults()
|
||||||
{
|
{
|
||||||
fCorner.Set(100, 100);
|
fCorner.Set(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,23 +2,30 @@
|
|||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2005, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
|
* Authors:
|
||||||
|
* Mark Hogben
|
||||||
|
* DarkWyrm <[email protected]>
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
*/
|
*/
|
||||||
#ifndef FONTS_SETTINGS_H
|
#ifndef FONTS_SETTINGS_H
|
||||||
#define FONTS_SETTINGS_H
|
#define FONTS_SETTINGS_H
|
||||||
|
|
||||||
class FontsSettings
|
|
||||||
{
|
#include <Point.h>
|
||||||
public:
|
|
||||||
FontsSettings(void);
|
|
||||||
~FontsSettings(void);
|
class FontsSettings {
|
||||||
|
public:
|
||||||
BPoint WindowCorner(void) const { return fCorner; }
|
FontsSettings();
|
||||||
void SetWindowCorner(BPoint);
|
~FontsSettings();
|
||||||
|
|
||||||
void SetDefaults(void);
|
BPoint WindowCorner() const { return fCorner; }
|
||||||
|
void SetWindowCorner(BPoint);
|
||||||
private:
|
|
||||||
BPoint fCorner;
|
void SetDefaults();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BPoint fCorner;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif /* FONTS_SETTINGS_H */
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
SubDir HAIKU_TOP src preferences fonts ;
|
SubDir HAIKU_TOP src preferences fonts ;
|
||||||
|
|
||||||
|
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||||
|
AddSubDirSupportedPlatforms libbe_test ;
|
||||||
|
|
||||||
Preference Fonts :
|
Preference Fonts :
|
||||||
ButtonView.cpp
|
|
||||||
FontSelectionView.cpp
|
FontSelectionView.cpp
|
||||||
FontsSettings.cpp
|
FontsSettings.cpp
|
||||||
FontView.cpp
|
FontView.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
MainWindow.cpp
|
MainWindow.cpp
|
||||||
Pref_Utils.cpp
|
: be
|
||||||
: libbe.so
|
|
||||||
: Fonts.rdef
|
: Fonts.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
if $(TARGET_PLATFORM) = libbe_test {
|
||||||
|
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : Fonts
|
||||||
|
: tests!apps ;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,48 +1,98 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2005, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Mark Hogben
|
||||||
|
* DarkWyrm <[email protected]>
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "FontView.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
#include <Button.h>
|
||||||
|
#include <Screen.h>
|
||||||
|
#include <TabView.h>
|
||||||
|
|
||||||
|
|
||||||
|
static const uint32 kMsgSetDefaults = 'dflt';
|
||||||
|
static const uint32 kMsgRevert = 'rvrt';
|
||||||
|
|
||||||
|
|
||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow()
|
||||||
: BWindow( BRect(100,80,445,343) , "Fonts", B_TITLED_WINDOW,
|
: BWindow(BRect(100, 100, 445, 340), "Fonts", B_TITLED_WINDOW,
|
||||||
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
|
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
|
||||||
{
|
{
|
||||||
BRect r;
|
BRect rect = Bounds();
|
||||||
BTabView *tabView;
|
BView* view = new BView(rect, "background", B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
BBox *topLevelView;
|
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
double buttonViewHeight = 43.0;
|
AddChild(view);
|
||||||
|
|
||||||
r = Bounds();
|
rect.left = 10;
|
||||||
r.top += 10;
|
rect.top = rect.bottom - 10;
|
||||||
r.bottom -= buttonViewHeight+1;
|
BButton *button = new BButton(rect, "defaults", "Defaults",
|
||||||
|
new BMessage(kMsgSetDefaults), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW);
|
||||||
tabView = new BTabView(r, "tabview", B_WIDTH_FROM_LABEL);
|
button->ResizeToPreferred();
|
||||||
tabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
float buttonHeight = button->Bounds().Height();
|
||||||
|
button->MoveBy(0, -buttonHeight);
|
||||||
r = tabView->Bounds();
|
view->AddChild(button);
|
||||||
r.InsetBy(5, 5);
|
|
||||||
r.bottom -= tabView->TabHeight();
|
rect = button->Frame();
|
||||||
r.right -=2;
|
rect.OffsetBy(button->Bounds().Width() + 10, 0);
|
||||||
|
|
||||||
fSelectorView = new FontView(r);
|
fRevertButton = new BButton(rect, "revert", "Revert",
|
||||||
tabView->AddTab(fSelectorView);
|
new BMessage(kMsgRevert), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW);
|
||||||
|
fRevertButton->ResizeToPreferred();
|
||||||
r = Bounds();
|
fRevertButton->SetEnabled(false);
|
||||||
r.top = r.bottom - buttonViewHeight;
|
view->AddChild(fRevertButton);
|
||||||
|
|
||||||
fButtonView = new ButtonView(r);
|
rect = Bounds();
|
||||||
|
rect.top += 5;
|
||||||
topLevelView = new BBox(Bounds(), "TopLevelView", B_FOLLOW_ALL, B_WILL_DRAW, B_NO_BORDER);
|
rect.bottom -= 20 + buttonHeight;
|
||||||
|
BTabView *tabView = new BTabView(rect, "tabview", B_WIDTH_FROM_LABEL);
|
||||||
AddChild(topLevelView);
|
|
||||||
topLevelView->AddChild(fButtonView);
|
rect = tabView->ContainerView()->Bounds().InsetByCopy(5, 8);
|
||||||
topLevelView->AddChild(tabView);
|
fFontsView = new FontView(rect);
|
||||||
|
|
||||||
MoveTo(fSettings.WindowCorner());
|
tabView->AddTab(fFontsView);
|
||||||
|
|
||||||
|
float width, height;
|
||||||
|
fFontsView->GetPreferredSize(&width, &height);
|
||||||
|
|
||||||
|
// make sure the tab is large enough for the fonts view
|
||||||
|
float widthDiff = width + 10
|
||||||
|
- tabView->ContainerView()->Bounds().Width();
|
||||||
|
if (widthDiff > 0) {
|
||||||
|
tabView->ResizeBy(widthDiff, 0);
|
||||||
|
tabView->ContainerView()->ResizeBy(widthDiff, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
float heightDiff = height + 16
|
||||||
|
- tabView->ContainerView()->Bounds().Height();
|
||||||
|
if (heightDiff > 0) {
|
||||||
|
tabView->ResizeBy(0, heightDiff);
|
||||||
|
tabView->ContainerView()->ResizeBy(0, heightDiff);
|
||||||
|
}
|
||||||
|
|
||||||
|
ResizeTo(tabView->Bounds().Width(), tabView->Frame().bottom + 20 + buttonHeight);
|
||||||
|
view->AddChild(tabView);
|
||||||
|
fFontsView->ResizeToPreferred();
|
||||||
|
|
||||||
|
if (fSettings.WindowCorner() == BPoint(-1, -1)) {
|
||||||
|
// center window on screen
|
||||||
|
_Center();
|
||||||
|
} else {
|
||||||
|
MoveTo(fSettings.WindowCorner());
|
||||||
|
|
||||||
|
// make sure window is on screen
|
||||||
|
BScreen screen(this);
|
||||||
|
if (Frame().left > screen.Frame().right - 10
|
||||||
|
|| Frame().top > screen.Frame().bottom - 10)
|
||||||
|
_Center();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -60,22 +110,18 @@ void
|
|||||||
MainWindow::MessageReceived(BMessage *message)
|
MainWindow::MessageReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case M_ENABLE_REVERT:
|
case kMsgUpdate:
|
||||||
fButtonView->SetRevertState(true);
|
fRevertButton->SetEnabled(fFontsView->IsRevertable());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_RESCAN_FONTS:
|
case kMsgSetDefaults:
|
||||||
fSelectorView->RescanFonts();
|
fFontsView->SetDefaults();
|
||||||
|
fRevertButton->SetEnabled(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_SET_DEFAULTS:
|
case kMsgRevert:
|
||||||
fSelectorView->SetDefaults();
|
fFontsView->Revert();
|
||||||
fButtonView->SetRevertState(true);
|
fRevertButton->SetEnabled(false);
|
||||||
break;
|
|
||||||
|
|
||||||
case M_REVERT:
|
|
||||||
fSelectorView->Revert();
|
|
||||||
fButtonView->SetRevertState(false);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -83,3 +129,14 @@ MainWindow::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
MainWindow::_Center()
|
||||||
|
{
|
||||||
|
BScreen screen;
|
||||||
|
BRect screenFrame = screen.Frame();
|
||||||
|
|
||||||
|
MoveTo(screenFrame.left + (screenFrame.Width() - Bounds().Width()) / 2,
|
||||||
|
screenFrame.top + (screenFrame.Height() - Bounds().Height()) / 2);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,26 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2005, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Mark Hogben
|
||||||
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||||
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
*/
|
*/
|
||||||
#ifndef MAIN_WINDOW_H
|
#ifndef MAIN_WINDOW_H
|
||||||
#define MAIN_WINDOW_H
|
#define MAIN_WINDOW_H
|
||||||
|
|
||||||
#include <Application.h>
|
|
||||||
#include <Window.h>
|
|
||||||
#include <TabView.h>
|
|
||||||
#include <Box.h>
|
|
||||||
|
|
||||||
#include "FontView.h"
|
|
||||||
#include "ButtonView.h"
|
|
||||||
#include "FontsSettings.h"
|
#include "FontsSettings.h"
|
||||||
|
|
||||||
#define M_ENABLE_REVERT 'enrv'
|
#include <Window.h>
|
||||||
#define M_REVERT 'rvrt'
|
|
||||||
#define M_SET_DEFAULTS 'stdf'
|
class BButton;
|
||||||
|
class FontView;
|
||||||
|
|
||||||
#define M_SET_PLAIN 'stpl'
|
|
||||||
#define M_SET_BOLD 'stbl'
|
|
||||||
#define M_SET_FIXED 'stfx'
|
|
||||||
|
|
||||||
class MainWindow : public BWindow {
|
class MainWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
@@ -30,10 +27,14 @@ class MainWindow : public BWindow {
|
|||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FontView *fSelectorView;
|
void _Center();
|
||||||
ButtonView *fButtonView;
|
|
||||||
|
FontView* fFontsView;
|
||||||
|
BButton* fRevertButton;
|
||||||
|
|
||||||
FontsSettings fSettings;
|
FontsSettings fSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const int32 kMsgUpdate = 'updt';
|
||||||
|
|
||||||
#endif /* MAIN_WINDOW_H */
|
#endif /* MAIN_WINDOW_H */
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
#include "Pref_Utils.h"
|
|
||||||
|
|
||||||
float
|
|
||||||
FontHeight(bool full, BView* target)
|
|
||||||
{
|
|
||||||
font_height finfo;
|
|
||||||
if (target != NULL)
|
|
||||||
target->GetFontHeight(&finfo);
|
|
||||||
else
|
|
||||||
be_plain_font->GetHeight(&finfo);
|
|
||||||
|
|
||||||
float height = ceil(finfo.ascent) + ceil(finfo.descent);
|
|
||||||
|
|
||||||
if (full)
|
|
||||||
height += ceil(finfo.leading);
|
|
||||||
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
color_map*
|
|
||||||
ColorMap()
|
|
||||||
{
|
|
||||||
color_map* cmap;
|
|
||||||
|
|
||||||
BScreen screen(B_MAIN_SCREEN_ID);
|
|
||||||
cmap = (color_map*)screen.ColorMap();
|
|
||||||
|
|
||||||
return cmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#ifndef SHARED_PREF_UTILS
|
|
||||||
#define SHARED_PREF_UTILS
|
|
||||||
|
|
||||||
#include <Screen.h>
|
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
float FontHeight(bool full, BView* view = NULL);
|
|
||||||
color_map* ColorMap();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -2,22 +2,64 @@
|
|||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2005, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
|
* Authors:
|
||||||
|
* Mark Hogben
|
||||||
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||||
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "main.h"
|
|
||||||
#include "FontsSettings.h"
|
|
||||||
|
|
||||||
int main(int, char**)
|
#include <Alert.h>
|
||||||
{
|
#include <Application.h>
|
||||||
FontApp fontApp;
|
#include <TextView.h>
|
||||||
fontApp.Run();
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
FontApp::FontApp()
|
|
||||||
: BApplication("application/x-vnd.Haiku-FNPL")
|
class FontsApp : public BApplication {
|
||||||
|
public:
|
||||||
|
FontsApp();
|
||||||
|
|
||||||
|
virtual void AboutRequested();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
FontsApp::FontsApp()
|
||||||
|
: BApplication("application/x-vnd.Haiku-Fonts")
|
||||||
{
|
{
|
||||||
MainWindow *window = new MainWindow();
|
MainWindow *window = new MainWindow();
|
||||||
window->Show();
|
window->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FontsApp::AboutRequested()
|
||||||
|
{
|
||||||
|
BAlert *alert = new BAlert("about", "Fonts\n"
|
||||||
|
"\tCopyright 2004-2005, Haiku.\n\n", "Ok");
|
||||||
|
BTextView *view = alert->TextView();
|
||||||
|
BFont font;
|
||||||
|
|
||||||
|
view->SetStylable(true);
|
||||||
|
|
||||||
|
view->GetFont(&font);
|
||||||
|
font.SetSize(18);
|
||||||
|
font.SetFace(B_BOLD_FACE);
|
||||||
|
view->SetFontAndColor(0, 5, &font);
|
||||||
|
|
||||||
|
alert->Go();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int, char**)
|
||||||
|
{
|
||||||
|
FontsApp app;
|
||||||
|
app.Run();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2001-2005, Haiku.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef MAIN_H
|
|
||||||
#define MAIN_H
|
|
||||||
|
|
||||||
#include <Application.h>
|
|
||||||
|
|
||||||
class FontApp : public BApplication
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FontApp(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user