mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-21 19:42:37 -04:00
Get rid of obsolete warning when compiling GUI, partially fix scale 1/2 not working
This commit is contained in:
parent
dad908c68c
commit
8ee32ba780
@ -129,7 +129,7 @@ namespace MCGalaxy.Gui.Components {
|
||||
|
||||
void HandleLinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e) {
|
||||
if (!Popup.OKCancel("Never open links from people that you don't trust!", "Warning!!")) return;
|
||||
Program.OpenBrowser(e.LinkText);
|
||||
GuiUtils.OpenBrowser(e.LinkText);
|
||||
}
|
||||
|
||||
/// <summary> Scrolls to the end of the log </summary>
|
||||
|
@ -19,9 +19,10 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MCGalaxy.Gui {
|
||||
internal static class GuiPerms {
|
||||
|
||||
namespace MCGalaxy.Gui
|
||||
{
|
||||
internal static class GuiPerms
|
||||
{
|
||||
internal static string[] RankNames;
|
||||
internal static LevelPermission[] RankPerms;
|
||||
|
||||
|
64
GUI/GuiUtils.cs
Normal file
64
GUI/GuiUtils.cs
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright 2015 MCGalaxy
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MCGalaxy.Gui
|
||||
{
|
||||
/// <summary> Shortcuts for MessageBox.Show </summary>
|
||||
public static class Popup
|
||||
{
|
||||
public static void Message(string message, string title = "") {
|
||||
MessageBox.Show(message, title);
|
||||
}
|
||||
|
||||
public static void Error(string message) {
|
||||
MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
public static void Warning(string message) {
|
||||
MessageBox.Show(message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
public static bool OKCancel(string message, string title) {
|
||||
return MessageBox.Show(message, title, MessageBoxButtons.OKCancel,
|
||||
MessageBoxIcon.Warning) == DialogResult.OK;
|
||||
}
|
||||
|
||||
public static bool YesNo(string message, string title) {
|
||||
return MessageBox.Show(message, title, MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question) == DialogResult.Yes;
|
||||
}
|
||||
}
|
||||
|
||||
public static class GuiUtils
|
||||
{
|
||||
/// <summary> Opens the given url in the system's default web browser </summary>
|
||||
/// <remarks> Catches and logs any unhandled errors </remarks>
|
||||
public static void OpenBrowser(string url) {
|
||||
try {
|
||||
Process.Start(url);
|
||||
} catch (Exception ex) {
|
||||
Logger.LogError("Opening url in browser", ex);
|
||||
Popup.Error("Failed to open " + url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,7 @@
|
||||
<Compile Include="Controls\HackyPropertyGrid.cs" />
|
||||
<Compile Include="Controls\TimespanUpDown.cs" />
|
||||
<Compile Include="GuiPerms.cs" />
|
||||
<Compile Include="GuiUtils.cs" />
|
||||
<Compile Include="Popups\ColorSelector.cs" />
|
||||
<Compile Include="Popups\ColorSelector.Designer.cs">
|
||||
<DependentUpon>ColorSelector.cs</DependentUpon>
|
||||
|
@ -40,7 +40,7 @@ namespace MCGalaxy.Gui.Popups {
|
||||
}
|
||||
|
||||
void linkManually_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
|
||||
Program.OpenBrowser("https://www.canyouseeme.org/");
|
||||
GuiUtils.OpenBrowser("https://www.canyouseeme.org/");
|
||||
}
|
||||
|
||||
void PortChecker_FormClosing(object sender, FormClosingEventArgs e) {
|
||||
@ -48,7 +48,7 @@ namespace MCGalaxy.Gui.Popups {
|
||||
}
|
||||
|
||||
void linkHelpForward_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
|
||||
Program.OpenBrowser("https://portforward.com");
|
||||
GuiUtils.OpenBrowser("https://portforward.com");
|
||||
}
|
||||
|
||||
void btnForward_Click(object sender, EventArgs e) {
|
||||
|
@ -16,40 +16,15 @@
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MCGalaxy.Gui {
|
||||
|
||||
public static class Popup {
|
||||
public static void Message(string message, string title = "") {
|
||||
MessageBox.Show(message, title);
|
||||
}
|
||||
|
||||
public static void Error(string message) {
|
||||
MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
public static void Warning(string message) {
|
||||
MessageBox.Show(message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
public static bool OKCancel(string message, string title) {
|
||||
return MessageBox.Show(message, title, MessageBoxButtons.OKCancel,
|
||||
MessageBoxIcon.Warning) == DialogResult.OK;
|
||||
}
|
||||
|
||||
public static bool YesNo(string message, string title) {
|
||||
return MessageBox.Show(message, title, MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question) == DialogResult.Yes;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Program {
|
||||
|
||||
namespace MCGalaxy.Gui
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
[STAThread]
|
||||
public static void Main(string[] args) {
|
||||
Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
@ -96,15 +71,6 @@ namespace MCGalaxy.Gui {
|
||||
static void ThreadExHandler(object sender, ThreadExceptionEventArgs e) {
|
||||
LogAndRestart(e.Exception);
|
||||
}
|
||||
|
||||
public static void OpenBrowser(string url) {
|
||||
try {
|
||||
Process.Start(url);
|
||||
} catch (Exception ex) {
|
||||
Logger.LogError("Opening url in browser", ex);
|
||||
Popup.Error("Failed to open " + url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ namespace MCGalaxy.Gui {
|
||||
}
|
||||
|
||||
void sql_linkDownload_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
|
||||
Program.OpenBrowser("https://dev.mysql.com/downloads/");
|
||||
GuiUtils.OpenBrowser("https://dev.mysql.com/downloads/");
|
||||
}
|
||||
|
||||
void sql_chkUseSQL_CheckedChanged(object sender, EventArgs e) {
|
||||
|
@ -134,7 +134,7 @@ namespace MCGalaxy.Gui {
|
||||
}
|
||||
|
||||
void dis_lnkHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
|
||||
Program.OpenBrowser(Updater.SourceURL + "/wiki/Discord-relay-bot/");
|
||||
GuiUtils.OpenBrowser(Updater.SourceURL + "/wiki/Discord-relay-bot/");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,8 +134,7 @@ namespace MCGalaxy.Gui {
|
||||
|
||||
void SetAutoload(bool value) {
|
||||
if (value) {
|
||||
// Use AddOrReplace for backwards compatibility
|
||||
Server.AutoloadMaps.AddOrReplace(lvl.name, lvl.physics.ToString());
|
||||
Server.AutoloadMaps.Update(lvl.name, lvl.physics.ToString());
|
||||
} else {
|
||||
Server.AutoloadMaps.Remove(lvl.name);
|
||||
}
|
||||
|
@ -22,9 +22,10 @@ using System.Xml;
|
||||
using MCGalaxy.Network;
|
||||
//This upnp class comes from http://www.codeproject.com/Articles/27992/NAT-Traversal-with-UPnP-in-C, Modified for use with MCForge
|
||||
|
||||
namespace MCGalaxy {
|
||||
public static class UPnP {
|
||||
|
||||
namespace MCGalaxy
|
||||
{
|
||||
public static class UPnP
|
||||
{
|
||||
public static TimeSpan Timeout = TimeSpan.FromSeconds(3);
|
||||
|
||||
const string req =
|
||||
|
@ -138,7 +138,7 @@ namespace MCGalaxy.Gui {
|
||||
|
||||
void main_TxtUrl_DoubleClick(object sender, EventArgs e) {
|
||||
if (!Main_IsUsingUrl()) return;
|
||||
Program.OpenBrowser(main_txtUrl.Text);
|
||||
GuiUtils.OpenBrowser(main_txtUrl.Text);
|
||||
}
|
||||
|
||||
void main_BtnSaveAll_Click(object sender, EventArgs e) {
|
||||
|
@ -43,9 +43,9 @@ namespace MCGalaxy.Drawing.Transforms
|
||||
|
||||
public void CheckScales() {
|
||||
// Need to reverse direction for negative scales
|
||||
signX = Math.Sign(XMul / XDiv);
|
||||
signY = Math.Sign(YMul / YDiv);
|
||||
signZ = Math.Sign(ZMul / ZDiv);
|
||||
signX = Math.Sign(XMul * XDiv); // using * instead of /,
|
||||
signY = Math.Sign(YMul * YDiv); // as otherwise scales < 1
|
||||
signZ = Math.Sign(ZMul * ZDiv); // don't work (e.g. 1/2)
|
||||
|
||||
XMul = Math.Abs(XMul); XDiv = Math.Abs(XDiv);
|
||||
YMul = Math.Abs(YMul); YDiv = Math.Abs(YDiv);
|
||||
|
Loading…
x
Reference in New Issue
Block a user