ds#21
Merged
Merged
Conversation
Controlling Stage scaling
When the portion of the screen representing Flash Player or AIR is resized, the runtime automatically adjusts the Stage contents to compensate. The Stage class’s scaleMode property determines how the Stage contents are adjusted. This property can be set to four different values, defined as constants in the flash.display.StageScaleMode class:
StageScaleMode.EXACT_FIT scales the SWF to fill the new stage dimensions without regard for the original content aspect ratio. The scale factors might not be the same for width and height, so the content can appear squeezed or stretched if the aspect ratio of the stage is changed.
StageScaleMode.SHOW_ALL scales the SWF to fit entirely within the new stage dimensions without changing the content aspect ratio. This scale mode displays all of the content, but can result in “letterbox” borders, like the black bars that appear when viewing a wide-screen movie on a standard television.
StageScaleMode.NO_BORDER scales the SWF to entirely fill the new stage dimensions without changing the aspect ratio of the content. This scale mode makes full use of the stage display area, but can result in cropping.
StageScaleMode.NO_SCALE — does not scale the SWF. If the new stage dimensions are smaller, the content is cropped; if larger, the added space is blank.
In the StageScaleMode.NO_SCALE scale mode only, the stageWidth and stageHeight properties of the Stage class can be used to determine the actual pixel dimensions of the resized stage. (In the other scale modes, the stageWidth and stageHeight properties always reflect the original width and height of the SWF.) In addition, when scaleMode is set to StageScaleMode.NO_SCALE and the SWF file is resized, the Stage class’s resize event is dispatched, allowing you to make adjustments accordingly.
Consequently, having scaleMode set to StageScaleMode.NO_SCALE allows you to have greater control over how the screen contents adjust to the window resizing if you desire. For example, in a SWF containing a video and a control bar, you might want to make the control bar stay the same size when the Stage is resized, and only change the size of the video window to accommodate the Stage size change. This is demonstrated in the following example:
usernamealreadyis
left a comment
Author
There was a problem hiding this comment.
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Web.Services.Protocols;
using System.Xml;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
VendorKey vendorKey;
Vendor vendor;
Policy policy;
ValidationResult validationResult;
// Create an instance of the service
DynamicsGP wsDynamicsGP = new DynamicsGP();
// Make sure that default credentials are being used
wsDynamicsGP.UseDefaultCredentials = true;
// Create a context with which to call the service
context = new Context();
// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Set up the context
context.OrganizationKey = (OrganizationKey)companyKey;
// Create a vendor key of the vendor to be updated
vendorKey = new VendorKey();
vendorKey.Id = "ACETRAVE0001";
// Create a vendor object
vendor = new Vendor();
vendor.Key = vendorKey;
// Set a pair of properties to create two validation errors
vendor.DiscountGracePeriod = 100;
vendor.DueDateGracePeriod = 100;
try
{
// Create a policy object
policy = wsDynamicsGP.GetPolicyByOperation
("UpdateVendor", context);
// Attempt to update the vendor
wsDynamicsGP.UpdateVendor(vendor, context, policy);
}
catch (SoapException soapErr)
{
// Examine the InnerXml document to find whether the
// /InnerException/Message node exists. If it does, then
// this is a validation exception. If it does
// not, then this is a system exception.
// Try retrieving the Message node
XmlDocument doc = new XmlDocument();
XmlNamespaceManager nsManager = new
XmlNamespaceManager(doc.NameTable);
nsManager.AddNamespace("sm",
"http://schemas.datacontract.org/2004/07/System.ServiceModel");
doc.LoadXml(soapErr.Detail.InnerXml);
XmlNode node = doc.SelectSingleNode(
"//sm:InnerException//sm:Message", nsManager);
if (node != null)
{
// This is a validation exception
// Use the GUID retrieved to load the validation details
Guid LogId = new Guid(node.InnerText.Trim());
// Get the validation result object
validationResult = wsDynamicsGP.
GetLoggedValidationResultByKey(LogId, context);
// Display the validation exceptions
StringBuilder validationList = new StringBuilder();
foreach(ValidationError ve in validationResult.Errors)
{
validationList.AppendLine(ve.Message);
}
foreach(ValidationWarning vw in validationResult.Warnings)
{
validationList.AppendLine(vw.Message);
}
MessageBox.Show(validationList.ToString(), "Sample",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
// This is a system exception
// Display the message
MessageBox.Show(soapErr.Message, "Sample",
MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
}
}
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@xccvv/kupret-inc
@xccvv/p12-koplak-inc
`/* wireshark-qt.cpp
*
*
*
*
*/
include <config.h>
include <glib.h>
ifdef Q_OS_UNIX
include <signal.h>
endif
ifdef HAVE_LIBZ
include <zlib.h> /* to get the libz version number */
endif
ifdef HAVE_GETOPT_H
include <getopt.h>
endif
ifndef HAVE_GETOPT_LONG
include "wsutil/wsgetopt.h"
endif
include <wsutil/clopts_common.h>
include <wsutil/cmdarg_err.h>
include <wsutil/crash_info.h>
include <wsutil/filesystem.h>
include <wsutil/privileges.h>
ifdef HAVE_PLUGINS
include <wsutil/plugins.h>
endif
include <wsutil/report_err.h>
include <wsutil/u3.h>
include <wsutil/unicode-utils.h>
include <wsutil/ws_diag_control.h>
include <wsutil/ws_version_info.h>
include <epan/addr_resolv.h>
include <epan/ex-opt.h>
include <epan/tap.h>
include <epan/stat_tap_ui.h>
include <epan/column.h>
include <epan/disabled_protos.h>
ifdef HAVE_KERBEROS
include <epan/packet.h>
include <epan/asn1.h>
include <epan/dissectors/packet-kerberos.h>
endif
ifdef HAVE_PLUGINS
include <codecs/codecs.h>
endif
/* general (not Qt specific) */
include "file.h"
include "color.h"
include "color_filters.h"
include "log.h"
include "epan/rtd_table.h"
include "epan/srt_table.h"
include "ui/alert_box.h"
include "ui/console.h"
include "ui/iface_lists.h"
include "ui/language.h"
include "ui/persfilepath_opt.h"
include "ui/recent.h"
include "ui/simple_dialog.h"
include "ui/util.h"
include "ui/qt/conversation_dialog.h"
include "ui/qt/endpoint_dialog.h"
include "ui/qt/main_window.h"
include "ui/qt/response_time_delay_dialog.h"
include "ui/qt/service_response_time_dialog.h"
include "ui/qt/simple_dialog.h"
include "ui/qt/simple_statistics_dialog.h"
include "ui/qt/splash_overlay.h"
include "ui/qt/wireshark_application.h"
include "caputils/capture-pcap-util.h"
ifdef _WIN32
include "caputils/capture-wpcap.h"
include "caputils/capture_wpcap_packet.h"
include <tchar.h> /* Needed for Unicode */
include <wsutil/file_util.h>
include <wsutil/os_version_info.h>
endif /* _WIN32 */
ifdef HAVE_AIRPCAP
include <caputils/airpcap.h>
include <caputils/airpcap_loader.h>
//# include "airpcap_dlg.h"
//# include "airpcap_gui_utils.h"
endif
include "epan/crypt/airpdcap_ws.h"
if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
include
endif
if defined(HAVE_LIBPCAP) || defined(HAVE_EXTCAP)
capture_options global_capture_opts;
endif
GString *comp_info_str, *runtime_info_str;
/* update the main window */
void main_window_update(void)
{
WiresharkApplication::processEvents();
}
ifdef HAVE_LIBPCAP
/* quit a nested main window */
void main_window_nested_quit(void)
{
// if (gtk_main_level() > 0)
wsApp->quit();
}
/* quit the main window */
void main_window_quit(void)
{
wsApp->quit();
}
endif /* HAVE_LIBPCAP */
// xxx copied from ../gtk/main.c
static void
print_usage(gboolean for_help_option) {
FILE *output;
ifdef _WIN32
endif
ifdef HAVE_LIBPCAP
ifdef HAVE_PCAP_CREATE
endif
ifdef CAN_SET_CAPTURE_BUFFER_SIZE
endif
endif /* HAVE_LIBPCAP */
ifdef HAVE_PCAP_REMOTE
endif
ifndef _WIN32
endif
ifdef _WIN32
endif
}
/*
*/
// xxx copied from ../gtk/main.c
static void
wireshark_cmdarg_err(const char *fmt, va_list ap)
{
#ifdef _WIN32
create_console();
#endif
fprintf(stderr, "wireshark: ");
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
}
/*
*/
// xxx copied from ../gtk/main.c
static void
wireshark_cmdarg_err_cont(const char *fmt, va_list ap)
{
#ifdef _WIN32
create_console();
#endif
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
}
// xxx based from ../gtk/main.c:get_gtk_compiled_info
static void
get_wireshark_qt_compiled_info(GString *str)
{
g_string_append(str, "with ");
g_string_append_printf(str,
ifdef QT_VERSION
else
endif
ifdef HAVE_LIBZ
ifdef ZLIB_VERSION
else /* ZLIB_VERSION */
endif /* ZLIB_VERSION */
else /* HAVE_LIBZ */
endif /* HAVE_LIBZ */
}
// xxx copied from ../gtk/main.c
static void
get_gui_compiled_info(GString *str)
{
epan_get_compiled_version_info(str);
ifdef QT_MULTIMEDIA_LIB
else
endif
ifdef HAVE_AIRPCAP
else
endif
}
// xxx copied from ../gtk/main.c
static void
get_wireshark_runtime_info(GString *str)
{
ifdef HAVE_LIBPCAP
endif
if defined(HAVE_LIBZ) && !defined(_WIN32)
endif
ifdef HAVE_AIRPCAP
endif
}
ifdef HAVE_LIBPCAP
/* Check if there's something important to tell the user during startup.
*/
static void
check_and_warn_user_startup(const QString &cf_name)
{
ifndef _WIN32
Q_UNUSED(cf_name)
endif
gchar *cur_user, *cur_group;
/* Tell the user not to run as root. */
if (running_with_special_privs() && recent.privs_warn_if_elevated) {
cur_user = get_cur_username();
cur_group = get_cur_groupname();
simple_message_box(ESD_TYPE_WARN, &recent.privs_warn_if_elevated,
"Running as user "%s" and group "%s".\n"
"This could be dangerous.\n\n"
"If you're running Wireshark this way in order to perform live capture, "
"you may want to be aware that there is a better way documented at\n"
"https://wiki.wireshark.org/CaptureSetup/CapturePrivileges", cur_user, cur_group);
g_free(cur_user);
g_free(cur_group);
}
ifdef _WIN32
endif
}
endif
ifdef _WIN32
// Try to avoid library search path collisions. QCoreApplication will
// search QT_INSTALL_PREFIX/plugins for platform DLLs before searching
// the application directory. If
//
// - You have Qt version 5.x.y installed in the default location
// (C:\Qt\5.x) on your machine.
//
// and
//
// - You install Wireshark that was built on a machine with Qt version
// 5.x.z installed in the default location.
//
// Qt5Core.dll will load qwindows.dll from your local C:\Qt\5.x...\plugins
// directory. This may not be compatible with qwindows.dll from that
// same path on the build machine. At any rate, loading DLLs from paths
// you don't control is ill-advised. We work around this by removing every
// path except our application directory.
static inline void
reset_library_path(void)
{
QString app_path = QDir(get_progfile_dir()).path();
foreach (QString path, QCoreApplication::libraryPaths()) {
QCoreApplication::removeLibraryPath(path);
}
QCoreApplication::addLibraryPath(app_path);
}
endif
/* And now our feature presentation... [ fade to music ] */
int main(int argc, char *argv[])
{
MainWindow *main_w;
ifdef _WIN32
endif /* _WIN32 */
ifdef HAVE_LIBPCAP
else
ifdef _WIN32
ifdef HAVE_AIRPCAP
endif
endif
endif
if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
endif
ifdef _WIN32
endif /* _WIN32 */
ifdef _WIN32
ifdef HAVE_AIRPCAP
if 0
endif
endif /* HAVE_AIRPCAP */
endif /* _WIN32 */
define OPTSTRING OPTSTRING_CAPTURE_COMMON "C:g:Hh" "jJ:kK:lm:nN:o:P:r:R:St:u:vw:X:Y:z:"
DIAG_OFF(cast-qual)
static const struct option long_options[] = {
{(char *)"help", no_argument, NULL, 'h'},
{(char *)"read-file", required_argument, NULL, 'r' },
{(char *)"read-filter", required_argument, NULL, 'R' },
{(char *)"display-filter", required_argument, NULL, 'Y' },
{(char *)"version", no_argument, NULL, 'v'},
LONGOPT_CAPTURE_COMMON
{0, 0, 0, 0 }
};
DIAG_ON(cast-qual)
static const char optstring[] = OPTSTRING;
ifdef HAVE_LIBPCAP
ifdef _WIN32
endif /* _WIN32 */
ifdef _WIN32
endif /* _WIN32 */
else /* HAVE_LIBPCAP */
endif /* HAVE_LIBPCAP */
ifdef _WIN32
endif
ifdef _WIN32
endif
ifdef _WIN32
endif
ifdef _WIN32
endif
ifdef _WIN32
endif /* _WIN32 */
ifdef Q_OS_UNIX
endif
ifdef HAVE_LIBPCAP
endif
ifdef HAVE_PLUGINS
endif
ifdef HAVE_PLUGINS
endif
ifdef HAVE_OPTRESET
else
endif
ifdef HAVE_PCAP_CREATE
endif
ifdef HAVE_PCAP_REMOTE
endif
ifdef CAN_SET_CAPTURE_BUFFER_SIZE
endif
ifdef HAVE_LIBPCAP
else
endif
ifdef HAVE_KERBEROS
endif
ifdef HAVE_LIBPCAP
else
endif
ifdef HAVE_LIBPCAP
else
endif
"It must be "a" for absolute, "ad" for absolute with YYYY-MM-DD date,");
cmdarg_err_cont(
""adoy" for absolute with YYYY/DOY date, "d" for delta,");
cmdarg_err_cont(
""dd" for delta displayed, "e" for epoch, "r" for relative,");
cmdarg_err_cont(
""u" for absolute UTC, "ud" for absolute UTC with YYYY-MM-DD date,");
cmdarg_err_cont(
"or "udoy" for absolute UTC with YYYY/DOY date.");
exit(1);
}
break;
case 'u': /* Seconds type /
if (strcmp(optarg, "s") == 0)
timestamp_set_seconds_type(TS_SECONDS_DEFAULT);
else if (strcmp(optarg, "hms") == 0)
timestamp_set_seconds_type(TS_SECONDS_HOUR_MIN_SEC);
else {
cmdarg_err("Invalid seconds type "%s"", optarg);
cmdarg_err_cont(
"It must be "s" for seconds or "hms" for hours, minutes and seconds.");
exit(1);
}
break;
case 'X':
/ ext ops were already processed just ignore them this time_/
break;
case 'Y':
dfilter = QString(optarg);
break;
case 'z':
/_ We won't call the init function for the stat this soon
as it would disallow MATE's fields (which are registered
by the preferences set callback) from being used as
part of a tap filter. Instead, we just add the argument
to a list of stat arguments. /
if (strcmp("help", optarg) == 0) {
fprintf(stderr, "wireshark: The available statistics for the "-z" option are:\n");
list_stat_cmd_args();
exit(0);
}
if (!process_stat_cmd_arg(optarg)) {
cmdarg_err("Invalid -z argument.");
cmdarg_err_cont(" -z argument must be one of :");
list_stat_cmd_args();
exit(1);
}
break;
case LONGOPT_DISABLE_PROTOCOL: / disable dissection of protocol /
disable_protocol_slist = g_slist_append(disable_protocol_slist, optarg);
break;
case LONGOPT_ENABLE_HEURISTIC: / enable heuristic dissection of protocol /
enable_heur_slist = g_slist_append(enable_heur_slist, optarg);
break;
case LONGOPT_DISABLE_HEURISTIC: / disable heuristic dissection of protocol */
disable_heur_slist = g_slist_append(disable_heur_slist, optarg);
break;
ifndef HAVE_LIBPCAP
endif
ifdef HAVE_LIBPCAP
if defined(HAVE_PCAP_CREATE)
else
endif
ifdef _WIN32
endif /* _WIN32 */
if defined(HAVE_PCAP_CREATE)
else
endif
ifdef _WIN32
endif /* _WIN32 */
endif /* HAVE_LIBPCAP */
ifdef HAVE_LIBPCAP
endif
////////
////////
////////
color_filters_init();
////////
ifdef HAVE_LIBPCAP
else /* HAVE_LIBPCAP */
endif /* HAVE_LIBPCAP */
ifdef HAVE_LIBPCAP
// show_main_window(FALSE);
check_and_warn_user_startup(cf_name);
endif /* HAVE_LIBPCAP */
ifdef _WIN32
endif /* _WIN32 */
}
/*
*
*
*/
`